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

1 line
98 KiB
JavaScript

"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\tif ( layout_data.display_columns.length < 1 ) {\n\t\t\tlayout_data.display_columns = this.default_display_columns;\n\t\t}\n\n\t\tvar display_columns = this.buildDisplayColumns( layout_data.display_columns );\n\n\t\tif ( !this.sub_view_mode ) {\n\n\t\t\t//Set Display Column in layout panel\n\t\t\tthis.column_selector.setSelectGridData( display_columns );\n\n\t\t\t//Set Sort by awesomebox in layout panel\n\t\t\tthis.sort_by_selector.setSourceData( this.buildSortSelectorUnSelectColumns( display_columns ) );\n\t\t\tthis.sort_by_selector.setValue( this.buildSortBySelectColumns() );\n\n\t\t\t//Set Previoous Saved layout combobox in layout panel\n\t\t\tvar layouts_array = this.search_panel.getLayoutsArray();\n\n\t\t\tthis.setPreviousSavedSearchSourcesAndValue( layouts_array );\n\n\t\t}\n\n\t\t//Set Data Grid on List view\n\t\tvar len = display_columns.length;\n\n\t\tvar start_from = 0;\n\n\t\tif ( Global.isSet( column_start_from ) && column_start_from > 0 ) {\n\t\t\tstart_from = column_start_from;\n\t\t}\n\n\t\tif ( !this.grid ) {\n\t\t\t//\t\tfor ( i = start_from; i < len; i++ ) {\n\t\t\t//\t\t\tvar view_column_data = display_columns[i];\n\t\t\t//\n\t\t\t//\t\t\tvar column_info = {name: view_column_data.value, index: view_column_data.value, label: view_column_data.label, width: 100, sortable: false, title: false};\n\t\t\t//\t\t\tcolumn_info_array.push( column_info );\n\t\t\t//\t\t}\n\n\t\t\tif ( this.parent_view === 'accrual_policy' ) {\n\t\t\t\tcolumn_info = {\n\t\t\t\t\tname: 'full_name',\n\t\t\t\t\tindex: 'full_name',\n\t\t\t\t\tlabel: $.i18n._( 'Employee' ),\n\t\t\t\t\twidth: 50,\n\t\t\t\t\tsortable: false,\n\t\t\t\t\ttitle: false\n\t\t\t\t};\n\t\t\t\tcolumn_info_array.push( column_info );\n\n\t\t\t} else if ( this.parent_view === 'employee' ) {\n\t\t\t\tcolumn_info = {\n\t\t\t\t\tname: 'accrual_policy',\n\t\t\t\t\tindex: 'accrual_policy',\n\t\t\t\t\tlabel: $.i18n._( 'Accrual Policy' ),\n\t\t\t\t\twidth: 50,\n\t\t\t\t\tsortable: false,\n\t\t\t\t\ttitle: false\n\t\t\t\t};\n\t\t\t\tcolumn_info_array.push( column_info );\n\t\t\t}\n\n\t\t\tcolumn_info = {\n\t\t\t\tname: 'length_of_service_date',\n\t\t\t\tindex: 'length_of_service_date',\n\t\t\t\tlabel: $.i18n._( 'Length of Service Date' ),\n\t\t\t\twidth: 80,\n\t\t\t\tsortable: false,\n\t\t\t\ttitle: false\n\t\t\t};\n\t\t\tcolumn_info_array.push( column_info );\n\n\t\t\tcolumn_info = {\n\t\t\t\tname: 'length_of_service_modifier',\n\t\t\t\tindex: 'length_of_service_modifier',\n\t\t\t\tlabel: $.i18n._( 'Length of Service Modifier' ),\n\t\t\t\twidth: 90,\n\t\t\t\tsortable: false,\n\t\t\t\ttitle: false\n\t\t\t};\n\t\t\tcolumn_info_array.push( column_info );\n\n\t\t\tcolumn_info = {\n\t\t\t\tname: 'accrual_rate_modifier',\n\t\t\t\tindex: 'accrual_rate_modifier',\n\t\t\t\tlabel: $.i18n._( 'Accrual Rate Modifier' ),\n\t\t\t\twidth: 80,\n\t\t\t\tsortable: false,\n\t\t\t\ttitle: false\n\t\t\t};\n\t\t\tcolumn_info_array.push( column_info );\n\n\t\t\tcolumn_info = {\n\t\t\t\tname: 'annual_maximum_time_modifier',\n\t\t\t\tindex: 'annual_maximum_time_modifier',\n\t\t\t\tlabel: $.i18n._( 'Annual Accrual Maximum Modifier' ),\n\t\t\t\twidth: 110,\n\t\t\t\tsortable: false,\n\t\t\t\ttitle: false\n\t\t\t};\n\t\t\tcolumn_info_array.push( column_info );\n\n\t\t\tcolumn_info = {\n\t\t\t\tname: 'maximum_time_modifier',\n\t\t\t\tindex: 'maximum_time_modifier',\n\t\t\t\tlabel: $.i18n._( 'Accrual Maximum Balance Modifier' ),\n\t\t\t\twidth: 110,\n\t\t\t\tsortable: false,\n\t\t\t\ttitle: false\n\t\t\t};\n\t\t\tcolumn_info_array.push( column_info );\n\n\t\t\t//\t\tcolumn_info = {name: 'minimum_time_modifier', index: 'minimum_time_modifier', label: 'Accrual Total Minimum Modifier', width:110, sortable: false, title: false};\n\t\t\t//\t\tcolumn_info_array.push( column_info );\n\n\t\t\tcolumn_info = {\n\t\t\t\tname: 'rollover_time_modifier',\n\t\t\t\tindex: 'rollover_time_modifier',\n\t\t\t\tlabel: $.i18n._( 'Annual Maximum Rollover Modifier' ),\n\t\t\t\twidth: 110,\n\t\t\t\tsortable: false,\n\t\t\t\ttitle: false\n\t\t\t};\n\t\t\tcolumn_info_array.push( column_info );\n\n\t\t\tvar container = 'body';\n\n\t\t\tif ( $this.sub_view_mode ) {\n\t\t\t\tif ( $( '#tab_accruals:visible' ).length > 0 ) {\n\t\t\t\t\tcontainer = '#tab_accruals';\n\t\t\t\t} else {\n\t\t\t\t\tcontainer = '#tab_employee_settings';\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tvar grid_setup = this.getGridSetup();\n\t\t\tthis.grid = new TTGrid( this.ui_id + '_grid', grid_setup, column_info_array );\n\t\t}\n\t\t// else {\n\t\t// \tgrid = $( this.el ).find( '#' + this.ui_id + '_grid' );\n\t\t// }\n\n\t\t$this.setGridSize();\n\n\t\t//Add widget on UI and bind events. Next set data in it in search result.\n\t\tif ( LocalCacheData.paging_type === 0 ) {\n\t\t\tif ( this.paging_widget.parent().length > 0 ) {\n\t\t\t\tthis.paging_widget.remove();\n\t\t\t}\n\n\t\t\tthis.paging_widget.css( 'width', this.grid.width() );\n\t\t\tthis.grid.grid.append( this.paging_widget );\n\n\t\t\tthis.paging_widget.click( $.proxy( this.onPaging, this ) );\n\n\t\t} else {\n\t\t\tif ( this.paging_widget.parent().length < 1 ) {\n\t\t\t\t$( this.el ).find( '.total-number-div' ).append( this.paging_widget );\n\t\t\t\t$( this.el ).find( '.bottom-div' ).append( this.paging_widget_2 );\n\n\t\t\t\tthis.paging_widget.bind( 'paging', $.proxy( this.onPaging2, this ) );\n\t\t\t\tthis.paging_widget_2.bind( 'paging', $.proxy( this.onPaging2, this ) );\n\t\t\t}\n\n\t\t}\n\n\t\tthis.bindGridColumnEvents();\n\n\t\tthis.setGridHeaderStyle(); //Set Sort Style\n\n\t\t//replace select layout filter_data to filter set in onNavigation function when goto view from navigation context group\n\t\tif ( LocalCacheData.default_filter_for_next_open_view ) {\n\t\t\tthis.select_layout.data.filter_data = LocalCacheData.default_filter_for_next_open_view.filter_data;\n\t\t\tLocalCacheData.default_filter_for_next_open_view = null;\n\t\t}\n\n\t\tthis.filter_data = this.select_layout.data.filter_data;\n\n\t\tif ( !this.sub_view_mode ) {\n\t\t\tthis.setSearchPanelFilter( true ); //Auto change to property tab when set value to search fields.\n\t\t}\n\n\t\tthis.showGridBorders();\n\t}\n\n\tsetGridSetup() {\n\t\tvar $this = this;\n\t\treturn {\n\t\t\theight: 200,\n\t\t\tonResizeGrid: true,\n\t\t\tsub_grid_mode: this.sub_view_mode,\n\t\t\tcontainer_selector: container,\n\t\t\tonSelectRow: function() {\n\t\t\t\t$this.onGridSelectRow();\n\t\t\t},\n\t\t\tonCellSelect: function() {\n\t\t\t\t$this.onGridSelectRow();\n\t\t\t},\n\t\t\tonSelectAll: function() {\n\t\t\t\t$this.onGridSelectAll();\n\t\t\t},\n\t\t\tondblClickRow: function( e ) {\n\t\t\t\t$this.onGridDblClickRow( e );\n\t\t\t},\n\t\t\tonRightClickRow: function( rowId ) {\n\t\t\t\tvar id_array = $this.getGridSelectIdArray();\n\t\t\t\tif ( id_array.indexOf( rowId ) < 0 ) {\n\t\t\t\t\t$this.grid.grid.resetSelection();\n\t\t\t\t\t$this.grid.grid.setSelection( rowId );\n\t\t\t\t\t$this.onGridSelectRow();\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t}\n\n\tgetFilterColumnsFromDisplayColumns() {\n\t\t// Error: Unable to get property 'getGridParam' of undefined or null reference\n\t\tvar display_columns = [];\n\t\tif ( this.grid ) {\n\t\t\tdisplay_columns = this.grid.grid.getGridParam( 'colModel' );\n\t\t}\n\t\tvar column_filter = {};\n\t\tcolumn_filter.is_owner = true;\n\t\tcolumn_filter.id = true;\n\t\tcolumn_filter.user_id = true;\n\t\tcolumn_filter.accrual_policy_id = true;\n\t\tcolumn_filter.is_child = true;\n\t\tcolumn_filter.in_use = true;\n\t\tcolumn_filter.first_name = true;\n\t\tcolumn_filter.last_name = true;\n\t\tcolumn_filter.type_id = true;\n\n\t\t//Fixed possible exception -- Error: Unable to get property 'length' of undefined or null reference in /interface/html5/views/BaseViewController.js?v=7.4.3-20140924-090129 line 5031\n\t\tif ( display_columns ) {\n\t\t\tvar len = display_columns.length;\n\n\t\t\tfor ( var i = 0; i < len; i++ ) {\n\t\t\t\tvar column_info = display_columns[i];\n\t\t\t\tcolumn_filter[column_info.name] = true;\n\t\t\t}\n\t\t}\n\n\t\treturn column_filter;\n\t}\n\n\tdoEditAPICall( filter, api_args, _callback ) {\n\t\tvar record_id = this.getCurrentSelectedRecord();\n\t\tif ( TTUUID.isUUID( record_id ) && record_id != TTUUID.not_exist_id && record_id != TTUUID.zero_id ) {\n\t\t\treturn super.doEditAPICall( filter, api_args, _callback );\n\t\t} else {\n\t\t\tvar result_data = this.getRecordFromGridById( record_id );\n\n\t\t\tif ( result_data && result_data.id ) {\n\t\t\t\tresult_data.id = '';\n\t\t\t}\n\t\t\treturn this.handleEditAPICallbackResult( result_data );\n\t\t}\n\t}\n\n\tdoViewAPICall( filter, api_args, _callback ) {\n\t\tvar record_id = this.getCurrentSelectedRecord();\n\t\tif ( TTUUID.isUUID( record_id ) && record_id != TTUUID.not_exist_id && record_id != TTUUID.zero_id ) {\n\t\t\treturn super.doViewAPICall( filter, api_args, _callback );\n\t\t} else {\n\t\t\tvar result_data = this.getRecordFromGridById( record_id );\n\n\t\t\tif ( result_data && result_data.id ) {\n\t\t\t\tresult_data.id = '';\n\t\t\t}\n\t\t\treturn this.handleViewAPICallbackResult( result_data );\n\t\t}\n\t}\n\n\tonSaveResult( result ) {\n\t\tvar $this = this;\n\t\tif ( result.isValid() ) {\n\n\t\t\t//Setting is_add false too early can cause determineContextMenuMountAttributes() to have unexpected side effects. However not setting it here might have other side effects.\n\t\t\t//$this.is_add = false;\n\t\t\tvar result_data = result.getResult();\n\n\t\t\tif ( !this.edit_only_mode ) {\n\t\t\t\tif ( result_data === true ) {\n\t\t\t\t\t$this.refresh_id = $this.current_edit_record.id;\n\t\t\t\t} else if ( TTUUID.isUUID( result_data ) && result_data != TTUUID.zero_id && result_data != TTUUID.not_exist_id ) {\n\t\t\t\t\t$this.refresh_id = result_data;\n\t\t\t\t}\n\n\t\t\t\tif ( Global.isSet( $this.refresh_id ) === false ) {\n\t\t\t\t\t$this.result_details = result.getDetails();\n\t\t\t\t}\n\n\t\t\t\t$this.search();\n\t\t\t}\n\n\t\t\t$this.onSaveDone( result );\n\n\t\t\t$this.removeEditView();\n\n\t\t} else {\n\t\t\t$this.setErrorMenu();\n\t\t\t$this.setErrorTips( result );\n\n\t\t}\n\t}\n\n\tsearch( set_default_menu, page_action, page_number, callBack ) {\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\t\tvar filter = {};\n\t\tfilter.filter_data = {};\n\t\tfilter.filter_sort = {};\n\t\tfilter.filter_columns = this.getFilterColumnsFromDisplayColumns();\n\t\tfilter.filter_items_per_page = 0; // Default to 0 to load user preference defined\n\n\t\tif ( this.pager_data ) {\n\n\t\t\tif ( LocalCacheData.paging_type === 0 ) {\n\t\t\t\tif ( page_action === 'next' ) {\n\t\t\t\t\tfilter.filter_page = this.pager_data.next_page;\n\t\t\t\t} else {\n\t\t\t\t\tfilter.filter_page = 1;\n\t\t\t\t}\n\t\t\t} else {\n\n\t\t\t\tswitch ( page_action ) {\n\t\t\t\t\tcase 'next':\n\t\t\t\t\t\tfilter.filter_page = this.pager_data.next_page;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'last':\n\t\t\t\t\t\tfilter.filter_page = this.pager_data.previous_page;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'start':\n\t\t\t\t\t\tfilter.filter_page = 1;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'end':\n\t\t\t\t\t\tfilter.filter_page = this.pager_data.last_page_number;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'go_to':\n\t\t\t\t\t\tfilter.filter_page = page_number;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tfilter.filter_page = this.pager_data.current_page;\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} else {\n\t\t\tfilter.filter_page = 1;\n\t\t}\n\n\t\tif ( this.sub_view_mode && this.parent_key ) {\n\t\t\tthis.select_layout.data.filter_data[this.parent_key] = this.parent_value;\n\t\t}\n\n\t\t//If sub view controller set custom filters, get it\n\t\tif ( Global.isSet( this.getSubViewFilter ) ) {\n\n\t\t\tthis.select_layout.data.filter_data = this.getSubViewFilter( this.select_layout.data.filter_data );\n\n\t\t}\n\n\t\t//select_layout will not be null, it's set in setSelectLayout function\n\t\tfilter.filter_data = Global.convertLayoutFilterToAPIFilter( this.select_layout );\n\t\tfilter.filter_sort = this.select_layout.data.filter_sort;\n\n\t\tif ( TTUUID.isUUID( this.refresh_id ) ) {\n\t\t\tfilter.filter_data = {};\n\t\t\tfilter.filter_data.id = [this.refresh_id];\n\n\t\t\tthis.last_select_ids = filter.filter_data.id;\n\n\t\t} else {\n\n\t\t\tif ( Global.isSet( this.result_details ) && this.result_details.length > 0 ) {\n\t\t\t\tthis.result_details = $.map( this.result_details, function( n ) {\n\t\t\t\t\treturn n === true ? 0 : n;\n\t\t\t\t} );\n\t\t\t\tthis.last_select_ids = Global.concatArraysUniqueWithSort( this.result_details, this.getGridSelectIdArray() );\n\t\t\t} else {\n\t\t\t\tthis.last_select_ids = this.getGridSelectIdArray();\n\t\t\t}\n\n\t\t}\n\n\t\tthis.api['get' + this.api.key_name]( filter, {\n\t\t\tonResult: function( result ) {\n\t\t\t\tvar result_data = result.getResult();\n\t\t\t\tvar len;\n\n\t\t\t\tif ( !Global.isArray( result_data ) ) {\n\t\t\t\t\t$this.showNoResultCover();\n\t\t\t\t} else {\n\t\t\t\t\t$this.removeNoResultCover();\n\t\t\t\t\tif ( Global.isSet( $this.__createRowId ) ) {\n\t\t\t\t\t\tresult_data = $this.__createRowId( result_data );\n\t\t\t\t\t}\n\n\t\t\t\t\tresult_data = Global.formatGridData( result_data, $this.api.key_name );\n\n\t\t\t\t\tlen = result_data.length;\n\t\t\t\t}\n\t\t\t\tif ( TTUUID.isUUID( $this.refresh_id ) ) {\n\t\t\t\t\t$this.refresh_id = null;\n\t\t\t\t\tvar grid_source_data = $this.grid.getData();\n\t\t\t\t\tlen = grid_source_data.length;\n\n\t\t\t\t\tif ( $.type( grid_source_data ) !== 'array' ) {\n\t\t\t\t\t\tgrid_source_data = [];\n\t\t\t\t\t}\n\n\t\t\t\t\tvar found = false;\n\t\t\t\t\tvar new_record = result_data[0];\n\n\t\t\t\t\t//Error: Uncaught TypeError: Cannot read property 'id' of undefined in /interface/html5/views/BaseViewController.js?v=7.4.3-20140924-084605 line 4851\n\t\t\t\t\tif ( new_record ) {\n\t\t\t\t\t\tvar new_grid_source_data = [];\n\n\t\t\t\t\t\tfor ( var i = 0; i < len; i++ ) {\n\t\t\t\t\t\t\tvar record = grid_source_data[i];\n\n\t\t\t\t\t\t\t//Fixed === issue. The id set by jQGrid is string type.\n\t\t\t\t\t\t\t// if ( !isNaN( parseInt( record.id ) ) ) {\n\t\t\t\t\t\t\t// \trecord.id = parseInt( record.id );\n\t\t\t\t\t\t\t// }\n\n\t\t\t\t\t\t\tif ( record.id == new_record.id ) {\n\t\t\t\t\t\t\t\t$this.grid.grid.setRowData( new_record.id, new_record );\n\t\t\t\t\t\t\t\tfound = true;\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif ( record.id < 0 && record.user_id == new_record.user_id ) {\n\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tnew_grid_source_data.push( record );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif ( !found ) {\n\t\t\t\t\t\t\t//Refresh the search because this is a special case where a new record is added, but the UI sees an edit of the existing join row.\n\t\t\t\t\t\t\t// $this.grid.clearGridData();\n\t\t\t\t\t\t\t// $this.grid.setGridParam( {data: new_grid_source_data.concat( new_record )} );\n\t\t\t\t\t\t\t$this.search();\n\n\t\t\t\t\t\t\t// if ( $this.sub_view_mode && Global.isSet( $this.resizeSubGrid ) ) {\n\t\t\t\t\t\t\t// \tlen = Global.isSet( len ) ? len : 0;\n\t\t\t\t\t\t\t// \t$this.resizeSubGrid( len + 1 );\n\t\t\t\t\t\t\t// }\n\n\t\t\t\t\t\t\t//s$this.grid.grid.trigger( 'reloadGrid' );\n\t\t\t\t\t\t\t$this.reSelectLastSelectItems();\n\t\t\t\t\t\t\t$this.highLightGridRowById( new_record.id );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\t\t\t\t\t//Set Page data to widget, next show display info when setDefault Menu\n\t\t\t\t\t$this.pager_data = result.getPagerData();\n\n\t\t\t\t\t//CLick to show more mode no need this step\n\t\t\t\t\tif ( LocalCacheData.paging_type !== 0 ) {\n\t\t\t\t\t\t$this.paging_widget.setPagerData( $this.pager_data );\n\t\t\t\t\t\t$this.paging_widget_2.setPagerData( $this.pager_data );\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( LocalCacheData.paging_type === 0 && page_action === 'next' ) {\n\t\t\t\t\t\tvar current_data = $this.grid.getData();\n\t\t\t\t\t\tresult_data = current_data.concat( result_data );\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( $this.grid ) {\n\t\t\t\t\t\t$this.grid.setData( result_data );\n\n\t\t\t\t\t\t// if ( $this.sub_view_mode && Global.isSet( $this.resizeSubGrid ) ) {\n\t\t\t\t\t\t// \t$this.resizeSubGrid( len );\n\t\t\t\t\t\t// }\n\n\t\t\t\t\t\t$this.reSelectLastSelectItems();\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t$this.result_details = null;\n\n\t\t\t\t$this.setGridCellBackGround(); //Set cell background for some views\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\tif ( LocalCacheData.paging_type === 0 ) {\n\t\t\t\t\tif ( !$this.pager_data || $this.pager_data.is_last_page ) {\n\t\t\t\t\t\t$this.paging_widget.css( 'display', 'none' );\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$this.paging_widget.css( 'display', 'block' );\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif ( callBack ) {\n\t\t\t\t\tcallBack( result );\n\t\t\t\t}\n\n\t\t\t\t// when call this from save and new result, we don't call auto open, because this will call onAddClick twice\n\t\t\t\tif ( set_default_menu ) {\n\t\t\t\t\t$this.autoOpenEditViewIfNecessary();\n\t\t\t\t}\n\n\t\t\t\t$this.searchDone();\n\n\t\t\t}\n\t\t} );\n\t}\n\n\tbuildEditViewUI() {\n\n\t\tsuper.buildEditViewUI();\n\n\t\tvar $this = this;\n\n\t\tvar tab_model = {\n\t\t\t'tab_employee_accrual_modifier': { 'label': this.parent_view === 'employee' ? $.i18n._( 'Accrual' ) : $.i18n._( 'Employee Accrual Modifier' ) },\n\t\t\t'tab_audit': true,\n\t\t};\n\t\tthis.setTabModel( tab_model );\n\n\t\tthis.navigation.AComboBox( {\n\t\t\tapi_class: TTAPI.APIAccrualPolicyUserModifier,\n\t\t\tid: this.script_name + '_navigation',\n\t\t\tallow_multiple_selection: false,\n\t\t\tlayout_name: 'global_wage',\n\t\t\tshow_search_inputs: true,\n\t\t\tnavigation_mode: true\n\t\t} );\n\n\t\tthis.setNavigation();\n\n\t\t//Tab 0 start\n\n\t\tvar tab_employee_accrual_modifier = this.edit_view_tab.find( '#tab_employee_accrual_modifier' );\n\n\t\tvar tab_employee_accrual_modifier_column1 = tab_employee_accrual_modifier.find( '.first-column' );\n\n\t\tthis.edit_view_tabs[0] = [];\n\n\t\tthis.edit_view_tabs[0].push( tab_employee_accrual_modifier_column1 );\n\n\t\tvar form_item_input;\n\n\t\t//Employee\n\n\t\tform_item_input = Global.loadWidgetByName( FormItemType.AWESOME_BOX );\n\t\tform_item_input.AComboBox( {\n\t\t\tapi_class: TTAPI.APIUser,\n\t\t\tallow_multiple_selection: false,\n\t\t\tlayout_name: 'global_user',\n\t\t\tshow_search_inputs: true,\n\t\t\tset_empty: true,\n\t\t\tfield: 'user_id'\n\n\t\t} );\n\n\t\tthis.addEditFieldToColumn( $.i18n._( 'Employee' ), form_item_input, tab_employee_accrual_modifier_column1, '', null, true );\n\n\t\t// Accrual Policy\n\n\t\tvar default_args = {};\n\t\tdefault_args.filter_data = {};\n\t\tdefault_args.filter_data.type_id = [20, 30];\n\n\t\tform_item_input = Global.loadWidgetByName( FormItemType.AWESOME_BOX );\n\t\tform_item_input.AComboBox( {\n\t\t\tapi_class: TTAPI.APIAccrualPolicy,\n\t\t\tallow_multiple_selection: false,\n\t\t\tlayout_name: 'global_accrual',\n\t\t\tshow_search_inputs: true,\n\t\t\tset_empty: true,\n\t\t\tfield: 'accrual_policy_id'\n\n\t\t} );\n\t\tform_item_input.setDefaultArgs( default_args );\n\n\t\tthis.addEditFieldToColumn( $.i18n._( 'Accrual Policy' ), form_item_input, tab_employee_accrual_modifier_column1, '' );\n\n\t\t// Length of Service Date\n\n\t\tform_item_input = Global.loadWidgetByName( FormItemType.DATE_PICKER );\n\n\t\tform_item_input.TDatePicker( { field: 'length_of_service_date', width: 120 } );\n\n\t\tthis.addEditFieldToColumn( $.i18n._( 'Length of Service Date' ), form_item_input, tab_employee_accrual_modifier_column1, '', null );\n\n\t\t//Modifier Rates\n\t\tform_item_input = Global.loadWidgetByName( FormItemType.SEPARATED_BOX );\n\t\tform_item_input.SeparatedBox( { label: $.i18n._( 'Modifier Rates' ) } );\n\t\tthis.addEditFieldToColumn( null, form_item_input, tab_employee_accrual_modifier_column1, '', null, true, false, 'separated_1' );\n\n\t\t// Length of Service Modifier\n\t\tform_item_input = Global.loadWidgetByName( FormItemType.TEXT_INPUT );\n\t\tform_item_input.TTextInput( { field: 'length_of_service_modifier', width: 40 } );\n\n\t\tthis.addEditFieldToColumn( $.i18n._( 'Length of Service' ), form_item_input, tab_employee_accrual_modifier_column1 );\n\n\t\t// Accrual Rate Modifier\n\t\tform_item_input = Global.loadWidgetByName( FormItemType.TEXT_INPUT );\n\t\tform_item_input.TTextInput( { field: 'accrual_rate_modifier', width: 40 } );\n\n\t\tthis.addEditFieldToColumn( $.i18n._( 'Accrual Rate' ), form_item_input, tab_employee_accrual_modifier_column1 );\n\n\t\t//Annual Accrual Maximum\n\t\tform_item_input = Global.loadWidgetByName( FormItemType.TEXT_INPUT );\n\t\tform_item_input.TTextInput( { field: 'annual_maximum_time_modifier', width: 40 } );\n\n\t\tthis.addEditFieldToColumn( $.i18n._( 'Annual Accrual Maximum' ), form_item_input, tab_employee_accrual_modifier_column1, '', null, true );\n\n\t\t// \"Accrual Maximum Balance Modifier\n\t\tform_item_input = Global.loadWidgetByName( FormItemType.TEXT_INPUT );\n\t\tform_item_input.TTextInput( { field: 'maximum_time_modifier', width: 40 } );\n\n\t\tthis.addEditFieldToColumn( $.i18n._( 'Accrual Maximum Balance' ), form_item_input, tab_employee_accrual_modifier_column1 );\n\n\t\t//Annual Maximum Rollover Modifier\n\t\tform_item_input = Global.loadWidgetByName( FormItemType.TEXT_INPUT );\n\t\tform_item_input.TTextInput( { field: 'rollover_time_modifier', width: 40 } );\n\n\t\tthis.addEditFieldToColumn( $.i18n._( 'Annual Maximum Rollover' ), form_item_input, tab_employee_accrual_modifier_column1 );\n\n\t\t//Modifier Rates\n\t\tform_item_input = Global.loadWidgetByName( FormItemType.SEPARATED_BOX );\n\t\tform_item_input.SeparatedBox( { label: $.i18n._( 'Current Milestone' ) + ': ' } );\n\t\tthis.addEditFieldToColumn( null, form_item_input, tab_employee_accrual_modifier_column1, '', null, true, false, 'separated_2' );\n\n\t\t// Accrual Rate\n\t\tform_item_input = Global.loadWidgetByName( FormItemType.TEXT );\n\t\tform_item_input.TText( { field: 'accrual_rate' } );\n\t\tthis.addEditFieldToColumn( $.i18n._( 'Accrual Rate' ), form_item_input, tab_employee_accrual_modifier_column1, '', null, true );\n\n\t\t// \"Accrual Maximum Balance Time\n\t\tform_item_input = Global.loadWidgetByName( FormItemType.TEXT );\n\t\tform_item_input.TText( { field: 'maximum_time' } );\n\t\tthis.addEditFieldToColumn( $.i18n._( 'Accrual Maximum Balance Time' ), form_item_input, tab_employee_accrual_modifier_column1, '', null, true );\n\n\t\t// Accrual Maximum Rollover\n\t\tform_item_input = Global.loadWidgetByName( FormItemType.TEXT );\n\t\tform_item_input.TText( { field: 'rollover_time' } );\n\t\tthis.addEditFieldToColumn( $.i18n._( 'Accrual Maximum Rollover' ), form_item_input, tab_employee_accrual_modifier_column1, '', null, true );\n\t}\n\n\tsetCurrentEditRecordData() {\n\t\t//Set current edit record data to all widgets\n\t\tfor ( var key in this.current_edit_record ) {\n\n\t\t\tif ( !this.current_edit_record.hasOwnProperty( key ) ) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tvar widget = this.edit_view_ui_dic[key];\n\t\t\tif ( Global.isSet( widget ) ) {\n\t\t\t\tswitch ( key ) {\n\t\t\t\t\tdefault:\n\t\t\t\t\t\twidget.setValue( this.current_edit_record[key] );\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t}\n\t\t}\n\n\t\tif ( this.current_edit_record.type_id == 30 ) {\n\t\t\tthis.attachElement( 'annual_maximum_time_modifier' );\n\t\t} else {\n\t\t\tthis.detachElement( 'annual_maximum_time_modifier' );\n\t\t}\n\n\t\tthis.setAccrualPolicyDataFromUserModifier();\n\t\tthis.getAccrualPolicyDataFromUserModifier();\n\t\tthis.collectUIDataToCurrentEditRecord();\n\t\tthis.setEditViewDataDone();\n\t}\n\n\tonFormItemChange( target, doNotValidate ) {\n\t\tvar $this = this;\n\t\tthis.setIsChanged( target );\n\t\tthis.setMassEditingFieldsWhenFormChange( target );\n\t\tvar key = target.getField();\n\t\tvar c_value = target.getValue();\n\t\tswitch ( key ) {\n\t\t\tcase 'user_id':\n\t\t\t\tif ( this.is_add ) {\n\t\t\t\t\tthis.api['get' + this.api.key_name + 'DefaultData']( c_value, {\n\t\t\t\t\t\tonResult: function( result ) {\n\t\t\t\t\t\t\tvar result_data = result.getResult();\n\n\t\t\t\t\t\t\tif ( !result_data ) {\n\t\t\t\t\t\t\t\tresult_data = [];\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif ( $this.sub_view_mode && $this.parent_key === 'accrual_policy_id' ) {\n\t\t\t\t\t\t\t\tresult_data[$this.parent_key] = $this.parent_value;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t$this.current_edit_record = result_data;\n\t\t\t\t\t\t\t$this.setCurrentEditRecordData();\n\t\t\t\t\t\t\t$this.validate();\n\n\t\t\t\t\t\t}\n\t\t\t\t\t} );\n\t\t\t\t} else {\n\t\t\t\t\tthis.current_edit_record[key] = c_value;\n\t\t\t\t\tthis.validate();\n\t\t\t\t\tthis.getAccrualPolicyDataFromUserModifier();\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tdefault :\n\t\t\t\tthis.current_edit_record[key] = c_value;\n\t\t\t\tthis.validate();\n\t\t\t\tthis.getAccrualPolicyDataFromUserModifier();\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\tgetAccrualPolicyDataFromUserModifier() {\n\t\tvar $this = this;\n\n\t\tvar record = {};\n\n\t\tif ( this.is_mass_editing ) {\n\t\t\tfor ( var key in this.edit_view_ui_dic ) {\n\n\t\t\t\tif ( !this.edit_view_ui_dic.hasOwnProperty( key ) ) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tvar widget = this.edit_view_ui_dic[key];\n\n\t\t\t\tif ( Global.isSet( widget.isChecked ) ) {\n\t\t\t\t\tif ( widget.isChecked() && widget.getEnabled() ) {\n\t\t\t\t\t\trecord[key] = widget.getValue();\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t}\n\n\t\t} else {\n\t\t\trecord = this.current_edit_record;\n\t\t}\n\n\t\trecord = this.uniformVariable( record );\n\t\tthis.api['getAccrualPolicyDataFromUserModifier']( record, {\n\t\t\tonResult: function( result ) {\n\t\t\t\tvar result_data = result.getResult();\n\t\t\t\t$this.setAccrualPolicyDataFromUserModifier( result_data );\n\t\t\t}\n\t\t} );\n\t}\n\n\tsetAccrualPolicyDataFromUserModifier( result_data ) {\n\t\tvar $this = this;\n\t\tif ( Global.isSet( result_data ) && !Global.isFalseOrNull( result_data ) ) {\n\n\t\t\tvar accrual_rate = 0;\n\t\t\tif ( result_data && result_data.accrual_policy_type_id && result_data.accrual_policy_type_id == 20 ) { //Calendar\n\t\t\t\taccrual_rate = Global.getTimeUnit( result_data.accrual_rate )\n\t\t\t} else { //Hourly\n\t\t\t\taccrual_rate = result_data.accrual_rate;\n\t\t\t}\n\n\t\t\tif ( !$this.edit_view_form_item_dic['separated_2'] ) {\n\t\t\t\t//Can trigger an error if this runs after the view has closed.\n\t\t\t\t//Uncaught TypeError: Cannot read properties of undefined (reading 'find')\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t$this.edit_view_form_item_dic['separated_2'].find( '.label' ).text( $.i18n._( 'Current Milestone' ) + ': ' + result_data.milestone_number );\n\t\t\t$this.edit_view_ui_dic['accrual_rate'].setValue( accrual_rate );\n\t\t\t$this.edit_view_ui_dic['maximum_time'].setValue( Global.getTimeUnit( result_data.maximum_time ) );\n\t\t\t$this.edit_view_ui_dic['rollover_time'].setValue( Global.getTimeUnit( result_data.rollover_time ) );\n\n\t\t\t$this.attachElement( 'separated_2' );\n\t\t\t$this.attachElement( 'accrual_rate' );\n\t\t\t$this.attachElement( 'maximum_time' );\n\t\t\t$this.attachElement( 'rollover_time' );\n\n\t\t} else {\n\n\t\t\tif ( !$this.is_edit ) {\n\n\t\t\t\t$this.detachElement( 'separated_2' );\n\t\t\t\t$this.detachElement( 'accrual_rate' );\n\t\t\t\t$this.detachElement( 'maximum_time' );\n\t\t\t\t$this.detachElement( 'rollover_time' );\n\t\t\t}\n\n\t\t}\n\t}\n\n\tremoveEditView() {\n\t\tsuper.removeEditView();\n\n\t\tif ( this.parent_view === 'accrual_policy' ) {\n\n\t\t\tthis.context_menu_name = $.i18n._( 'Employee Settings' );\n\t\t\t$( '.ribbonTabLabel' ).find( 'a[ref=' + this.viewId + 'ContextMenu' + ']' ).text( $.i18n._( 'Employee Settings' ) );\n\t\t}\n\t}\n\n\tgetAPIFilters() {\n\t\tvar filter = super.getAPIFilters();\n\n\t\tif ( this.sub_view_mode && this.parent_key ) {\n\t\t\tfilter.filter_data[this.parent_key] = this.parent_value;\n\t\t}\n\n\t\treturn filter;\n\t}\n\n\tonMassEditClick() {\n\n\t\tvar $this = this;\n\t\t$this.is_add = false;\n\t\t$this.is_viewing = false;\n\t\t$this.is_mass_editing = true;\n\t\tLocalCacheData.current_doing_context_action = 'mass_edit';\n\t\t$this.openEditView();\n\t\tvar filter = {};\n\t\tvar grid_selected_id_array = this.getGridSelectIdArray();\n\t\tvar grid_selected_length = grid_selected_id_array.length;\n\t\tthis.mass_edit_record_ids = [];\n\n\t\t$.each( grid_selected_id_array, function( index, value ) {\n\t\t\t$this.mass_edit_record_ids.push( value );\n\t\t} );\n\n\t\tfilter.filter_data = {};\n\t\tfilter.filter_data.id = this.mass_edit_record_ids;\n\n\t\tif ( this.sub_view_mode && this.parent_key ) {\n\t\t\tfilter.filter_data[this.parent_key] = this.parent_value;\n\t\t}\n\n\t\tthis.api['getCommon' + this.api.key_name + 'Data']( filter, {\n\t\t\tonResult: function( result ) {\n\t\t\t\tvar result_data = result.getResult();\n\n\t\t\t\tif ( !result_data ) {\n\t\t\t\t\tresult_data = [];\n\t\t\t\t}\n\n\t\t\t\t$this.api['getOptions']( 'unique_columns', {\n\t\t\t\t\tonResult: function( result ) {\n\t\t\t\t\t\t$this.unique_columns = result.getResult();\n\t\t\t\t\t\t$this.api['getOptions']( 'linked_columns', {\n\t\t\t\t\t\t\tonResult: function( result1 ) {\n\t\t\t\t\t\t\t\t$this.linked_columns = result1.getResult();\n\t\t\t\t\t\t\t\tif ( $this.sub_view_mode && $this.parent_key ) {\n\t\t\t\t\t\t\t\t\tresult_data[$this.parent_key] = $this.parent_value;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t$this.current_edit_record = result_data;\n\t\t\t\t\t\t\t\t$this.initEditView();\n\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} );\n\n\t\t\t\t\t}\n\t\t\t\t} );\n\n\t\t\t}\n\t\t} );\n\t}\n\n\tvalidate() {\n\t\tvar $this = this;\n\n\t\tvar record;\n\n\t\tif ( this.is_mass_editing ) {\n\n\t\t\trecord = [];\n\n\t\t\t$.each( this.mass_edit_record_ids, function( index, value ) {\n\n\t\t\t\tvar check_fields = {};\n\t\t\t\tif ( value < 0 ) {\n\t\t\t\t\tcheck_fields = $this.getRecordFromGridById( value );\n\t\t\t\t} else {\n\t\t\t\t\tcheck_fields.id = value;\n\t\t\t\t}\n\n\t\t\t\tfor ( var key in $this.edit_view_ui_dic ) {\n\n\t\t\t\t\tif ( !$this.edit_view_ui_dic.hasOwnProperty( key ) ) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\n\t\t\t\t\tvar widget = $this.edit_view_ui_dic[key];\n\n\t\t\t\t\tif ( Global.isSet( widget.isChecked ) ) {\n\t\t\t\t\t\tif ( widget.isChecked() && widget.getEnabled() ) {\n\t\t\t\t\t\t\tswitch ( key ) {\n\t\t\t\t\t\t\t\tcase 'user_id':\n//\t\t\t\t\t\t\t\t\tif ( value > 0 ) {\n//\t\t\t\t\t\t\t\t\t\tcheck_fields[key] = $this.current_edit_record[key];\n//\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\tcheck_fields[key] = widget.getValue();\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tvar common_record = Global.clone( check_fields );\n\t\t\t\tcommon_record = $this.uniformVariable( common_record );\n\t\t\t\trecord.push( common_record );\n\n\t\t\t} );\n\n//\t\t\tfor ( var key in this.edit_view_ui_dic ) {\n//\n//\t\t\t\tif ( !this.edit_view_ui_dic.hasOwnProperty( key ) ) {\n//\t\t\t\t\tcontinue;\n//\t\t\t\t}\n//\n//\t\t\t\tvar widget = this.edit_view_ui_dic[key];\n//\n//\t\t\t\tif ( Global.isSet( widget.isChecked ) ) {\n//\t\t\t\t\tif ( widget.isChecked() && widget.getEnabled() ) {\n//\t\t\t\t\t\trecord[key] = widget.getValue();\n//\t\t\t\t\t}\n//\n//\t\t\t\t}\n//\t\t\t}\n\n\t\t} else {\n\t\t\trecord = this.current_edit_record;\n\t\t}\n\n\t\trecord = this.uniformVariable( record );\n\n\t\tthis.api['validate' + this.api.key_name]( record, {\n\t\t\tonResult: function( result ) {\n\t\t\t\t$this.validateResult( result );\n\n\t\t\t}\n\t\t} );\n\t}\n\n\tonSaveClick( ignoreWarning ) {\n\t\tvar $this = this;\n\t\tvar record;\n\t\tif ( !Global.isSet( ignoreWarning ) ) {\n\t\t\tignoreWarning = false;\n\t\t}\n\t\tLocalCacheData.current_doing_context_action = 'save';\n\t\tif ( this.is_mass_editing ) {\n\n\t\t\trecord = [];\n\n\t\t\t$.each( this.mass_edit_record_ids, function( index, value ) {\n\n\t\t\t\tvar check_fields = {};\n\t\t\t\tif ( value < 0 ) {\n\t\t\t\t\tcheck_fields = $this.getRecordFromGridById( value );\n\t\t\t\t} else {\n\t\t\t\t\tcheck_fields.id = value;\n\t\t\t\t}\n\n\t\t\t\tfor ( var key in $this.edit_view_ui_dic ) {\n\t\t\t\t\tvar widget = $this.edit_view_ui_dic[key];\n\n\t\t\t\t\tif ( Global.isSet( widget.isChecked ) ) {\n\t\t\t\t\t\tif ( widget.isChecked() ) {\n\t\t\t\t\t\t\tswitch ( key ) {\n\t\t\t\t\t\t\t\tcase 'user_id':\n//\t\t\t\t\t\t\t\t\tif ( value > 0 ) {\n//\t\t\t\t\t\t\t\t\t\tcheck_fields[key] = $this.current_edit_record[key];\n//\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\tcheck_fields[key] = $this.current_edit_record[key];\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tvar common_record = Global.clone( check_fields );\n\t\t\t\tcommon_record = $this.uniformVariable( common_record );\n\t\t\t\trecord.push( common_record );\n\n\t\t\t} );\n\n\t\t} else {\n\t\t\trecord = this.current_edit_record;\n\t\t\trecord = this.uniformVariable( record );\n\t\t}\n\n\t\tthis.api['set' + this.api.key_name]( record, false, ignoreWarning, {\n\t\t\tonResult: function( result ) {\n\n\t\t\t\t$this.onSaveResult( result );\n\n\t\t\t}\n\t\t} );\n\t}\n\n\tsetDefaultMenuDeleteIcon( context_btn, grid_selected_length, pId ) {\n\t\tif ( ( !this.addPermissionValidate( pId ) && !this.editPermissionValidate( pId ) ) || this.edit_only_mode ) {\n\t\t\tContextMenuManager.hideMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, false )\n\t\t}\n\n\t\tvar grid_selected_id_array = this.getGridSelectIdArray();\n\t\tvar enabled = false;\n\n\t\tfor ( var i in grid_selected_id_array ) {\n\t\t\tif ( TTUUID.isUUID( grid_selected_id_array[i] ) ) {\n\t\t\t\tenabled = true;\n\t\t\t}\n\t\t}\n\n\t\tif ( !enabled ) {\n\t\t\tContextMenuManager.disableMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, false );\n\t\t}\n\t}\n\n\tsearchDone() {\n\t\tsuper.searchDone();\n\t\tTTPromise.resolve( 'AccrualView', 'init' );\n\t}\n\n\tsetEditViewWidgetsMode() {\n\t\tvar did_clean_dic = {};\n\t\tfor ( var key in this.edit_view_ui_dic ) {\n\t\t\tif ( !this.edit_view_ui_dic.hasOwnProperty( key ) ) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tvar widget = this.edit_view_ui_dic[key];\n\t\t\twidget.css( 'opacity', 1 );\n\t\t\tvar column = widget.parent().parent().parent();\n\t\t\tvar tab_id = column.parent().attr( 'id' );\n\t\t\tif ( !column.hasClass( 'v-box' ) ) {\n\t\t\t\tif ( !did_clean_dic[tab_id] ) {\n\t\t\t\t\tdid_clean_dic[tab_id] = true;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( this.is_viewing || ( this.parent_view === 'employee' && ( key === 'accrual_policy_id' || key === 'user_id' ) ) ) {\n\t\t\t\tif ( Global.isSet( widget.setEnabled ) ) {\n\t\t\t\t\twidget.setEnabled( false );\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif ( Global.isSet( widget.setEnabled ) ) {\n\t\t\t\t\twidget.setEnabled( true );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n}\n\nAccrualPolicyUserModifierViewController.loadSubView = function( container, beforeViewLoadedFun, afterViewLoadedFun ) {\n\n\tGlobal.loadViewSource( 'AccrualPolicyUserModifier', 'SubAccrualPolicyUserModifierView.html', function( result ) {\n\t\tvar args = {};\n\t\tif ( Global.isSet( beforeViewLoadedFun ) ) {\n\t\t\tvar template_data = beforeViewLoadedFun( result );\n\t\t\tvar template = template_data.template;\n\t\t\targs = template_data.args;\n\t\t}\n\n\t\tif ( Global.isSet( container ) ) {\n\t\t\tcontainer.html( template( args ) );\n\n\t\t\tif ( Global.isSet( afterViewLoadedFun ) ) {\n\t\t\t\tafterViewLoadedFun( sub_accrual_policy_user_modifier_view_controller );\n\t\t\t}\n\n\t\t}\n\n\t} );\n\n};//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNzM2OS5qcyIsIm1hcHBpbmdzIjoiOzs7Ozs7QUFBTztBQUNQLDJCQUEyQjtBQUMzQixFQUFFLENBQUM7QUFDSDs7QUFFQTs7QUFFQTs7QUFFQTtBQUNBLElBQUk7O0FBRUo7QUFDQTs7QUFFQTtBQUNBLHdHQUF3RztBQUN4RztBQUNBO0FBQ0EsNEJBQTRCLENBQUM7QUFDN0IsMkJBQTJCLENBQUM7QUFDNUIsSUFBSTtBQUNKLDRCQUE0QixDQUFDO0FBQzdCLDJCQUEyQixDQUFDO0FBQzVCO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBLElBQUk7QUFDSjtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7O0FBRUE7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQ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