TimeTrex/interface/html5/dist/wizard-user_generic_data_status-UserGenericStatusWindowController.bundle.js

1 line
22 KiB
JavaScript
Raw Permalink Normal View History

2022-12-13 07:10:06 +01:00
"use strict";(self.webpackChunktimetrex=self.webpackChunktimetrex||[]).push([["wizard-user_generic_data_status-UserGenericStatusWindowController"],{1706:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"UserGenericStatusWindowController\": () => (/* binding */ UserGenericStatusWindowController)\n/* harmony export */ });\n/* provided dependency */ var _ = __webpack_require__(9050);\n/* provided dependency */ var $ = __webpack_require__(9755);\nclass UserGenericStatusWindowController extends BaseViewController {\n\tconstructor( options = {} ) {\n\t\t_.defaults( options, {\n\t\t\t// el: '.user-generic-data-status',\n\t\t\tel: '', // el is set to the DOM id which is set in UserGenericStatusWindowController.open()\n\n\t\t\tbatch_id: '',\n\t\t\tuser_id: '',\n\n\t\t\tcallback: null,\n\n\t\t\tevents: {\n\t\t\t\t'click .done-btn': 'onCloseClick'\n\t\t\t},\n\n\t\t} );\n\n\t\tsuper( options );\n\t}\n\n\tinit( options ) {\n\t\tthis.options = options;\n\t\tthis.content_div = $( this.el ).find( '.content' );\n\t\tthis.batch_id = this.options.batch_id;\n\t\tthis.user_id = this.options.user_id;\n\n\t\tif ( this.options.callback ) {\n\t\t\tthis.callback = this.options.callback;\n\t\t}\n\n\t\tthis.api = TTAPI.APIUserGenericStatus;\n\t\tthis.render();\n\t\tthis.initData();\n\n\t}\n\n\t//Don't initOptions if edit_only_mode. Do it in sub views\n\tinitData() {\n\t\tvar $this = this;\n\t\tProgressBar.showOverlay();\n\t\tthis.getAllColumns( function() {\n\t\t\t$this.initLayout();\n\t\t} );\n\t}\n\n\tinitLayout() {\n\t\tvar $this = this;\n\t\t$this.getDefaultDisplayColumns( function() {\n\t\t\t$this.setSelectLayout();\n\t\t\t$this.search();\n\n\t\t} );\n\t}\n\n\tonCloseClick() {\n\t\t// UserGenericStatusWindowController.instance = null;\n\t\t$( this.el ).remove();\n\n\t\tif ( this.callback ) {\n\t\t\tthis.callback();\n\t\t}\n\t}\n\n\trender() {\n\t\tvar title = $( this.el ).find( '.title' );\n\t\ttitle.text( $.i18n._( 'Status Report' ) );\n\n\t}\n\n\tgetAllColumns( callBack ) {\n\n\t\tvar $this = this;\n\t\tthis.api.getOptions( 'columns', {\n\t\t\tonResult( columns_result ) {\n\t\t\t\tvar columns_result_data = columns_result.getResult();\n\t\t\t\t$this.all_columns = Global.buildColumnArray( columns_result_data );\n\n\t\t\t\tif ( callBack ) {\n\t\t\t\t\tcallBack();\n\t\t\t\t}\n\n\t\t\t}\n\t\t} );\n\n\t}\n\n\tsearch( set_default_menu ) {\n\n\t\tif ( !Global.isSet( set_default_menu ) ) {\n\t\t\tset_default_menu = true;\n\t\t}\n\n\t\tvar $this = this;\n\n\t\tvar filter = {};\n\t\tfilter.filter_data = {};\n\t\tfilter.filter_data.batch_id = this.batch_id;\n\t\tfilter.filter_items_per_page = 0; // Default to 0 to load user preference defined\n\n\t\tthis.api['getUserGenericStatus']( filter, true, {\n\t\t\tonResult: function( result ) {\n\n\t\t\t\tvar result_data = result.getResult();\n\t\t\t\tresult_data = Global.formatGridData( result_data, $this.api.key_name );\n\n\t\t\t\t$this.grid.setData( result_data );\n\n\t\t\t\t$this.setGridSize();\n\n\t\t\t\tProgressBar.closeOverlay(); //Add this in initData\n\n\t\t\t\tif ( set_default_menu ) {\n\t\t\t\t\t$this.setDefaultMenu( true );\n\t\t\t\t}\n\n\t\t\t}\n\t\t} );\n\n\t\tthis.api['getUserGenericStatusCountArray']( this.user_id, this.batch_id, {\n\t\t\tonResult: function( result ) {\n\n\t\t\t\tvar result_data = result.getResult();\n\n\t\t\t\tvar failed = $( $this.el ).find( '.failed' );\n\t\t\t\tvar warning = $( $this.el ).find( '.warning' );\n\t\t\t\tvar success = $( $this.el ).find( '.success' );\n\n\t\t\t\tif ( result_data != true && result_data.status ) {\n\t\t\t\t\tfailed.text( result_data.status[10].total + '/' + result_data.total + '( ' + result_data.status[10].percent + '% )' );\n\t\t\t\t\twarning.text( result_data.status[20].total + '/' + result_data.total + '( ' + result_data.status[20].percent + '% )' );\n\t\t\t\t\tsuccess.text( result_data.status[30].total + '/' + result_data.total + '( ' + result_data.status[30].percent + '% )' );\n\t\t\t