TimeTrex/interface/html5/dist/attendance-accrual-AccrualViewController.bundle.js

1 line
72 KiB
JavaScript

"use strict";(self.webpackChunktimetrex=self.webpackChunktimetrex||[]).push([["attendance-accrual-AccrualViewController"],{1629:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"AccrualViewController\": () => (/* binding */ AccrualViewController)\n/* harmony export */ });\n/* provided dependency */ var _ = __webpack_require__(9050);\n/* provided dependency */ var $ = __webpack_require__(9755);\nclass AccrualViewController extends BaseViewController {\n\tconstructor( options = {} ) {\n\t\t_.defaults( options, {\n\t\t\tel: '#accrual_view_container',\n\t\t\ttype_array: null,\n\n\t\t\tuser_group_api: null,\n\t\t\tuser_group_array: null,\n\t\t\tuser_type_array: null,\n\t\t\tsystem_type_array: null,\n\t\t\tdelete_type_array: null,\n\t\t\tdate_api: null,\n\n\t\t\tedit_enabled: false,\n\t\t\tdelete_enabled: false,\n\n\t\t\tis_trigger_add: false,\n\n\t\t\tsub_view_grid_data: null,\n\n\t\t\thide_search_field: false,\n\n\t\t\tapi_accrual_balance: null,\n\n//\t parent_filter: null,\n\n\t\t} );\n\n\t\tsuper( options );\n\t}\n\n\tinit( options ) {\n\t\t//this._super('initialize', options );\n\t\tthis.edit_view_tpl = 'AccrualEditView.html';\n\t\tthis.permission_id = 'accrual';\n\t\tthis.viewId = 'Accrual';\n\t\tthis.script_name = 'AccrualView';\n\t\tthis.table_name_key = 'accrual';\n\t\tthis.context_menu_name = $.i18n._( 'Accruals' );\n\t\tthis.navigation_label = $.i18n._( 'Accrual' );\n\n\t\tthis.api = TTAPI.APIAccrual;\n\t\tthis.api_accrual_balance = TTAPI.APIAccrualBalance;\n\n\t\tthis.initPermission();\n\t\tthis.render();\n\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\tTTPromise.resolve( 'AccrualViewController', 'init' );\n\t}\n\n\tinitPermission() {\n\n\t\tsuper.initPermission();\n\n\t\tif ( PermissionManager.validate( this.permission_id, 'view' ) || PermissionManager.validate( this.permission_id, 'view_child' ) ) {\n\t\t\tthis.hide_search_field = false;\n\t\t} else {\n\t\t\tthis.hide_search_field = true;\n\t\t}\n\t}\n\n\tinitOptions() {\n\t\tvar $this = this;\n\n\t\tthis.initDropDownOption( 'user_type', null, null, function( res ) {\n\t\t\tvar result = res.getResult();\n\t\t\t$this.user_type_array = result;\n\n\t\t} );\n\t\tthis.initDropDownOption( 'delete_type', null, null, function( res ) {\n\t\t\tvar result = res.getResult();\n\t\t\t$this.delete_type_array = result;\n\n\t\t} );\n\n\t\tthis.initDropDownOption( 'type', null, null, function( res ) {\n\t\t\tvar result = res.getResult();\n\t\t\t$this.system_type_array = result;\n\t\t\tif ( !$this.sub_view_mode && $this.basic_search_field_ui_dic['type_id'] ) {\n\t\t\t\t$this.basic_search_field_ui_dic['type_id'].setSourceData( Global.buildRecordArray( result ) );\n\t\t\t}\n\t\t} );\n\n\t\tTTAPI.APIUserGroup.getUserGroup( '', false, false, {\n\t\t\tonResult: function( res ) {\n\n\t\t\t\tres = res.getResult();\n\t\t\t\tres = Global.buildTreeRecord( res );\n\n\t\t\t\tif ( !$this.sub_view_mode && $this.basic_search_field_ui_dic['group_id'] ) {\n\t\t\t\t\t$this.basic_search_field_ui_dic['group_id'].setSourceData( res );\n\t\t\t\t}\n\n\t\t\t\t$this.user_group_array = res;\n\n\t\t\t}\n\t\t} );\n\t}\n\n\tbuildEditViewUI() {\n\t\tsuper.buildEditViewUI();\n\n\t\tvar $this = this;\n\n\t\tvar tab_model = {\n\t\t\t'tab_accrual': { 'label': $.i18n._( 'Accrual' ) },\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.APIAccrual,\n\t\t\tid: this.script_name + '_navigation',\n\t\t\tallow_multiple_selection: false,\n\t\t\tlayout_name: 'global_accrual_accrual',\n\t\t\tnavigation_mode: true,\n\t\t\tshow_search_inputs: true\n\t\t} );\n\n\t\tthis.setNavigation();\n\n\t\t//Tab 0 start\n\n\t\tvar tab_accrual = this.edit_view_tab.find( '#tab_accrual' );\n\n\t\tvar tab_accrual_column1 = tab_accrual.find( '.first-column' );\n\n\t\tthis.edit_view_tabs[0] = [];\n\n\t\tthis.edit_view_tabs[0].push( tab_accrual_column1 );\n\n\t\tvar form_item_input;\n\t\tvar widgetContainer;\n\t\tvar label;\n\n\t\t// Employee\n\n\t\tif ( this.sub_view_mode && ( this.parent_edit_record === undefined || _.isEmpty( this.parent_edit_record ) === false ) ) {\n\t\t\tform_item_input = Global.loadWidgetByName( FormItemType.TEXT );\n\t\t\tform_item_input.TText( { field: 'full_name' } );\n\t\t\tthis.addEditFieldToColumn( $.i18n._( 'Employee' ), form_item_input, tab_accrual_column1, '' );\n\t\t} else {\n\t\t\tform_item_input = Global.loadWidgetByName( FormItemType.AWESOME_BOX );\n\t\t\tform_item_input.AComboBox( {\n\t\t\t\tapi_class: TTAPI.APIUser,\n\t\t\t\tallow_multiple_selection: true,\n\t\t\t\tlayout_name: 'global_user',\n\t\t\t\tshow_search_inputs: true,\n\t\t\t\tset_empty: true,\n\t\t\t\tfield: 'user_id'\n\t\t\t} );\n\n\t\t\tvar default_args = {};\n\t\t\tdefault_args.permission_section = 'accrual';\n\t\t\tform_item_input.setDefaultArgs( default_args );\n\t\t\tthis.addEditFieldToColumn( $.i18n._( 'Employee' ), form_item_input, tab_accrual_column1, '' );\n\t\t}\n\n\t\t// Accrual Policy Account\n\n\t\tif ( this.sub_view_mode && ( this.parent_edit_record === undefined || _.isEmpty( this.parent_edit_record ) === false ) ) {\n\t\t\tform_item_input = Global.loadWidgetByName( FormItemType.TEXT );\n\t\t\tform_item_input.TText( { field: 'accrual_policy_account' } );\n\t\t\tthis.addEditFieldToColumn( $.i18n._( 'Accrual Account' ), form_item_input, tab_accrual_column1 );\n\t\t} else {\n\t\t\tform_item_input = Global.loadWidgetByName( FormItemType.AWESOME_BOX );\n\t\t\tform_item_input.AComboBox( {\n\t\t\t\tapi_class: TTAPI.APIAccrualPolicyAccount,\n\t\t\t\tallow_multiple_selection: false,\n\t\t\t\tlayout_name: 'global_accrual_policy_account',\n\t\t\t\tshow_search_inputs: true,\n\t\t\t\tset_empty: true,\n\t\t\t\tfield: 'accrual_policy_account_id'\n\t\t\t} );\n\t\t\tthis.addEditFieldToColumn( $.i18n._( 'Accrual Account' ), form_item_input, tab_accrual_column1 );\n\n\t\t}\n\n\t\t//Type\n\t\tform_item_input = Global.loadWidgetByName( FormItemType.COMBO_BOX );\n\n\t\tform_item_input.TComboBox( { field: 'type_id' } );\n\t\tform_item_input.setSourceData( $this.user_type_array );\n\t\tthis.addEditFieldToColumn( $.i18n._( 'Type' ), form_item_input, tab_accrual_column1 );\n\n\t\t// Amount\n\t\tform_item_input = Global.loadWidgetByName( FormItemType.TEXT_INPUT );\n\t\tform_item_input.TTextInput( { field: 'amount', width: 120, mode: 'time_unit' } );\n\n\t\tvar widgetContainer = $( '<div class=\\'widget-h-box\\'></div>' );\n\t\tvar release_balance_button = $( '<input id=\\'release-balance-button\\' class=\\'t-button\\' style=\\'margin-left: 5px\\' type=\\'button\\' value=\\'' + $.i18n._( 'Available Balance' ) + '\\'>' );\n\t\trelease_balance_button.click( function() {\n\t\t\t$this.getAvailableBalance();\n\t\t} );\n\t\tif ( this.is_viewing ) {\n\t\t\trelease_balance_button.css( 'display', 'none' );\n\t\t}\n\n\t\twidgetContainer.append( form_item_input );\n\t\twidgetContainer.append( release_balance_button );\n\n\t\tthis.addEditFieldToColumn( $.i18n._( 'Amount' ), form_item_input, tab_accrual_column1, '', widgetContainer );\n\n\t\t// Date\n\t\tform_item_input = Global.loadWidgetByName( FormItemType.DATE_PICKER );\n\n\t\tform_item_input.TDatePicker( { field: 'time_stamp' } );\n\t\tthis.addEditFieldToColumn( $.i18n._( 'Date' ), form_item_input, tab_accrual_column1, '', null );\n\n\t\t//Note\n\t\tform_item_input = Global.loadWidgetByName( FormItemType.TEXT_AREA );\n\t\tform_item_input.TTextArea( {\n\t\t\tfield: 'note'\n\t\t} );\n\t\tthis.addEditFieldToColumn( $.i18n._( 'Note' ), form_item_input, tab_accrual_column1, '', null, null, true );\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\t// Error: TypeError: this.current_edit_record is null in interface/html5/framework/jquery.min.js?v=9.0.5-20151222-094938 line 2 > eval line 1409\n\t\tif ( !this.current_edit_record ) {\n\t\t\treturn;\n\t\t}\n\t\tthis.current_edit_record[key] = c_value;\n\t\tswitch ( key ) {\n\t\t\tcase 'amount':\n\t\t\t\tthis.current_edit_record[key] = Global.parseTimeUnit( c_value );\n\t\t\t\tbreak;\n\t\t}\n\n\t\tif ( !doNotValidate ) {\n\t\t\tthis.validate();\n\t\t}\n\t}\n\n\tbuildSearchFields() {\n\t\tsuper.buildSearchFields();\n\n\t\tvar default_args = {};\n\t\tdefault_args.permission_section = 'accrual';\n\n\t\tthis.search_fields = [\n\n\t\t\tnew SearchField( {\n\t\t\t\tlabel: $.i18n._( 'Employee' ),\n\t\t\t\tfield: 'user_id',\n\t\t\t\tin_column: 1,\n\t\t\t\tdefault_args: default_args,\n\t\t\t\tlayout_name: 'global_user',\n\t\t\t\tapi_class: TTAPI.APIUser,\n\t\t\t\tmultiple: true,\n\t\t\t\tbasic_search: !this.hide_search_field,\n\t\t\t\tadv_search: false,\n\t\t\t\tform_item_type: FormItemType.AWESOME_BOX\n\t\t\t} ),\n\n\t\t\tnew SearchField( {\n\t\t\t\tlabel: $.i18n._( 'Accrual Account' ),\n\t\t\t\tfield: 'accrual_policy_account_id',\n\t\t\t\tin_column: 1,\n\t\t\t\tlayout_name: 'global_accrual_policy_account',\n\t\t\t\tapi_class: TTAPI.APIAccrualPolicyAccount,\n\t\t\t\tmultiple: true,\n\t\t\t\tbasic_search: true,\n\t\t\t\tadv_search: false,\n\t\t\t\tform_item_type: FormItemType.AWESOME_BOX\n\t\t\t} ),\n\n\t\t\tnew SearchField( {\n\t\t\t\tlabel: $.i18n._( 'Type' ),\n\t\t\t\tin_column: 1,\n\t\t\t\tfield: 'type_id',\n\t\t\t\tmultiple: true,\n\t\t\t\tbasic_search: true,\n\t\t\t\tadv_search: false,\n\t\t\t\tlayout_name: 'global_option_column',\n\t\t\t\tform_item_type: FormItemType.AWESOME_BOX\n\t\t\t} ),\n\n\t\t\tnew SearchField( {\n\t\t\t\tlabel: $.i18n._( 'Group' ),\n\t\t\t\tin_column: 1,\n\t\t\t\tmultiple: true,\n\t\t\t\tfield: 'group_id',\n\t\t\t\tlayout_name: 'global_tree_column',\n\t\t\t\ttree_mode: true,\n\t\t\t\tbasic_search: !this.hide_search_field,\n\t\t\t\tadv_search: false,\n\t\t\t\tform_item_type: FormItemType.AWESOME_BOX\n\t\t\t} ),\n\n\t\t\tnew SearchField( {\n\t\t\t\tlabel: $.i18n._( 'Default Branch' ),\n\t\t\t\tin_column: 2,\n\t\t\t\tfield: 'default_branch_id',\n\t\t\t\tlayout_name: 'global_branch',\n\t\t\t\tapi_class: TTAPI.APIBranch,\n\t\t\t\tmultiple: true,\n\t\t\t\tbasic_search: !this.hide_search_field,\n\t\t\t\tadv_search: false,\n\t\t\t\tform_item_type: FormItemType.AWESOME_BOX\n\t\t\t} ),\n\n\t\t\tnew SearchField( {\n\t\t\t\tlabel: $.i18n._( 'Default Department' ),\n\t\t\t\tin_column: 2,\n\t\t\t\tfield: 'default_department_id',\n\t\t\t\tlayout_name: 'global_department',\n\t\t\t\tapi_class: TTAPI.APIDepartment,\n\t\t\t\tmultiple: true,\n\t\t\t\tbasic_search: !this.hide_search_field,\n\t\t\t\tadv_search: false,\n\t\t\t\tform_item_type: FormItemType.AWESOME_BOX\n\t\t\t} ),\n\n\t\t\tnew SearchField( {\n\t\t\t\tlabel: $.i18n._( 'Created By' ),\n\t\t\t\tin_column: 2,\n\t\t\t\tfield: 'created_by',\n\t\t\t\tlayout_name: 'global_user',\n\t\t\t\tapi_class: TTAPI.APIUser,\n\t\t\t\tmultiple: true,\n\t\t\t\tbasic_search: !this.hide_search_field,\n\t\t\t\tadv_search: false,\n\t\t\t\tform_item_type: FormItemType.AWESOME_BOX\n\t\t\t} ),\n\n\t\t\tnew SearchField( {\n\t\t\t\tlabel: $.i18n._( 'Updated By' ),\n\t\t\t\tin_column: 2,\n\t\t\t\tfield: 'updated_by',\n\t\t\t\tlayout_name: 'global_user',\n\t\t\t\tapi_class: TTAPI.APIUser,\n\t\t\t\tmultiple: true,\n\t\t\t\tbasic_search: !this.hide_search_field,\n\t\t\t\tadv_search: false,\n\t\t\t\tform_item_type: FormItemType.AWESOME_BOX\n\t\t\t} )\n\t\t];\n\t}\n\n\tsetEditViewData() {\n\t\t//use the user_type_array in edit mode and new mode, use the system_type_array in view mode\n\t\t//this prevents users from choosing type_ids that are for system use only but can see the system type_ids when viewing\n\t\tif ( this.is_viewing ) {\n\t\t\tthis.edit_view_ui_dic.type_id.setSourceData( this.system_type_array );\n\t\t} else {\n\t\t\tthis.edit_view_ui_dic.type_id.setSourceData( this.user_type_array );\n\t\t}\n\n\t\tsuper.setEditViewData(); //Set Navigation\n\n\t\tif ( !this.sub_view_mode ) {\n\t\t\tvar widget = this.edit_view_ui_dic['user_id'];\n\t\t\tif ( ( !this.current_edit_record || !this.current_edit_record.id ) && !this.is_mass_editing ) {\n\t\t\t\twidget.setAllowMultipleSelection( true );\n\t\t\t} else {\n\t\t\t\twidget.setAllowMultipleSelection( false );\n\t\t\t}\n\t\t}\n\t}\n\n\tuniformVariable( records ) {\n\n\t\tvar record_array = [];\n\t\tif ( $.type( records.user_id ) === 'array' ) {\n\n\t\t\tif ( records.user_id.length === 0 ) {\n\t\t\t\trecords.user_id = false;\n\t\t\t\treturn records;\n\t\t\t}\n\n\t\t\tfor ( var key in records.user_id ) {\n\t\t\t\tvar new_record = Global.clone( records );\n\t\t\t\tnew_record.user_id = records.user_id[key];\n\t\t\t\trecord_array.push( new_record );\n\t\t\t}\n\t\t}\n\n\t\tif ( record_array.length > 0 ) {\n\t\t\trecords = record_array;\n\t\t}\n\n\t\treturn records;\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\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\tcase 'full_name':\n\t\t\t\t\t\tif ( this.current_edit_record['first_name'] ) {\n\t\t\t\t\t\t\twidget.setValue( this.current_edit_record['first_name'] + ' ' + this.current_edit_record['last_name'] );\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'amount':\n\t\t\t\t\t\tvar result = Global.getTimeUnit( this.current_edit_record[key] );\n\t\t\t\t\t\twidget.setValue( result );\n\t\t\t\t\t\tif ( !this.is_viewing ) {\n\t\t\t\t\t\t\t$( '#release-balance-button' ).css( 'display', '' );\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\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\t\tthis.collectUIDataToCurrentEditRecord();\n\t\tthis.setEditViewDataDone();\n\t}\n\n\tgetFilterColumnsFromDisplayColumns() {\n\t\tvar column_filter = {};\n\t\tcolumn_filter.type_id = true;\n\t\tif ( this.sub_view_mode ) {\n\t\t\tcolumn_filter.accrual_policy_account = true;\n\t\t\tcolumn_filter.accrual_policy_account_id = true;\n\t\t\tcolumn_filter.user_id = true;\n\t\t}\n\t\treturn this._getFilterColumnsFromDisplayColumns( column_filter, true );\n\t}\n\n\tonGridSelectAll() {\n\t\tthis.edit_enabled = this.editEnabled();\n\t\tthis.delete_enabled = this.deleteEnabled();\n\t\tthis.setDefaultMenu();\n\t}\n\n\tdeleteEnabled() {\n\t\tvar grid_selected_id_array = this.getGridSelectIdArray();\n\t\tif ( grid_selected_id_array.length > 0 ) {\n\t\t\tfor ( var i = grid_selected_id_array.length - 1; i >= 0; i-- ) {\n\t\t\t\tvar selected_item = this.getRecordFromGridById( grid_selected_id_array[i] );\n\t\t\t\tif ( Global.isSet( this.delete_type_array[selected_item.type_id] ) ) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\n\teditEnabled() {\n\t\tvar grid_selected_id_array = this.getGridSelectIdArray();\n\t\tif ( grid_selected_id_array.length > 0 ) {\n\t\t\tfor ( var i = grid_selected_id_array.length - 1; i >= 0; i-- ) {\n\t\t\t\tvar selected_item = this.getRecordFromGridById( grid_selected_id_array[i] );\n\t\t\t\tif ( Global.isSet( this.user_type_array[selected_item.type_id] ) ) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\n\tonGridSelectRow() {\n\n\t\tvar selected_item = null;\n\t\tvar grid_selected_id_array = this.getGridSelectIdArray();\n\t\tvar grid_selected_length = grid_selected_id_array.length;\n\n\t\tif ( grid_selected_length > 0 ) {\n\t\t\tselected_item = this.getRecordFromGridById( grid_selected_id_array[0] );\n\n\t\t\tthis.edit_enabled = this.editEnabled();\n\t\t\tthis.delete_enabled = this.deleteEnabled();\n\t\t}\n\n\t\tthis.setDefaultMenu();\n\t}\n\n\tsetDefaultMenuEditIcon( context_btn, grid_selected_length, pId ) {\n\t\tif ( !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\tif ( grid_selected_length === 1 && this.editOwnerOrChildPermissionValidate( pId ) ) {\n\t\t\tif ( this.edit_enabled ) {\n\t\t\t\tContextMenuManager.disableMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, true );\n\t\t\t} else {\n\t\t\t\tContextMenuManager.disableMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, false );\n\t\t\t}\n\t\t} else {\n\t\t\tContextMenuManager.disableMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, false );\n\t\t\tif ( grid_selected_length !== 0 ) {\n\t\t\t\t// This ensures the edit icon is still visible when nothing is selected, but should still be disabled. (to keep consistency with old design)\n\t\t\t\tContextMenuManager.hideMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, false );\n\t\t\t}\n\t\t}\n\t}\n\n\tsetDefaultMenuMassEditIcon( context_btn, grid_selected_length, pId ) {\n\t\tif ( !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\tif ( grid_selected_length > 1 ) {\n\t\t\tif ( this.edit_enabled ) {\n\t\t\t\tContextMenuManager.disableMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, true );\n\t\t\t} else {\n\t\t\t\tContextMenuManager.disableMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, false );\n\t\t\t}\n\t\t} else {\n\t\t\tContextMenuManager.disableMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, false );\n\t\t\tContextMenuManager.hideMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, false )\n\t\t}\n\t}\n\n\tsetDefaultMenuDeleteIcon( context_btn, grid_selected_length, pId ) {\n\t\tif ( !this.deletePermissionValidate( pId ) || this.edit_only_mode ) {\n\t\t\tContextMenuManager.hideMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, false )\n\t\t}\n\n\t\tif ( grid_selected_length >= 1 && this.deleteOwnerOrChildPermissionValidate( pId ) ) {\n\t\t\tif ( this.delete_enabled ) {\n\t\t\t\tContextMenuManager.disableMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, true );\n\t\t\t} else {\n\t\t\t\tContextMenuManager.disableMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, false );\n\t\t\t}\n\t\t} else {\n\t\t\tContextMenuManager.disableMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, false );\n\t\t}\n\t}\n\n\tsetEditMenuEditIcon( context_btn, pId ) {\n\t\tif ( !this.editPermissionValidate( pId ) || this.edit_only_mode || this.is_mass_editing ) {\n\n\t\t\tContextMenuManager.hideMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, false )\n\t\t}\n\n\t\tif ( this.edit_enabled && this.editOwnerOrChildPermissionValidate( pId ) ) {\n\t\t\tContextMenuManager.disableMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, true );\n\t\t\tif ( !this.is_viewing ) {\n\t\t\t\tContextMenuManager.disableMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, false );\n\t\t\t}\n\t\t} else {\n\t\t\tContextMenuManager.disableMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, false );\n\t\t}\n\t}\n\n\tsetEditMenuDeleteIcon( context_btn, pId ) {\n\t\tif ( !this.deletePermissionValidate( pId ) || this.edit_only_mode ) {\n\t\t\tContextMenuManager.hideMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, false )\n\t\t}\n\n\t\tif ( this.delete_enabled && this.deleteOwnerOrChildPermissionValidate( pId ) ) {\n\t\t\tContextMenuManager.disableMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, true );\n\t\t} else {\n\t\t\tContextMenuManager.disableMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, false );\n\t\t}\n\t}\n\n\tsetEditMenuDeleteAndNextIcon( context_btn, pId ) {\n\t\tif ( !this.deletePermissionValidate( pId ) || this.edit_only_mode ) {\n\t\t\tContextMenuManager.hideMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, false )\n\t\t}\n\n\t\tif ( this.delete_enabled && this.deleteOwnerOrChildPermissionValidate( pId ) ) {\n\t\t\tContextMenuManager.disableMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, true );\n\t\t} else {\n\t\t\tContextMenuManager.disableMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, false );\n\t\t}\n\t}\n\n\tgetCustomContextMenuModel() {\n\t\tvar context_menu_model = {\n\t\t\texclude: ['save_and_continue'],\n\t\t\tinclude: [\n\t\t\t\t{\n\t\t\t\t\tlabel: $.i18n._( 'Jump To' ),\n\t\t\t\t\tid: 'jump_to_header',\n\t\t\t\t\tmenu_align: 'right',\n\t\t\t\t\taction_group: 'jump_to',\n\t\t\t\t\taction_group_header: true,\n\t\t\t\t\tpermission_result: false // to hide it in legacy context menu and avoid errors in legacy parsers.\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: $.i18n._( 'TimeSheet' ),\n\t\t\t\t\tid: 'timesheet',\n\t\t\t\t\tmenu_align: 'right',\n\t\t\t\t\taction_group: 'jump_to',\n\t\t\t\t\tgroup: 'navigation',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: $.i18n._( 'Import' ),\n\t\t\t\t\tid: 'import_icon',\n\t\t\t\t\tmenu_align: 'right',\n\t\t\t\t\taction_group: 'import_export',\n\t\t\t\t\tgroup: 'other',\n\t\t\t\t\tvue_icon: 'tticon tticon-file_download_black_24dp',\n\t\t\t\t\tsort_order: 9010\n\t\t\t\t}\n\t\t\t]\n\t\t};\n\n\t\treturn context_menu_model;\n\t}\n\n\tgetGridSetup() {\n\t\tvar $this = this;\n\n\t\tvar grid_setup = {\n\t\t\tcontainer_selector: this.sub_view_mode ? '.edit-view-tab' : '.view',\n\t\t\tsub_grid_mode: this.sub_view_mode,\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\n\t\treturn grid_setup;\n\t}\n\n\tonCustomContextClick( id ) {\n\t\tswitch ( id ) {\n\t\t\tcase 'timesheet':\n\t\t\t\tthis.onNavigationClick();\n\t\t\t\tbreak;\n\t\t\tcase 'import_icon':\n\t\t\t\tthis.onImportClick();\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\tonImportClick() {\n\t\tvar $this = this;\n\t\tIndexViewController.openWizard( 'ImportCSVWizard', 'Accrual', function() {\n\t\t\t$this.search();\n\t\t} );\n\t}\n\n\treSelectLastSelectItems() {\n\t\tsuper.reSelectLastSelectItems();\n\n\t\t//Need to check edit_enabled and delete_enabled after re-selecting grid items to prevent issues when returning to list view and\n\t\t//context menu buttons not being enabled when they should be.\n\t\tthis.edit_enabled = this.editEnabled();\n\t\tthis.delete_enabled = this.deleteEnabled();\n\n\t\tif ( !this.edit_view ) {\n\t\t\tthis.setDefaultMenu();\n\t\t}\n\t}\n\n\tsetCustomDefaultMenuIcon( id, context_btn, grid_selected_length ) {\n\t\tswitch ( id ) {\n\t\t\tcase 'timesheet':\n\t\t\t\tthis.setDefaultMenuViewIcon( context_btn, grid_selected_length, 'punch' );\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\tsetCustomEditMenuIcon( id, context_btn ) {\n\t\tswitch ( id ) {\n\t\t\tcase 'timesheet':\n\t\t\t\t// Prevent user clicking timesheet from new accrual page by disabling the icon\n\t\t\t\tthis.setDefaultMenuViewIcon( context_btn, 'punch' );\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\tonNavigationClick() {\n\t\tvar $this = this;\n\t\tvar filter = { filter_data: {} };\n\t\tvar label = this.sub_view_mode ? $.i18n._( 'Accrual Balances' ) : $.i18n._( 'Accruals' );\n\n\t\tif ( Global.isSet( this.current_edit_record ) ) {\n\n\t\t\tfilter.user_id = this.current_edit_record.user_id;\n\t\t\tfilter.base_date = this.current_edit_record.time_stamp;\n\n\t\t\tGlobal.addViewTab( this.viewId, label, window.location.href );\n\t\t\tIndexViewController.goToView( 'TimeSheet', filter );\n\n\t\t} else {\n\t\t\tvar accrual_filter = {};\n\t\t\tvar grid_selected_id_array = this.getGridSelectIdArray();\n\t\t\tvar grid_selected_length = grid_selected_id_array.length;\n\n\t\t\tif ( grid_selected_length > 0 ) {\n\t\t\t\tvar selectedId = grid_selected_id_array[0];\n\n\t\t\t\taccrual_filter.filter_data = {};\n\t\t\t\taccrual_filter.filter_data.id = [selectedId];\n\n\t\t\t\tTTAPI.APIAccrual.getAccrual( accrual_filter, {\n\t\t\t\t\tonResult: function( result ) {\n\n\t\t\t\t\t\tvar result_data = result.getResult();\n\n\t\t\t\t\t\tif ( !result_data ) {\n\t\t\t\t\t\t\tresult_data = [];\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tresult_data = result_data[0];\n\n\t\t\t\t\t\tfilter.user_id = result_data.user_id;\n\t\t\t\t\t\tfilter.base_date = result_data.time_stamp;\n\n\t\t\t\t\t\tGlobal.addViewTab( $this.viewId, label, window.location.href );\n\t\t\t\t\t\tIndexViewController.goToView( 'TimeSheet', filter );\n\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t}\n\n\t\t}\n\t}\n\n\tgetSubViewFilter( filter ) {\n\t\tif ( this.parent_edit_record && this.parent_edit_record.user_id && this.parent_edit_record.accrual_policy_account_id ) {\n\t\t\tfilter.user_id = this.parent_edit_record.user_id;\n\t\t\tfilter.accrual_policy_account_id = this.parent_edit_record.accrual_policy_account_id;\n\t\t}\n\t\treturn filter;\n\t}\n\n\tonAddResult( result ) {\n\t\tvar $this = this;\n\t\tvar result_data = result.getResult();\n\n\t\tif ( !result_data ) {\n\t\t\tresult_data = [];\n\t\t}\n\n\t\tresult_data.company = LocalCacheData.current_company.name;\n\n\t\tif ( $this.sub_view_mode ) {\n\t\t\tresult_data['user_id'] = $this.parent_edit_record['user_id'];\n\t\t\tresult_data['first_name'] = $this.parent_edit_record['first_name'];\n\t\t\tresult_data['last_name'] = $this.parent_edit_record['last_name'];\n\t\t\tresult_data['accrual_policy_account_id'] = $this.parent_edit_record['accrual_policy_account_id'];\n\t\t\tresult_data['accrual_policy_account'] = $this.parent_edit_record['accrual_policy_account'];\n\t\t}\n\n\t\t$this.current_edit_record = result_data;\n\n\t\t$this.initEditView();\n\t}\n\n\tsearchDone() {\n\t\tvar $this = this;\n\n\t\t//When Attendance -> Accrual Balance, New icon is clicked, open the Balance view first, then trigger the New icon to create a new accrual entry from there.\n\t\tif ( Global.isSet( $this.is_trigger_add ) && $this.is_trigger_add ) {\n\t\t\t$this.onAddClick();\n\t\t\t$this.is_trigger_add = false;\n\t\t}\n\n\t\tif ( this.sub_view_mode ) {\n\t\t\tTTPromise.resolve( 'initSubAccrualView', 'init' );\n\n\t\t\tvar result_data = this.grid.getGridParam( 'data' );\n\t\t\tif ( !Global.isArray( result_data ) || result_data.length < 1 ) {\n\t\t\t\tthis.onCancelClick();\n\t\t\t\tif ( this.parent_view_controller ) {\n\t\t\t\t\tthis.parent_view_controller.search();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tsuper.searchDone();\n\t}\n\n\tgetAvailableBalance() {\n\t\tif ( this.is_viewing ) {\n\t\t\treturn;\n\t\t}\n\n\t\tvar $this = this;\n\n\t\tthis.api_accrual_balance.getAccrualBalanceAndRelease( this.current_edit_record.accrual_policy_account_id, this.current_edit_record.user_id, this.current_edit_record.type_id, {\n\t\t\t\tonResult: function( result ) {\n\t\t\t\t\t$this.releaseBalance( result.getResult() );\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t}\n\n\treleaseBalance( balance ) {\n\t\t//If the balance can be fully displayed in the preferred time unit, is that format.\n\t\t//Otherwise we need to release fractions of a minute, so force through \"HH:MM:SS\" and wrap it in quotes so it doesn't get rounded.\n\t\tif ( Global.parseTimeUnit( Global.getTimeUnit( balance ) ) == balance ) {\n\t\t\tthis.edit_view_ui_dic['amount'].setValue( Global.getTimeUnit( balance ) );\n\t\t} else {\n\t\t\tthis.edit_view_ui_dic['amount'].setValue( '\"' + Global.getTimeUnit( balance, 12 ) + '\"' ); //12=\"HH:MM:SS\"\n\t\t}\n\t\tthis.edit_view_ui_dic['amount'].trigger( 'change' ); //Trigger change event to properly update the amount and trigger validation.\n\t}\n\n}\n\nAccrualViewController.loadView = function() {\n\n\tGlobal.loadViewSource( 'Accrual', 'AccrualView.html', function( result ) {\n\n\t\tTTPromise.wait( 'BaseViewController', 'initialize', function() {\n\n\t\t\tvar args = {};\n\t\t\tvar template = _.template( result );\n\n\t\t\tGlobal.contentContainer().html( template( args ) );\n\t\t} );\n\t} );\n\n};\n\nAccrualViewController.loadSubView = function( container, beforeViewLoadedFun, afterViewLoadedFun ) {\n\tGlobal.loadViewSource( 'Accrual', 'SubAccrualView.html', function( result ) {\n\n\t\tvar args = {};\n\t\tvar template = _.template( result );\n\n\t\tif ( Global.isSet( beforeViewLoadedFun ) ) {\n\t\t\tbeforeViewLoadedFun();\n\t\t}\n\n\t\tif ( Global.isSet( container ) ) {\n\t\t\tcontainer.html( template( args ) );\n\t\t\tif ( Global.isSet( afterViewLoadedFun ) ) {\n\t\t\t\tTTPromise.add( 'AccrualViewController', 'init' );\n\t\t\t\tTTPromise.wait( 'AccrualViewController', 'init', function() {\n\t\t\t\t\tafterViewLoadedFun( sub_accrual_view_controller );\n\t\t\t\t} );\n\t\t\t}\n\t\t}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