"use strict";(self.webpackChunktimetrex=self.webpackChunktimetrex||[]).push([["attendance-schedule-ScheduleShiftViewController"],{2509:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"ScheduleShiftViewController\": () => (/* binding */ ScheduleShiftViewController)\n/* harmony export */ });\n/* provided dependency */ var _ = __webpack_require__(9050);\n/* provided dependency */ var $ = __webpack_require__(9755);\nclass ScheduleShiftViewController extends BaseViewController {\n\tconstructor( options = {} ) {\n\t\t_.defaults( options, {\n\t\t\tel: '#schedule_shift_view_container',\n\n\n\t\t\tschedule_status_array: null,\n\n\t\t\tuser_status_array: null,\n\n\t\t\tuser_group_array: null,\n\n\t\t\tuser_api: null,\n\t\t\tuser_group_api: null,\n\t\t\tdate_api: null,\n\t\t\tabsence_policy_api: null,\n\n\t\t\tjob_api: null,\n\t\t\tjob_item_api: null,\n\t\t\tdepartment_api: null,\n\t\t\tdefault_punch_tag: [],\n\t\t\tprevious_punch_tag_selection: [],\n\n\t\t\ttotal_time: null,\n\t\t\tpre_total_time: 0,\n\n\t\t\tis_mass_adding: false\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 = 'ScheduleShiftEditView.html';\n\t\tthis.permission_id = 'schedule';\n\t\tthis.viewId = 'ScheduleShift';\n\t\tthis.script_name = 'ScheduleShiftView';\n\t\tthis.table_name_key = 'schedule';\n\t\tthis.context_menu_name = $.i18n._( 'Schedule Shift' );\n\t\tthis.navigation_label = $.i18n._( 'Schedule' );\n\t\tthis.api = TTAPI.APISchedule;\n\t\tthis.absence_policy_api = TTAPI.APIAbsencePolicy;\n\t\tthis.user_api = TTAPI.APIUser;\n\t\tthis.user_group_api = TTAPI.APIUserGroup;\n\n\t\tif ( Global.getProductEdition() >= 20 ) {\n\t\t\tthis.job_api = TTAPI.APIJob;\n\t\t\tthis.job_item_api = TTAPI.APIJobItem;\n\t\t\tthis.punch_tag_api = TTAPI.APIPunchTag;\n\t\t\tthis.department_api = TTAPI.APIDepartment;\n\t\t}\n\n\t\tthis.date_api = TTAPI.APITTDate;\n\n\t\tthis.initPermission();\n\t\tthis.render();\n\t\tthis.buildContextMenu();\n\n\t\tthis.initData();\n\t}\n\n\tgetCustomContextMenuModel() {\n\t\tvar context_menu_model = {\n\t\t\texclude: ['copy'],\n\t\t\tinclude: []\n\t\t};\n\n\t\treturn context_menu_model;\n\t}\n\n\tonSaveClick( ignoreWarning ) {\n\t\t// this function will shortly be deprecated and replaced by BaseViewController.onViewClick(), but this intermediatiary step of reorganizing the code\n\t\t// is to help debug in future by seeing how the current function was updated to match baseview.\n\t\t// initially, the code looped over all the mass edit records, and then for each record, it would loop over the changed fields and set them on that record.\n\t\t// instead, we will now just loop over the changed fields once, and then loop over the mass edit records, cloning this changed set of fields.\n\t\t// The clone itself is probably yet another loop internally, but this at least makes it easier to read and also allows the merge to use the common base view controller function.\n\n\t\tvar $this = this;\n\t\tvar record;\n\t\tif ( this.is_mass_editing ) {\n\t\t\trecord = [];\n\n\t\t\t// loop over all fields on the form, and track the ones that have changed\n\t\t\tvar mass_record_shared = {};\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\t\t\t\tvar widget = this.edit_view_ui_dic[key];\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\tmass_record_shared[key] = widget.getValue();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// loop over all the selected id's for the mass edit, and apply a copy of the changed fields to each\n\n\t\t\tfor ( var i = 0; i < this.mass_edit_record_ids.length; i++ ) {\n\t\t\t\t//create new copy of the fields that have changed.\n\t\t\t\tvar mass_record_single = Global.clone( mass_record_shared );\n\t\t\t\tmass_record_single['id'] = $this.mass_edit_record_ids[i];\n\n\t\t\t\t// push the single record into the array of mass edit records to be saved\n\t\t\t\trecord.push( mass_record_single );\n\t\t\t}\n\t\t} else {\n\t\t\tthis.collectUIDataToCurrentEditRecord();\n\t\t\trecord = this.uniformVariable( this.current_edit_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\t//Make sure this.current_edit_record is updated before validate\n\tvalidate() {\n\t\tvar $this = this;\n\t\tvar record = {};\n\t\tif ( this.is_mass_editing ) {\n\t\t\tvar record = [];\n\t\t\tfor ( var i = 0; i < this.mass_edit_record_ids.length; i++ ) {\n\t\t\t\tvar mass_record = {};\n\t\t\t\tmass_record['id'] = $this.mass_edit_record_ids[i];\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\t\t\t\t\tvar widget = this.edit_view_ui_dic[key];\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\tmass_record[key] = widget.getValue();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\trecord.push( mass_record );\n\t\t\t}\n\t\t} else {\n\t\t\tthis.collectUIDataToCurrentEditRecord();\n\t\t\trecord = this.uniformVariable( this.current_edit_record );\n\t\t}\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\t\t\t}\n\t\t} );\n\t}\n\n\tjobUIValidate( p_id ) {\n\n\t\tif ( !p_id ) {\n\t\t\tp_id = this.permission_id;\n\t\t}\n\n\t\tif ( PermissionManager.validate( 'job', 'enabled' ) &&\n\t\t\tPermissionManager.validate( p_id, 'edit_job' ) &&\n\t\t\t( Global.getProductEdition() >= 20 ) ) {\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tjobItemUIValidate( p_id ) {\n\n\t\tif ( !p_id ) {\n\t\t\tp_id = 'schedule';\n\t\t}\n\n\t\tif ( PermissionManager.validate( 'job_item', 'enabled' ) &&\n\t\t\tPermissionManager.validate( p_id, 'edit_job_item' ) ) {\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tpunchTagUIValidate( p_id ) {\n\n\t\tif ( !p_id ) {\n\t\t\tp_id = 'schedule';\n\t\t}\n\n\t\tif ( PermissionManager.validate( 'punch_tag', 'enabled' ) &&\n\t\t\tPermissionManager.validate( p_id, 'edit_punch_tag' ) ) {\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tbranchUIValidate( p_id ) {\n\n\t\tif ( !p_id ) {\n\t\t\tp_id = 'schedule';\n\t\t}\n\n\t\tif ( PermissionManager.validate( p_id, 'edit_branch' ) ) {\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tdepartmentUIValidate( p_id ) {\n\n\t\tif ( !p_id ) {\n\t\t\tp_id = 'schedule';\n\t\t}\n\n\t\tif ( PermissionManager.validate( p_id, 'edit_department' ) ) {\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tinitPermission() {\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.show_search_tab = true;\n\t\t} else {\n\t\t\tthis.show_search_tab = false;\n\t\t}\n\n\t\tif ( this.jobUIValidate() ) {\n\t\t\tthis.show_job_ui = true;\n\t\t} else {\n\t\t\tthis.show_job_ui = false;\n\t\t}\n\n\t\tif ( this.jobItemUIValidate() ) {\n\t\t\tthis.show_job_item_ui = true;\n\t\t} else {\n\t\t\tthis.show_job_item_ui = false;\n\t\t}\n\n\t\tif ( this.punchTagUIValidate() ) {\n\t\t\tthis.show_punch_tag_ui = true;\n\t\t} else {\n\t\t\tthis.show_punch_tag_ui = false;\n\t\t}\n\n\t\tif ( this.branchUIValidate() ) {\n\t\t\tthis.show_branch_ui = true;\n\t\t} else {\n\t\t\tthis.show_branch_ui = false;\n\t\t}\n\n\t\tif ( this.departmentUIValidate() ) {\n\t\t\tthis.show_department_ui = true;\n\t\t} else {\n\t\t\tthis.show_department_ui = false;\n\t\t}\n\t}\n\n\tinitOptions() {\n\t\tvar $this = this;\n\n\t\tthis.initDropDownOption( 'status', 'status_id', this.api, function( res ) {\n\t\t\tres = res.getResult();\n\n\t\t\t$this.schedule_status_array = Global.buildRecordArray( res );\n\n\t\t} );\n\n\t\tthis.initDropDownOption( 'status', 'user_status_id', this.user_api, function( res ) {\n\t\t\tres = res.getResult();\n\n\t\t\t$this.user_status_array = Global.buildRecordArray( res );\n\t\t} );\n\n\t\tthis.user_group_api.getUserGroup( '', false, false, {\n\t\t\tonResult: function( res ) {\n\t\t\t\tres = res.getResult();\n\n\t\t\t\tres = Global.buildTreeRecord( res );\n\t\t\t\t$this.user_group_array = res;\n\n\t\t\t\t$this.adv_search_field_ui_dic['group_ids'].setSourceData( res );\n\n\t\t\t}\n\t\t} );\n\t}\n\n\tcheckOpenPermission() {\n\t\tif ( Global.getProductEdition() >= 15 && PermissionManager.validate( 'schedule', 'view_open' ) ) {\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tgetCustomFieldReferenceField() {\n\t\treturn 'note';\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_schedule': { 'label': $.i18n._( 'Schedule' ) },\n\t\t\t'tab_audit': true,\n\t\t};\n\t\tthis.setTabModel( tab_model );\n\n\t\tvar form_item_input;\n\t\tvar widgetContainer;\n\n\t\tthis.navigation.AComboBox( {\n\t\t\tapi_class: TTAPI.APISchedule,\n\t\t\tid: this.script_name + '_navigation',\n\t\t\tallow_multiple_selection: false,\n\t\t\tlayout_name: 'global_schedule_schedule',\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_schedule = this.edit_view_tab.find( '#tab_schedule' );\n\n\t\tvar tab_schedule_column1 = tab_schedule.find( '.first-column' );\n\n\t\tthis.edit_view_tabs[0] = [];\n\n\t\tthis.edit_view_tabs[0].push( tab_schedule_column1 );\n\n\t\t// Employee\n\t\t// Employees\n\t\tform_item_input = Global.loadWidgetByName( FormItemType.AWESOME_BOX );\n\n\t\tform_item_input.AComboBox( {\n\t\t\tapi_class: TTAPI.APIUser,\n\t\t\tallow_multiple_selection: true,\n\t\t\tlayout_name: 'global_user',\n\t\t\tshow_search_inputs: true,\n\t\t\tset_empty: !this.checkOpenPermission(),\n\t\t\tset_special_empty: true,\n\t\t\tfield: 'user_id',\n\t\t\taddition_source_function: ( function( target, source_data ) {\n\t\t\t\treturn $this.onEmployeeSourceCreate( target, source_data );\n\t\t\t} )\n\n\t\t} );\n\t\tvar default_args = {};\n\t\tdefault_args.permission_section = 'schedule';\n\t\tform_item_input.setDefaultArgs( default_args );\n\t\tthis.addEditFieldToColumn( $.i18n._( 'Employee' ), form_item_input, tab_schedule_column1, '' );\n\n\t\t// Status\n\n\t\tform_item_input = Global.loadWidgetByName( FormItemType.COMBO_BOX );\n\t\tform_item_input.TComboBox( { field: 'status_id' } );\n\t\tform_item_input.setSourceData( $this.schedule_status_array );\n\t\tthis.addEditFieldToColumn( $.i18n._( 'Status' ), form_item_input, tab_schedule_column1 );\n\n\t\t//Absence Policy\n\t\tform_item_input = Global.loadWidgetByName( FormItemType.AWESOME_BOX );\n\n\t\tform_item_input.AComboBox( {\n\t\t\tapi_class: TTAPI.APIAbsencePolicy,\n\t\t\tallow_multiple_selection: false,\n\t\t\tlayout_name: 'global_absences',\n\t\t\tshow_search_inputs: true,\n\t\t\tset_empty: true,\n\t\t\tfield: 'absence_policy_id'\n\t\t} );\n\n\t\tform_item_input.customSearchFilter = function( filter ) {\n\t\t\treturn $this.setAbsencePolicyFilter( filter );\n\t\t};\n\n\t\tthis.addEditFieldToColumn( $.i18n._( 'Absence Policy' ), form_item_input, tab_schedule_column1, '', null, true );\n\n\t\t// Available Balance\n\t\tform_item_input = Global.loadWidgetByName( FormItemType.TEXT );\n\t\tform_item_input.TText( { field: 'available_balance' } );\n\n\t\twidgetContainer = $( '
' );\n\t\tthis.available_balance_info = $( '' );\n\n\t\twidgetContainer.append( form_item_input );\n\t\twidgetContainer.append( this.available_balance_info );\n\n\t\tthis.addEditFieldToColumn( $.i18n._( 'Available Balance' ), form_item_input, tab_schedule_column1, '', widgetContainer, true );\n\n\t\t// Date\n\t\tform_item_input = Global.loadWidgetByName( FormItemType.DATE_PICKER );\n\t\tform_item_input.TDatePicker( { field: 'start_date_stamp', validation_field: 'date_stamp' } );\n\t\tthis.addEditFieldToColumn( $.i18n._( 'Date' ), form_item_input, tab_schedule_column1, '', null );\n\n\t\t//Mass Add Date\n\t\tform_item_input = Global.loadWidgetByName( FormItemType.DATE_PICKER );\n\t\tform_item_input.TRangePicker( { field: 'start_date_stamps', validation_field: 'date_stamp' } );\n\t\tthis.addEditFieldToColumn( $.i18n._( 'Date' ), form_item_input, tab_schedule_column1, '', null, true );\n\n\t\t// In\n\t\tform_item_input = Global.loadWidgetByName( FormItemType.TIME_PICKER );\n\n\t\tform_item_input.TTimePicker( { field: 'start_time' } );\n\t\tthis.addEditFieldToColumn( $.i18n._( 'In' ), form_item_input, tab_schedule_column1, '', null );\n\n\t\t// Out\n\n\t\tform_item_input = Global.loadWidgetByName( FormItemType.TIME_PICKER );\n\n\t\tform_item_input.TTimePicker( { field: 'end_time' } );\n\n\t\tthis.addEditFieldToColumn( $.i18n._( 'Out' ), form_item_input, tab_schedule_column1, '', null );\n\n\t\t// Total\n\t\tform_item_input = Global.loadWidgetByName( FormItemType.TEXT );\n\t\tform_item_input.TText( { field: 'total_time' } );\n\t\tthis.addEditFieldToColumn( $.i18n._( 'Total' ), form_item_input, tab_schedule_column1 );\n\n\t\t// Schedule Policy\n\t\tform_item_input = Global.loadWidgetByName( FormItemType.AWESOME_BOX );\n\n\t\tform_item_input.AComboBox( {\n\t\t\tapi_class: TTAPI.APISchedulePolicy,\n\t\t\tallow_multiple_selection: false,\n\t\t\tlayout_name: 'global_schedule',\n\t\t\tshow_search_inputs: true,\n\t\t\tset_empty: true,\n\t\t\tfield: 'schedule_policy_id'\n\t\t} );\n\t\tthis.addEditFieldToColumn( $.i18n._( 'Schedule Policy' ), form_item_input, tab_schedule_column1 );\n\n\t\t// Branch\n\t\tform_item_input = Global.loadWidgetByName( FormItemType.AWESOME_BOX );\n\n\t\tform_item_input.AComboBox( {\n\t\t\tapi_class: TTAPI.APIBranch,\n\t\t\tallow_multiple_selection: false,\n\t\t\tlayout_name: 'global_branch',\n\t\t\tshow_search_inputs: true,\n\t\t\tset_empty: true,\n\t\t\tfield: 'branch_id',\n\t\t\taddition_source_function: ( function( target, source_data ) {\n\t\t\t\treturn $this.onSourceDataCreate( target, source_data );\n\t\t\t} ),\n\t\t\tadded_items: [\n\t\t\t\t{ value: TTUUID.not_exist_id, label: Global.default_item },\n\t\t\t]\n\t\t} );\n\t\tthis.addEditFieldToColumn( $.i18n._( 'Branch' ), form_item_input, tab_schedule_column1, '', null, true );\n\n\t\tif ( !this.show_branch_ui ) {\n\t\t\tthis.detachElement( 'branch_id' );\n\n\t\t}\n\n\t\t// Department\n\t\tform_item_input = Global.loadWidgetByName( FormItemType.AWESOME_BOX );\n\n\t\tform_item_input.AComboBox( {\n\t\t\tapi_class: TTAPI.APIDepartment,\n\t\t\tallow_multiple_selection: false,\n\t\t\tlayout_name: 'global_department',\n\t\t\tshow_search_inputs: true,\n\t\t\tset_empty: true,\n\t\t\tfield: 'department_id',\n\t\t\taddition_source_function: ( function( target, source_data ) {\n\t\t\t\treturn $this.onSourceDataCreate( target, source_data );\n\t\t\t} ),\n\t\t\tadded_items: [\n\t\t\t\t{ value: TTUUID.not_exist_id, label: Global.default_item },\n\t\t\t]\n\t\t} );\n\t\tthis.addEditFieldToColumn( $.i18n._( 'Department' ), form_item_input, tab_schedule_column1, '', null, true );\n\n\t\tif ( !this.show_department_ui ) {\n\t\t\tthis.detachElement( 'department_id' );\n\t\t}\n\n\t\tif ( Global.getProductEdition() >= 20 ) {\n\t\t\t//Job\n\t\t\tform_item_input = Global.loadWidgetByName( FormItemType.AWESOME_BOX );\n\n\t\t\tform_item_input.AComboBox( {\n\t\t\t\tapi_class: TTAPI.APIJob,\n\t\t\t\tallow_multiple_selection: false,\n\t\t\t\tlayout_name: 'global_job',\n\t\t\t\tshow_search_inputs: true,\n\t\t\t\tset_empty: true,\n\t\t\t\tsetRealValueCallBack: ( function( val ) {\n\t\t\t\t\tif ( val ) {\n\t\t\t\t\t\tjob_coder.setValue( val.manual_id );\n\t\t\t\t\t}\n\t\t\t\t} ),\n\t\t\t\tfield: 'job_id',\n\t\t\t\taddition_source_function: ( function( target, source_data ) {\n\t\t\t\t\treturn $this.onSourceDataCreate( target, source_data );\n\t\t\t\t} ),\n\t\t\t\tadded_items: [\n\t\t\t\t\t{ value: TTUUID.not_exist_id, label: Global.default_item },\n\t\t\t\t]\n\t\t\t} );\n\n\t\t\twidgetContainer = $( '
' );\n\n\t\t\tvar job_coder = Global.loadWidgetByName( FormItemType.TEXT_INPUT );\n\t\t\tjob_coder.TTextInput( { field: 'job_quick_search', disable_keyup_event: true } );\n\t\t\tjob_coder.addClass( 'job-coder' );\n\n\t\t\twidgetContainer.append( job_coder );\n\t\t\twidgetContainer.append( form_item_input );\n\t\t\tthis.addEditFieldToColumn( $.i18n._( 'Job' ), [form_item_input, job_coder], tab_schedule_column1, '', widgetContainer, true );\n\n\t\t\tif ( !this.show_job_ui ) {\n\t\t\t\tthis.detachElement( 'job_id' );\n\t\t\t}\n\n\t\t\t// Task\n\t\t\tform_item_input = Global.loadWidgetByName( FormItemType.AWESOME_BOX );\n\n\t\t\tform_item_input.AComboBox( {\n\t\t\t\tapi_class: TTAPI.APIJobItem,\n\t\t\t\tallow_multiple_selection: false,\n\t\t\t\tlayout_name: 'global_job_item',\n\t\t\t\tshow_search_inputs: true,\n\t\t\t\tset_empty: true,\n\t\t\t\tsetRealValueCallBack: ( function( val ) {\n\t\t\t\t\tif ( val ) {\n\t\t\t\t\t\tjob_item_coder.setValue( val.manual_id );\n\t\t\t\t\t}\n\t\t\t\t} ),\n\t\t\t\tfield: 'job_item_id',\n\t\t\t\taddition_source_function: ( function( target, source_data ) {\n\t\t\t\t\treturn $this.onSourceDataCreate( target, source_data );\n\t\t\t\t} ),\n\t\t\t\tadded_items: [\n\t\t\t\t\t{ value: TTUUID.not_exist_id, label: Global.default_item },\n\t\t\t\t]\n\t\t\t} );\n\n\t\t\twidgetContainer = $( '
' );\n\n\t\t\tvar job_item_coder = Global.loadWidgetByName( FormItemType.TEXT_INPUT );\n\t\t\tjob_item_coder.TTextInput( { field: 'job_item_quick_search', disable_keyup_event: true } );\n\t\t\tjob_item_coder.addClass( 'job-coder' );\n\n\t\t\twidgetContainer.append( job_item_coder );\n\t\t\twidgetContainer.append( form_item_input );\n\t\t\tthis.addEditFieldToColumn( $.i18n._( 'Task' ), [form_item_input, job_item_coder], tab_schedule_column1, '', widgetContainer, true );\n\n\t\t\tif ( !this.show_job_item_ui ) {\n\t\t\t\tthis.detachElement( 'job_item_id' );\n\t\t\t}\n\n\t\t\t//Punch Tag\n\t\t\tform_item_input = Global.loadWidgetByName( FormItemType.AWESOME_BOX );\n\n\t\t\tform_item_input.AComboBox( {\n\t\t\t\tapi_class: TTAPI.APIPunchTag,\n\t\t\t\tallow_multiple_selection: true,\n\t\t\t\tlayout_name: 'global_punch_tag',\n\t\t\t\tshow_search_inputs: true,\n\t\t\t\tset_empty: true,\n\t\t\t\tget_real_data_on_multi: true,\n\t\t\t\tsetRealValueCallBack: ( ( punch_tags, get_real_data ) => {\n\t\t\t\t\tif ( punch_tags ) {\n\t\t\t\t\t\tthis.setPunchTagQuickSearchManualIds( punch_tags, get_real_data );\n\t\t\t\t\t}\n\t\t\t\t} ),\n\t\t\t\tfield: 'punch_tag_id',\n\t\t\t\taddition_source_function: ( function( target, source_data ) {\n\t\t\t\t\treturn $this.onSourceDataCreate( target, source_data );\n\t\t\t\t} ),\n\t\t\t\tadded_items: [\n\t\t\t\t\t{ value: TTUUID.not_exist_id, label: Global.default_item },\n\t\t\t\t]\n\t\t\t} );\n\n\t\t\twidgetContainer = $( '
' );\n\n\t\t\tvar punch_tag_coder = Global.loadWidgetByName( FormItemType.TEXT_INPUT );\n\t\t\tpunch_tag_coder.TTextInput( { field: 'punch_tag_quick_search', disable_keyup_event: true } );\n\t\t\tpunch_tag_coder.addClass( 'job-coder' );\n\n\t\t\twidgetContainer.append( punch_tag_coder );\n\t\t\twidgetContainer.append( form_item_input );\n\t\t\tthis.addEditFieldToColumn( $.i18n._( 'Tags' ), [form_item_input, punch_tag_coder], tab_schedule_column1, '', widgetContainer, true );\n\n\t\t\tif ( !this.show_punch_tag_ui ) {\n\t\t\t\tthis.detachElement( 'punch_tag_id' );\n\t\t\t}\n\t\t}\n\n\t\t//Note\n\t\tform_item_input = Global.loadWidgetByName( FormItemType.TEXT_AREA );\n\t\tform_item_input.TTextArea( { field: 'note', width: '100%' } );\n\t\tthis.addEditFieldToColumn( $.i18n._( 'Note' ), form_item_input, tab_schedule_column1, '', null, null, true );\n\t\tform_item_input.parent().width( '45%' );\n\n\t\tif ( Global.getProductEdition() >= 15 && this.is_viewing == false ) {\n\t\t\t//Notify Employee\n\t\t\tform_item_input = Global.loadWidgetByName( FormItemType.CHECKBOX );\n\t\t\tform_item_input.TCheckbox( { field: 'notify_user_schedule_change' } );\n\t\t\tthis.addEditFieldToColumn( $.i18n._( 'Notify Employee' ), form_item_input, tab_schedule_column1, '', null, true );\n\t\t}\n\n\t\tif ( this.is_mass_editing ) {\n\t\t\tthis.detachElement( 'total_time' );\n\t\t} else {\n\t\t\tthis.attachElement( 'total_time' );\n\t\t}\n\t}\n\n\tonSourceDataCreate( target, source_data ) {\n\t\tvar display_columns = target.getDisplayColumns();\n\t\tvar first_item = {};\n\n\t\t$.each( display_columns, function( index, content ) {\n\t\t\tfirst_item.id = TTUUID.not_exist_id;\n\t\t\tfirst_item[content.name] = Global.default_item;\n\t\t\treturn false;\n\t\t} );\n\n\t\t//Error: Object doesn't support property or method 'unshift' in /interface/html5/line 6953\n\t\tif ( !source_data || $.type( source_data ) !== 'array' ) {\n\t\t\tsource_data = [];\n\t\t}\n\t\tsource_data.unshift( first_item );\n\n\t\treturn source_data;\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\tvar widgetContainer = this.edit_view_form_item_dic[key];\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\tswitch ( key ) {\n\t\t\t\tcase 'start_date_stamps':\n\t\t\t\t\tif ( ( !this.current_edit_record.id || this.current_edit_record.id == TTUUID.zero_id ) && !this.is_mass_editing && !this.is_edit ) {\n\t\t\t\t\t\tthis.attachElement( key );\n\t\t\t\t\t\twidget.parents( '.edit-view-form-item-div' ).show();\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis.detachElement( key );\n\t\t\t\t\t\twidget.parents( '.edit-view-form-item-div' ).hide();\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'start_date_stamp':\n\t\t\t\t\tif ( ( !this.current_edit_record.id || this.current_edit_record.id == TTUUID.zero_id ) && !this.is_mass_editing && !this.is_edit ) {\n\t\t\t\t\t\tthis.detachElement( key );\n\t\t\t\t\t\twidget.parents( '.edit-view-form-item-div' ).hide();\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis.attachElement( key );\n\t\t\t\t\t\twidget.parents( '.edit-view-form-item-div' ).show();\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\twidget.css( 'opacity', 1 );\n\t\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\t// #2831 Must check is_viewing, otherwise all fields are editable in View mode. Bug originated in 886a33c71174c10c0699cbf869a3cf2ebd200591\n\t\t\tif ( this.is_viewing ) {\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\texchangeBalance() {\n\n\t\tvar b_div = $( $( this ).next() );\n\t\tif ( b_div.css( 'display' ) === 'block' ) {\n\t\t\tb_div.css( 'display', 'none' );\n\t\t} else if ( b_div.css( 'display' ) === 'none' ) {\n\t\t\tb_div.css( 'display', 'block' );\n\n\t\t}\n\t}\n\n\tonAddResult( result ) {\n\t\tvar $this = this;\n\t\tvar result_data = result.getResult();\n\t\tif ( !result_data ) {\n\t\t\tresult_data = [];\n\t\t}\n\t\tresult_data.company = LocalCacheData.current_company.name;\n\t\tif ( $this.sub_view_mode && $this.parent_key ) {\n\t\t\tresult_data[$this.parent_key] = $this.parent_value;\n\t\t}\n\t\t// Default to Open\n\t\tresult_data === true && ( result_data = { user_id: TTUUID.zero_id } );\n\t\t!result_data.user_id && ( result_data.user_id = TTUUID.zero_id );\n\t\t$this.current_edit_record = result_data;\n\t\t$this.initEditView();\n\t}\n\n\tsetAbsencePolicyFilter( filter ) {\n\t\tif ( !filter.filter_data ) {\n\t\t\tfilter.filter_data = {};\n\t\t}\n\n\t\tfilter.filter_data.user_id = this.current_edit_record.user_id;\n\t\tif ( filter.filter_columns ) {\n\t\t\tfilter.filter_columns.absence_policy = true;\n\t\t}\n\n\t\treturn filter;\n\t}\n\n\tonEmployeeSourceCreate( target, source_data ) {\n\n\t\tif ( !this.checkOpenPermission() ) {\n\t\t\treturn source_data;\n\t\t}\n\n\t\tvar display_columns = target.getDisplayColumns();\n\n\t\tvar first_item = {};\n\t\t$.each( display_columns, function( index, content ) {\n\n\t\t\tfirst_item.id = TTUUID.zero_id;\n\t\t\tfirst_item[content.name] = Global.open_item;\n\n\t\t\treturn false;\n\t\t} );\n\n\t\t//Error: Object doesn't support property or method 'unshift' in /interface/html5/line 6953\n\t\tif ( !source_data || $.type( source_data ) !== 'array' ) {\n\t\t\tsource_data = [];\n\t\t}\n\t\tsource_data.unshift( first_item );\n\n\t\treturn source_data;\n\t}\n\n\tbuildSearchFields() {\n\n\t\tsuper.buildSearchFields();\n\t\tvar $this = this;\n\t\tthis.search_fields = [\n\n\t\t\tnew SearchField( {\n\t\t\t\tlabel: $.i18n._( 'Status' ),\n\t\t\t\tin_column: 1,\n\t\t\t\tfield: 'status_id',\n\t\t\t\tmultiple: true,\n\t\t\t\tbasic_search: true,\n\t\t\t\tadv_search: true,\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._( 'Employee' ),\n\t\t\t\tin_column: 1,\n\t\t\t\tfield: 'user_id',\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: true,\n\t\t\t\taddition_source_function: ( function( target, source_data ) {\n\t\t\t\t\treturn $this.onEmployeeSourceCreate( target, source_data );\n\t\t\t\t} ),\n\t\t\t\tadv_search: true,\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._( 'Pay Period' ),\n\t\t\t\tin_column: 1,\n\t\t\t\tfield: 'pay_period_id',\n\t\t\t\tlayout_name: 'global_Pay_period',\n\t\t\t\tapi_class: TTAPI.APIPayPeriod,\n\t\t\t\tmultiple: true,\n\t\t\t\tbasic_search: true,\n\t\t\t\tadv_search: true,\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._( 'Start Date' ),\n\t\t\t\tin_column: 1,\n\t\t\t\tfield: 'start_date',\n\t\t\t\tbasic_search: false,\n\t\t\t\tadv_search: true,\n\t\t\t\tform_item_type: FormItemType.DATE_PICKER\n\t\t\t} ),\n\t\t\tnew SearchField( {\n\t\t\t\tlabel: $.i18n._( 'End Date' ),\n\t\t\t\tin_column: 1,\n\t\t\t\tfield: 'end_date',\n\t\t\t\tbasic_search: false,\n\t\t\t\tadv_search: true,\n\t\t\t\tform_item_type: FormItemType.DATE_PICKER\n\t\t\t} ),\n\n\t\t\tnew SearchField( {\n\t\t\t\tlabel: $.i18n._( 'Employee Status' ),\n\t\t\t\tin_column: 1,\n\t\t\t\tfield: 'user_status_id',\n\t\t\t\tmultiple: true,\n\t\t\t\tbasic_search: false,\n\t\t\t\tadv_search: true,\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._( 'Default Branch' ),\n\t\t\t\tin_column: 1,\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: false,\n\t\t\t\tadv_search: true,\n\t\t\t\tscript_name: 'BranchView',\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: 1,\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: false,\n\t\t\t\tadv_search: true,\n\t\t\t\tscript_name: 'DepartmentView',\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: 2,\n\t\t\t\tmultiple: true,\n\t\t\t\tfield: 'group_ids',\n\t\t\t\tlayout_name: 'global_tree_column',\n\t\t\t\ttree_mode: true,\n\t\t\t\tbasic_search: false,\n\t\t\t\tadv_search: true,\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._( 'Title' ),\n\t\t\t\tfield: 'title_id',\n\t\t\t\tin_column: 2,\n\t\t\t\tlayout_name: 'global_job_title',\n\t\t\t\tapi_class: TTAPI.APIUserTitle,\n\t\t\t\tmultiple: true,\n\t\t\t\tbasic_search: false,\n\t\t\t\tadv_search: true,\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._( 'Job' ),\n\t\t\t\tin_column: 2,\n\t\t\t\tfield: 'job_id',\n\t\t\t\tlayout_name: 'global_job',\n\t\t\t\tapi_class: ( Global.getProductEdition() >= 20 ) ? TTAPI.APIJob : null,\n\t\t\t\tmultiple: true,\n\t\t\t\tbasic_search: false,\n\t\t\t\tadv_search: ( this.show_job_ui && ( Global.getProductEdition() >= 20 ) ),\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._( 'Task' ),\n\t\t\t\tin_column: 2,\n\t\t\t\tfield: 'job_item_id',\n\t\t\t\tlayout_name: 'global_job_item',\n\t\t\t\tapi_class: ( Global.getProductEdition() >= 20 ) ? TTAPI.APIJobItem : null,\n\t\t\t\tmultiple: true,\n\t\t\t\tbasic_search: false,\n\t\t\t\tadv_search: ( this.show_job_item_ui && ( Global.getProductEdition() >= 20 ) ),\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._( 'Schedule Branch' ),\n\t\t\t\tin_column: 2,\n\t\t\t\tfield: '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: true,\n\t\t\t\tadv_search: true,\n\t\t\t\tscript_name: 'BranchView',\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._( 'Schedule Department' ),\n\t\t\t\tin_column: 2,\n\t\t\t\tfield: '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: true,\n\t\t\t\tadv_search: true,\n\t\t\t\tscript_name: 'DepartmentView',\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._( 'Schedule Policy' ),\n\t\t\t\tin_column: 2,\n\t\t\t\tfield: 'schedule_policy_id',\n\t\t\t\tlayout_name: 'global_schedule',\n\t\t\t\tapi_class: TTAPI.APISchedulePolicy,\n\t\t\t\tmultiple: true,\n\t\t\t\tbasic_search: true,\n\t\t\t\tadv_search: true,\n\t\t\t\tform_item_type: FormItemType.AWESOME_BOX\n\t\t\t} )\n\t\t];\n\t}\n\n\tonFormItemChange( target, doNotValidate ) {\n\t\tvar $this = this;\n\t\tthis.setIsChanged( target );\n\t\tthis.setMassEditingFieldsWhenFormChange( target );\n\n\t\tvar key = target.getField();\n\t\tvar c_value = target.getValue();\n\n\t\tthis.current_edit_record[key] = c_value;\n\n\t\tswitch ( key ) {\n\t\t\tcase 'job_id':\n\t\t\t\tif ( Global.getProductEdition() >= 20 ) {\n\t\t\t\t\tthis.edit_view_ui_dic['job_quick_search'].setValue( target.getValue( true ) ? ( target.getValue( true ).manual_id ? target.getValue( true ).manual_id : '' ) : '' );\n\t\t\t\t\tthis.setJobItemValueWhenJobChanged( target.getValue( true ), 'job_item_id', {\n\t\t\t\t\t\tstatus_id: 10,\n\t\t\t\t\t\tjob_id: this.current_edit_record.job_id\n\t\t\t\t\t} );\n\t\t\t\t\tthis.edit_view_ui_dic['job_quick_search'].setCheckBox( true );\n\t\t\t\t\tthis.setPunchTagValuesWhenCriteriaChanged( this.getPunchTagFilterData(), 'punch_tag_id' );\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 'job_item_id':\n\t\t\t\tif ( Global.getProductEdition() >= 20 ) {\n\t\t\t\t\tthis.edit_view_ui_dic['job_item_quick_search'].setValue( target.getValue( true ) ? ( target.getValue( true ).manual_id ? target.getValue( true ).manual_id : '' ) : '' );\n\t\t\t\t\tthis.edit_view_ui_dic['job_item_quick_search'].setCheckBox( true );\n\t\t\t\t\tthis.setPunchTagValuesWhenCriteriaChanged( this.getPunchTagFilterData(), 'punch_tag_id' );\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 'punch_tag_id':\n\t\t\t\tif ( Global.getProductEdition() >= 20 ) {\n\t\t\t\t\tif ( c_value !== TTUUID.zero_id && c_value !== false && c_value.length > 0 ) {\n\t\t\t\t\t\tthis.setPunchTagQuickSearchManualIds( target.getSelectItems() );\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis.edit_view_ui_dic['punch_tag_quick_search'].setValue( '' );\n\t\t\t\t\t}\n\t\t\t\t\t$this.previous_punch_tag_selection = c_value;\n\t\t\t\t\t//Reset source data to make sure correct punch tags are always shown.\n\t\t\t\t\tthis.edit_view_ui_dic['punch_tag_id'].setSourceData( null );\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 'branch_id':\n\t\t\t\tif ( Global.getProductEdition() >= 20 ) {\n\t\t\t\t\tthis.setPunchTagValuesWhenCriteriaChanged( this.getPunchTagFilterData(), 'punch_tag_id' );\n\t\t\t\t\tthis.setJobValueWhenCriteriaChanged( 'job_id', {\n\t\t\t\t\t\tstatus_id: 10,\n\t\t\t\t\t\tuser_id: this.current_edit_record.user_id,\n\t\t\t\t\t\tpunch_branch_id: this.current_edit_record.branch_id,\n\t\t\t\t\t\tpunch_department_id: this.current_edit_record.department_id\n\t\t\t\t\t} );\n\t\t\t\t\tthis.setDepartmentValueWhenBranchChanged( target.getValue( true ), 'department_id', {\n\t\t\t\t\t\tbranch_id: this.current_edit_record.branch_id,\n\t\t\t\t\t\tuser_id: this.current_edit_record.user_id\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 'department_id':\n\t\t\t\tif ( Global.getProductEdition() >= 20 ) {\n\t\t\t\t\tthis.setPunchTagValuesWhenCriteriaChanged( this.getPunchTagFilterData(), 'punch_tag_id' );\n\t\t\t\t\tthis.setJobValueWhenCriteriaChanged( 'job_id', {\n\t\t\t\t\t\tstatus_id: 10,\n\t\t\t\t\t\tuser_id: this.current_edit_record.user_id,\n\t\t\t\t\t\tpunch_branch_id: this.current_edit_record.branch_id,\n\t\t\t\t\t\tpunch_department_id: this.current_edit_record.department_id\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 'job_quick_search':\n\t\t\tcase 'job_item_quick_search':\n\t\t\t\tif ( Global.getProductEdition() >= 20 ) {\n\t\t\t\t\tthis.onJobQuickSearch( key, c_value );\n\t\t\t\t\tthis.setPunchTagValuesWhenCriteriaChanged( this.getPunchTagFilterData(), 'punch_tag_id' );\n\t\t\t\t\t//Don't validate immediately as onJobQuickSearch is doing async API calls, and it would cause a guaranteed validation failure.\n\t\t\t\t\tdoNotValidate = true;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 'punch_tag_quick_search':\n\t\t\t\tif ( Global.getProductEdition() >= 20 ) {\n\t\t\t\t\tthis.onPunchTagQuickSearch( c_value, this.getPunchTagFilterData(), 'punch_tag_id' );\n\n\t\t\t\t\t//Don't validate immediately as onPunchTagQuickSearch is doing async API calls, and it would cause a guaranteed validation failure.\n\t\t\t\t\tdoNotValidate = true;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 'absence_policy_id':\n\t\t\tcase 'status_id':\n\t\t\t\tthis.onStatusChange();\n\t\t\t\tbreak;\n\t\t\tcase 'user_id':\n\t\t\t\tthis.edit_view_ui_dic['absence_policy_id'].setSourceData( null );\n\t\t\t\tthis.edit_view_ui_dic['absence_policy_id'].setValue( false );\n\t\t\t\tthis.current_edit_record['absence_policy_id'] = false;\n\t\t\t\tthis.getAbsencePolicy( this.current_edit_record[key] );\n\n\t\t\t\tif ( $.isArray( this.current_edit_record[key] ) && this.current_edit_record[key].length > 1 ) {\n\t\t\t\t\tthis.is_mass_adding = true;\n\t\t\t\t} else {\n\t\t\t\t\tthis.is_mass_adding = false;\n\t\t\t\t}\n\t\t\t\tthis.setEditMenu();\n\n\t\t\t\tif ( Global.getProductEdition() >= 20 ) {\n\t\t\t\t\tthis.setPunchTagValuesWhenCriteriaChanged( this.getPunchTagFilterData(), 'punch_tag_id' )\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t}\n\n\t\tthis.getScheduleTotalTime();\n\t\tthis.getProjectedAbsencePolicyBalance();\n\n\t\tif ( !doNotValidate ) {\n\t\t\tthis.validate();\n\t\t}\n\t}\n\n\tgetProjectedAbsencePolicyBalance() {\n\t\t$( this.edit_view_form_item_dic['available_balance'].find( '.schedule-view-balance-info' ) ).css( 'display', 'none' );\n\n\t\tif ( this.current_edit_record['absence_policy_id'] && this.edit_view_form_item_dic['absence_policy_id'].css( 'display' ) === 'block' && !this.is_mass_editing ) {\n\t\t\tvar user_id;\n\t\t\tif ( Global.isArray( this.current_edit_record['user_id'] ) && this.current_edit_record['user_id'].length === 1 ) {\n\t\t\t\tuser_id = this.current_edit_record['user_id'][0];\n\t\t\t} else if ( this.current_edit_record['user_id'] ) {\n\t\t\t\tuser_id = this.current_edit_record['user_id'];\n\t\t\t} else {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tvar date_stamp = this.current_edit_record['date_stamp'];\n\t\t\tvar result_data = this.absence_policy_api.getProjectedAbsencePolicyBalance( this.current_edit_record['absence_policy_id'], user_id, date_stamp, this.total_time, this.pre_total_time, { async: false } );\n\n\t\t\tresult_data = result_data ? result_data : {\n\t\t\t\tavailable_balance: 0,\n\t\t\t\tcurrent_time: 0,\n\t\t\t\tremaining_balance: 0,\n\t\t\t\tprojected_balance: 0,\n\t\t\t\tprojected_remaining_balance: 0\n\t\t\t};\n\n\t\t\tthis.getBalanceHandler( result_data, date_stamp );\n\t\t}\n\t\tthis.onStatusChange();\n\t}\n\n\tgetAbsencePolicy( user_ids ) {\n\t\tvar args = { filter_data: {} };\n\t\targs.filter_data.user_id = user_ids;\n\t\tthis.edit_view_ui_dic['absence_policy_id'].setDefaultArgs( args );\n\t}\n\n\tuniformVariable( records ) {\n\t\tvar new_records = [];\n\t\tif ( Global.isArray( records.user_id ) && records.user_id.length > 0 ) {\n\t\t\tvar user_ids = records.user_id;\n\t\t\tfor ( var key in user_ids ) {\n\t\t\t\tvar tmp_records = Global.clone( records );\n\t\t\t\ttmp_records.user_id = user_ids[key];\n\t\t\t\tnew_records.push( tmp_records );\n\t\t\t}\n\t\t} else {\n\t\t\tnew_records.push( this.current_edit_record );\n\t\t}\n\n\t\tif ( this.current_edit_record.start_date_stamps && new_records.length > 0 ) {\n\t\t\t//Allowing multiple dates\n\t\t\tvar edit_record = [];\n\t\t\tfor ( var ur in new_records ) {\n\t\t\t\tvar dates = this.uniformDates( new_records[ur].start_date_stamps, new_records[ur] );\n\n\t\t\t\tif ( Array.isArray( new_records[ur].start_date_stamps ) ) {\n\t\t\t\t\tdates = new_records[ur].start_date_stamps;\n\t\t\t\t} else {\n\t\t\t\t\tdates = this.parserDatesRange( new_records[ur].start_date_stamps );\n\t\t\t\t}\n\n\t\t\t\tfor ( var d in dates ) {\n\t\t\t\t\tvar new_record = {};\n\t\t\t\t\tfor ( var er in new_records[ur] ) {\n\t\t\t\t\t\tif ( er == 'start_date_stamps' ) {\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tnew_record[er] = new_records[ur][er];\n\t\t\t\t\t}\n\t\t\t\t\tnew_record.start_date_stamp = dates[d];\n\t\t\t\t\tnew_record.date_stamp = dates[d];\n\t\t\t\t\tedit_record.push( new_record );\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tedit_record = this.current_edit_record;\n\t\t\tif ( $.isArray( edit_record.start_date_stamp ) && edit_record.start_date_stamp.length == 1 ) {\n\t\t\t\tedit_record.start_date_stamp = edit_record.start_date_stamp[0];\n\t\t\t}\n\t\t}\n\n\t\treturn edit_record;\n\t}\n\n\tparserDatesRange( date ) {\n\t\tvar dates = date.split( ' - ' );\n\t\tvar resultArray = [];\n\t\tvar beginDate = Global.strToDate( dates[0] );\n\t\tvar endDate = Global.strToDate( dates[1] );\n\n\t\tvar nextDate = beginDate;\n\n\t\twhile ( nextDate.getTime() < endDate.getTime() ) {\n\t\t\tresultArray.push( nextDate.format() );\n\t\t\tnextDate = new Date( new Date( nextDate.getTime() ).setDate( nextDate.getDate() + 1 ) );\n\t\t}\n\t\treturn dates;\n\t}\n\n\tuniformDates( date_range, record ) {\n\t\tvar dates = [];\n\t\tif ( !Array.isArray( date_range ) && date_range.indexOf( ' - ' ) == -1 ) {\n\t\t\tdates = [date_range];\n\t\t} else if ( Array.isArray( date_range ) ) {\n\t\t\tdates = date_range;\n\t\t} else {\n\t\t\tdates = this.parserDatesRange( date_range );\n\t\t}\n\n\t\treturn dates;\n\t}\n\n\tsetCurrentEditRecordData() {\n\t\tvar $this = this;\n\t\t// When mass editing, these fields may not be the common data, so their value will be undefined, so this will cause their change event cannot work properly.\n\t\tthis.setDefaultData( {\n\t\t\t'status_id': 10\n\t\t} );\n\n\t\tif ( this.current_edit_record.id || this.is_mass_editing ) {\n\t\t\tthis.edit_view_ui_dic.user_id.setAllowMultipleSelection( false );\n\t\t} else {\n\t\t\tthis.edit_view_ui_dic.user_id.setAllowMultipleSelection( true );\n\t\t}\n\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 ) || key === 'date_stamp' ) {\n\t\t\t\tswitch ( key ) {\n\t\t\t\t\tcase 'start_date_stamp':\n\t\t\t\t\tcase 'start_date_stamps':\n\t\t\t\t\t\tif ( !this.current_edit_record[key] ) {\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tvar date_array;\n\t\t\t\t\t\tif ( !this.current_edit_record.id ) {\n\t\t\t\t\t\t\tdate_array = this.current_edit_record.start_date_stamps;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tif ( Array.isArray( this.current_edit_record.start_date_stamp ) == false ) {\n\t\t\t\t\t\t\t\tdate_array = [this.current_edit_record.start_date_stamp];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tthis.current_edit_record.start_date_stamp = date_array;\n\t\t\t\t\t\twidget.setValue( date_array );\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'total_time':\n\t\t\t\t\t\tthis.pre_total_time = ( this.is_add ) ? 0 : this.current_edit_record[key];\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'job_id':\n\t\t\t\t\t\tif ( Global.getProductEdition() >= 20 ) {\n\t\t\t\t\t\t\tvar args = {};\n\t\t\t\t\t\t\targs.filter_data = {\n\t\t\t\t\t\t\t\tstatus_id: 10,\n\t\t\t\t\t\t\t\tuser_id: this.current_edit_record.user_id,\n\t\t\t\t\t\t\t\tpunch_branch_id: this.current_edit_record.branch_id,\n\t\t\t\t\t\t\t\tpunch_department_id: this.current_edit_record.department_id\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\twidget.setDefaultArgs( args );\n\t\t\t\t\t\t\twidget.setValue( this.current_edit_record[key] );\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'job_item_id':\n\t\t\t\t\t\tif ( Global.getProductEdition() >= 20 ) {\n\t\t\t\t\t\t\tvar args = {};\n\t\t\t\t\t\t\targs.filter_data = { status_id: 10, job_id: this.current_edit_record.job_id };\n\t\t\t\t\t\t\twidget.setDefaultArgs( args );\n\t\t\t\t\t\t\twidget.setValue( this.current_edit_record[key] );\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'punch_tag_id':\n\t\t\t\t\t\tif ( Global.getProductEdition() >= 20 ) {\n\t\t\t\t\t\t\twidget.setValue( this.current_edit_record[key] );\n\t\t\t\t\t\t\tthis.previous_punch_tag_selection = this.current_edit_record[key];\n\n\t\t\t\t\t\t\tvar args = {};\n\t\t\t\t\t\t\targs.filter_data = $this.getPunchTagFilterData();\n\t\t\t\t\t\t\twidget.setDefaultArgs( args );\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'branch_id':\n\t\t\t\t\t\tif ( Global.getProductEdition() >= 20 ) {\n\t\t\t\t\t\t\tvar args = {};\n\t\t\t\t\t\t\targs.filter_data = { user_id: this.current_edit_record.user_id };\n\t\t\t\t\t\t\twidget.setDefaultArgs( args );\n\t\t\t\t\t\t}\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\tcase 'department_id':\n\t\t\t\t\t\tif ( Global.getProductEdition() >= 20 ) {\n\t\t\t\t\t\t\tvar args = {};\n\t\t\t\t\t\t\targs.filter_data = { user_id: this.current_edit_record.user_id, branch_id: this.current_edit_record.branch_id };\n\t\t\t\t\t\t\twidget.setDefaultArgs( args );\n\t\t\t\t\t\t}\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\tcase 'punch_tag_quick_search':\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'user_id':\n\t\t\t\t\t\twidget.setValue( this.current_edit_record[key] );\n\t\t\t\t\t\tthis.getAbsencePolicy( this.current_edit_record[key] );\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'date_stamp':\n\t\t\t\t\t\tthis.current_edit_record['start_date_stamp'] = this.current_edit_record[key];\n\t\t\t\t\t\tthis.current_edit_record['start_date_stamps'] = this.current_edit_record[key];\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\n\t\tthis.collectUIDataToCurrentEditRecord();\n\t\tthis.setEditViewDataDone();\n\t}\n\n\tgetScheduleTotalTime() {\n\t\tif ( this.is_mass_editing ) {\n\t\t\treturn;\n\t\t}\n\n\t\tvar startTime, endTime, date_stamp;\n\t\tif ( this.current_edit_record['start_date_stamps'] ) {\n\t\t\tdate_stamp = this.uniformDates( this.current_edit_record['start_date_stamps'], this.current_edit_record )[0];\n\t\t} else {\n\t\t\tdate_stamp = this.current_edit_record['date_stamp'];\n\t\t}\n\n\t\tvar startTime = date_stamp + ' ' + this.current_edit_record['start_time'];\n\t\tvar endTime = date_stamp + ' ' + this.current_edit_record['end_time'];\n\t\tvar schedulePolicyId = ( this.current_edit_record['schedule_policy_id'] ) ? this.current_edit_record['schedule_policy_id'] : '';\n\n\t\tif ( !schedulePolicyId ) {\n\t\t\treturn;\n\t\t}\n\n\t\tvar user_id = this.current_edit_record.user_id;\n\n\t\tvar result = this.api.getScheduleTotalTime( startTime, endTime, schedulePolicyId, user_id, { async: false } );\n\t\tif ( result ) {\n\t\t\tthis.total_time = result.getResult();\n\n\t\t\tvar total_time = Global.getTimeUnit( this.total_time );\n\n\t\t\tthis.edit_view_ui_dic['total_time'].setValue( total_time );\n\n\t\t\tthis.current_edit_record['total_time'] = total_time;\n\t\t}\n\t}\n\n\tsetEditViewDataDone() {\n\t\tsuper.setEditViewDataDone();\n\t\tthis.onStatusChange();\n\t\tthis.getScheduleTotalTime();\n\t\tthis.setEditViewWidgetsMode();\n\t\tthis.getProjectedAbsencePolicyBalance();\n\t}\n\n\tonStatusChange() {\n\t\tif ( this.current_edit_record['status_id'] == 20 ) {\n\t\t\tthis.attachElement( 'absence_policy_id' );\n\t\t\tif ( this.current_edit_record['absence_policy_id'] && this.current_edit_record['absence_policy_id'] != TTUUID.zero_id ) {\n\t\t\t\tthis.attachElement( 'available_balance' );\n\t\t\t} else {\n\t\t\t\tthis.detachElement( 'available_balance' );\n\t\t\t}\n\t\t} else {\n\t\t\tthis.detachElement( 'absence_policy_id' );\n\t\t\tthis.detachElement( 'available_balance' );\n\t\t}\n\n\t\tthis.editFieldResize();\n\n\t}\n}\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMjUwOS5qcyIsIm1hcHBpbmdzIjoiOzs7Ozs7QUFBTztBQUNQLDJCQUEyQjtBQUMzQixFQUFFLENBQUM7QUFDSDs7O0FBR0E7O0FBRUE7O0FBRUE7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBOztBQUVB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