TimeTrex/interface/html5/dist/home-dashlet-DashletController.bundle.js

1 line
134 KiB
JavaScript
Raw Permalink Normal View History

2022-12-13 07:10:06 +01:00
"use strict";(self.webpackChunktimetrex=self.webpackChunktimetrex||[]).push([["home-dashlet-DashletController"],{190:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"DashletController\": () => (/* binding */ DashletController)\n/* harmony export */ });\n/* harmony import */ var _views_TTBackboneView__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6739);\n/* harmony import */ var _global_Global__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(9490);\n/* provided dependency */ var _ = __webpack_require__(9050);\n/* provided dependency */ var $ = __webpack_require__(9755);\n\n\n\nclass DashletController extends _views_TTBackboneView__WEBPACK_IMPORTED_MODULE_0__.TTBackboneView {\n\tconstructor( options = {} ) {\n\t\t_.defaults( options, {\n\t\t\tdata: null,\n\t\t\tapi_dashboard: null,\n\t\t\tapi_user_report: null,\n\t\t\tuser_generic_data_api: null,\n\t\t\tall_columns: null,\n\t\t\tgrid: null,\n\t\t\tdashboard_data: null,\n\t\t\trefresh_timer: null,\n\t\t\tiframe_data: null,\n\t\t\tinitComplete: false,\n\t\t\tiframe: null,\n\t\t\thomeViewController: null,\n\t\t\tinitTimesheetGridComplete: null,\n\t\t\taccumulated_total_grid_source_map: null,\n\t\t\taccmulated_order_map: null\n\t\t} );\n\n\t\tsuper( options );\n\t}\n\n\tinitialize( options ) {\n\t\tsuper.initialize( options );\n\t\tthis.api_dashboard = TTAPI.APIDashboard;\n\t\tthis.user_generic_data_api = TTAPI.APIUserGenericData;\n\t}\n\n\trefreshIfNecessary() {\n\t\tif ( this.data && this.data.data.dashlet_type == 'custom_report' || this.data.data.dashlet_type === 'news' ) {\n\t\t\tif ( this.iframe_data ) {\n\t\t\t\tthis.addIframeBack();\n\t\t\t\tthis.setIframeData();\n\t\t\t}\n\t\t}\n\t}\n\n\tinitContent() {\n\t\tvar $this = this;\n\t\tthis.setTitle();\n\t\tthis.initComplete = false;\n\n\t\tif ( _global_Global__WEBPACK_IMPORTED_MODULE_1__/* .Global.isScrolledIntoView */ .x.isScrolledIntoView( $( $this.el ) ) ) {\n\t\t\tdoInit();\n\t\t}\n\n\t\t//BUG#2070 - Disable resizable for mobile because it negatively impacts usability\n\t\tif ( _global_Global__WEBPACK_IMPORTED_MODULE_1__/* .Global.detectMobileBrowser */ .x.detectMobileBrowser() == false ) {\n\t\t\t$( '#' + $( this.el ).attr( 'id' ) ).resizable( {\n\t\t\t\thandles: 'all',\n\t\t\t\tstart: function( e, ui ) {\n\t\t\t\t},\n\t\t\t\tresize: function( e, ui ) {\n\t\t\t\t\t$this.setGridSize();\n\t\t\t\t},\n\t\t\t\tstop: function( e, ui ) {\n\t\t\t\t\t$this.addIframeBack();\n\t\t\t\t\tvar height = Math.round( ui[\"element\"][0].offsetHeight / 10 ) * 10; //Snap to nearest 10px\n\t\t\t\t\tvar width = Math.round( ui[\"element\"][0].offsetWidth / $( '.dashboard-container' ).width() * 100 ); //Snap nearest whole integer\n\n\t\t\t\t\t//We perform math on the width value that we save, because of that we need to set the div to that value too.\n\t\t\t\t\t//This should help prevent differences in width the users see while resizing their dashlets and after refreshing.\n\t\t\t\t\tui[\"element\"][0].style.height = height + 'px';\n\t\t\t\t\tui[\"element\"][0].style.width = width + '%';\n\n\t\t\t\t\t$this.saveSize( height, width );\n\n\t\t\t\t\t$this.homeViewController.updateLayout();\n\t\t\t\t\t$this.homeViewController.dashboard_container.masonry( 'reloadItems' );\n\t\t\t\t},\n\t\t\t} );\n\t\t\t//$( '#' + $( this.el ).attr( 'id' ) ).resizable( 'option', 'handles','all' );\n\t\t}\n\n\t\tthis.homeViewController.dashboard_container.parent().scroll( function() {\n\t\t\tif ( _global_Global__WEBPACK_IMPORTED_MODULE_1__/* .Global.isScrolledIntoView */ .x.isScrolledIntoView( $( $this.el ) ) && !$this.initComplete ) {\n\t\t\t\tdoInit();\n\t\t\t}\n\t\t} );\n\n\t\tfunction doInit() {\n\t\t\tif ( $this.data.data.dashlet_type == 'custom_list' ) {\n\t\t\t\t$( $this.el ).addClass( 'custom_list' );\n\t\t\t\t$this.initCustomViewContent();\n\t\t\t} else if ( $this.data.data.dashlet_type == 'custom_report' ) {\n\t\t\t\t$( $this.el ).addClass( 'custom-report' );\n\t\t\t\t$this.initReportContent(