TimeTrex/interface/html5/dist/policy-accrual_policy-AccrualPolicyUserModifierViewController.bundle.js

1 line
98 KiB
JavaScript
Raw Permalink Normal View History

2022-12-13 07:10:06 +01:00
"use strict";(self.webpackChunktimetrex=self.webpackChunktimetrex||[]).push([["policy-accrual_policy-AccrualPolicyUserModifierViewController"],{7369:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"AccrualPolicyUserModifierViewController\": () => (/* binding */ AccrualPolicyUserModifierViewController)\n/* harmony export */ });\n/* provided dependency */ var _ = __webpack_require__(9050);\n/* provided dependency */ var $ = __webpack_require__(9755);\nclass AccrualPolicyUserModifierViewController extends BaseViewController {\n\tconstructor( options = {} ) {\n\t\t_.defaults( options, {\n\t\t\tel: '#accrual_policy_user_modifier_view_container', //Must set el here and can only set string, so events can work\n\n\t\t\tuser_api: null,\n\n\t\t\tparent_view: null,\n\n\t\t\tresult_details: null\n\t\t} );\n\n\t\tsuper( options );\n\t}\n\n\tinit( options ) {\n\t\tthis.parent_view = this.parent_view_controller.viewId === 'Employee' ? 'employee' : 'accrual_policy'; //Previously was passed in the <script> tag of edit view html.\n\t\t//this._super('initialize', options );\n\t\tif ( this.parent_view === 'employee' ) {\n\t\t\tthis.context_menu_name = $.i18n._( 'Accruals' );\n\t\t\tthis.navigation_label = $.i18n._( 'Accrual' );\n\t\t} else if ( this.parent_view === 'accrual_policy' ) {\n\t\t\tthis.context_menu_name = $.i18n._( 'Employee Settings' );\n\t\t\tthis.navigation_label = $.i18n._( 'Employee Accrual Modifier' );\n\t\t}\n\t\tthis.edit_view_tpl = 'AccrualPolicyUserModifierEditView.html';\n\t\tthis.permission_id = 'accrual_policy';\n\t\tthis.script_name = 'AccrualPolicyUserModifierView';\n\t\tthis.viewId = 'AccrualPolicyUserModifier';\n\t\tthis.table_name_key = 'accrual_policy_user_modifier';\n\n\t\tthis.api = TTAPI.APIAccrualPolicyUserModifier;\n\t\tthis.user_api = TTAPI.APIUser;\n\n\t\tthis.render();\n\t\tif ( this.sub_view_mode ) {\n\t\t\tthis.buildContextMenu( true );\n\t\t} else {\n\t\t\tthis.buildContextMenu();\n\t\t}\n\n\t\t//call init data in parent view\n\t\tif ( !this.sub_view_mode ) {\n\t\t\tthis.initData();\n\t\t}\n\t}\n\n\tgetCustomContextMenuModel() {\n\t\tvar context_menu_model = {\n\t\t\texclude: ['add', 'copy'],\n\t\t\tinclude: ['default']\n\t\t};\n\n\t\treturn context_menu_model;\n\t}\n\n\tsetSubLogViewFilter() {\n\t\tif ( !this.sub_log_view_controller ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tthis.sub_log_view_controller.getSubViewFilter = function( filter ) {\n\t\t\tfilter['table_name_object_id'] = {\n\t\t\t\t'accrual_policy_user_modifier': [this.parent_edit_record.accrual_policy_id]\n\t\t\t};\n\n\t\t\treturn filter;\n\t\t};\n\n\t\treturn true;\n\t}\n\n\tonAddClick() {\n\t\tvar $this = this;\n\t\tthis.setCurrentEditViewState( 'new' );\n\t\t$this.openEditView();\n\n\t\tvar user_id;\n\n\t\tif ( $this.sub_view_mode && $this.parent_key ) {\n\t\t\tswitch ( $this.parent_key ) {\n\t\t\t\tcase 'user_id':\n\t\t\t\t\tuser_id = $this.parent_value;\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'accrual_policy_id':\n\t\t\t\t\tuser_id = false;\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t} else {\n\t\t\tuser_id = false;\n\t\t}\n\n\t\t$this.api['get' + $this.api.key_name + 'DefaultData']( user_id, {\n\t\t\tonResult: function( result ) {\n\t\t\t\t$this.onAddResult( result );\n\n\t\t\t}\n\t\t} );\n\t}\n\n\tsetSelectLayout( column_start_from ) {\n\t\tvar $this = this;\n\t\tvar grid;\n\t\tif ( !Global.isSet( this.grid ) ) {\n\t\t\tgrid = $( this.el ).find( '#grid' );\n\n\t\t\tgrid.attr( 'id', this.ui_id + '_grid' ); //Grid's id is ScriptName + _grid\n\n\t\t\tgrid = $( this.el ).find( '#' + this.ui_id + '_grid' );\n\t\t}\n\n\t\tvar column_info_array = [];\n\n\t\tvar column_info;\n\n\t\tif ( !this.select_layout ) { //Set to default layout if no layout at all\n\t\t\tthis.select_layout = { id: '' };\n\t\t\tthis.select_layout.data = { filter_data: {}, filter_sort: {} };\n\t\t\tthis.select_layout.data.display_columns = this.default_display_columns;\n\t\t}\n\t\tvar layout_data = this.select_layout.data;\n\n\t\