"use strict";(self.webpackChunktimetrex=self.webpackChunktimetrex||[]).push([["my_account-request_authorization-RequestAuthorizationViewController"],{5396:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"RequestAuthorizationViewController\": () => (/* binding */ RequestAuthorizationViewController)\n/* harmony export */ });\n/* provided dependency */ var _ = __webpack_require__(9050);\n/* provided dependency */ var $ = __webpack_require__(9755);\nclass RequestAuthorizationViewController extends RequestViewCommonController {\n\tconstructor( options = {} ) {\n\t\t_.defaults( options, {\n\t\t\tel: '#request_authorization_view_container',\n\n\t\t\ttype_array: null,\n\t\t\toverlap_type_array: null,\n\t\t\thierarchy_level_array: null,\n\n\t\t\tmessages: null,\n\n\t\t\tauthorization_api: null,\n\t\t\tapi_request: null,\n\t\t\tapi_absence_policy: null,\n\t\t\tmessage_control_api: null,\n\t\t\tschedule_api: null,\n\n\t\t\tpunch_tag_api: null,\n\t\t\tdefault_punch_tag: [],\n\t\t\tprevious_punch_tag_selection: [],\n\n\t\t\tauthorization_history_columns: [],\n\n\t\t\tauthorization_history_default_display_columns: [],\n\n\t\t\tauthorization_history_grid: null,\n\t\t\tpre_request_schedule: true,\n\n\t\t\toverlapping_shift_data: {},\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 = 'RequestAuthorizationEditView.html';\n\t\tthis.permission_id = 'request';\n\t\tthis.viewId = 'RequestAuthorization';\n\t\tthis.script_name = 'RequestAuthorizationView';\n\t\tthis.table_name_key = 'request';\n\t\tthis.context_menu_name = $.i18n._( 'Request (Authorizations)' );\n\t\tthis.navigation_label = $.i18n._( 'Requests' );\n\t\tthis.api = TTAPI.APIRequest;\n\t\tthis.authorization_api = TTAPI.APIAuthorization;\n\t\tthis.api_request = TTAPI.APIRequest;\n\t\tthis.api_absence_policy = TTAPI.APIAbsencePolicy;\n\t\tthis.message_control_api = TTAPI.APIMessageControl;\n\n\t\tif( ( Global.getProductEdition() >= 15 ) ) {\n\t\t\tthis.schedule_api = TTAPI.APISchedule;\n\t\t}\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}\n\t\tthis.message_control_api = TTAPI.APIMessageControl;\n\t\tthis.event_bus = new TTEventBus({ view_id: this.viewId });\n\n\t\tthis.initPermission();\n\t\tthis.render();\n\n\t\tthis.buildContextMenu( true );\n\n\t\tthis.initData();\n\t}\n\n\tinitOptions() {\n\t\tvar $this = this;\n\n\t\tvar options = [\n\t\t\t{ option_name: 'type', api: this.api }\n\t\t];\n\n\t\tif ( ( Global.getProductEdition() >= 15 ) ) {\n\t\t\toptions.push( { option_name: 'overlap_type', api: TTAPI.APIRequestSchedule } );\n\t\t}\n\n\t\tthis.initDropDownOptions( options );\n\n\t\tvar res = this.api.getHierarchyLevelOptions( [-1], { async: false } );\n\t\tvar data = res.getResult();\n\t\t$this['hierarchy_level_array'] = Global.buildRecordArray( data );\n\t\tif ( Global.isSet( $this.basic_search_field_ui_dic['hierarchy_level'] ) ) {\n\t\t\t$this.basic_search_field_ui_dic['hierarchy_level'].setSourceData( Global.buildRecordArray( data ) );\n\t\t}\n\t}\n\n\tinitPermission() {\n\t\tsuper.initPermission();\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\n\t\t// Error: Uncaught TypeError: (intermediate value).isBranchAndDepartmentAndJobAndJobItemAndPunchTagEnabled is not a function on line 207\n\t\tvar company_api = TTAPI.APICompany;\n\t\tif ( company_api && _.isFunction( company_api.isBranchAndDepartmentAndJobAndJobItemAndPunchTagEnabled ) ) {\n\t\t\tvar result = company_api.isBranchAndDepartmentAndJobAndJobItemAndPunchTagEnabled( { async: false } ).getResult();\n\t\t}\n\n\t\tif ( !result ) {\n\t\t\tthis.show_branch_ui = false;\n\t\t\tthis.show_department_ui = false;\n\t\t\tthis.show_job_ui = false;\n\t\t\tthis.show_job_item_ui = false;\n\t\t\tthis.show_punch_tag_ui = false;\n\t\t} else {\n\t\t\tif ( !result.branch ) {\n\t\t\t\tthis.show_branch_ui = false;\n\t\t\t}\n\n\t\t\tif ( !result.department ) {\n\t\t\t\tthis.show_department_ui = false;\n\t\t\t}\n\n\t\t\tif ( !result.job ) {\n\t\t\t\tthis.show_job_ui = false;\n\t\t\t}\n\n\t\t\tif ( !result.job_item ) {\n\t\t\t\tthis.show_job_item_ui = false;\n\t\t\t}\n\n\t\t\tif ( !result.punch_tag ) {\n\t\t\t\tthis.show_punch_tag_ui = false;\n\t\t\t}\n\t\t}\n\t}\n\n\tgetCustomContextMenuModel() {\n\t\tvar context_menu_model = {\n\t\t\tgroups: {\n\t\t\t\taction: {\n\t\t\t\t\tlabel: $.i18n._( 'Action' ),\n\t\t\t\t\tid: this.script_name + 'action'\n\t\t\t\t},\n\t\t\t\tauthorization: {\n\t\t\t\t\tlabel: $.i18n._( 'Authorization' ),\n\t\t\t\t\tid: this.script_name + 'authorization'\n\t\t\t\t},\n\t\t\t\tobjects: {\n\t\t\t\t\tlabel: $.i18n._( 'Objects' ),\n\t\t\t\t\tid: this.script_name + 'objects'\n\t\t\t\t}\n\t\t\t},\n\t\t\texclude: ['default'],\n\t\t\tinclude: [\n\t\t\t\t{\n\t\t\t\t\tlabel: $.i18n._( 'View' ),\n\t\t\t\t\tid: 'view',\n\t\t\t\t\tgroup: 'action',\n\t\t\t\t\tvue_icon: 'tticon tticon-visibility_black_24dp',\n\t\t\t\t\tshow_on_right_click: true,\n\t\t\t\t\tsort_order: 1011\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: $.i18n._( 'Reply' ),\n\t\t\t\t\tid: 'edit',\n\t\t\t\t\tgroup: 'action',\n\t\t\t\t\tvue_icon: 'tticon tticon-reply_black_24dp',\n\t\t\t\t\tsort_order: 1021\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: $.i18n._( 'Send' ),\n\t\t\t\t\tid: 'send',\n\t\t\t\t\tgroup: 'action',\n\t\t\t\t\tvue_icon: 'tticon tticon-send_black_24dp',\n\t\t\t\t\tsort_order: 1031\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: $.i18n._( 'Cancel' ),\n\t\t\t\t\tid: 'cancel',\n\t\t\t\t\tgroup: 'action',\n\t\t\t\t\tsort_order: 1131\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: $.i18n._( 'Authorize' ),\n\t\t\t\t\tid: 'authorization',\n\t\t\t\t\tvue_icon: 'tticon tticon-thumb_up_black_24dp',\n\t\t\t\t\tmenu_align: 'center'\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: $.i18n._( 'Pass' ),\n\t\t\t\t\tid: 'pass',\n\t\t\t\t\tvue_icon: 'tticon tticon-redo_black_24dp',\n\t\t\t\t\tmenu_align: 'center'\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: $.i18n._( 'Decline' ),\n\t\t\t\t\tid: 'decline',\n\t\t\t\t\tvue_icon: 'tticon tticon-thumb_down_black_24dp',\n\t\t\t\t\tmenu_align: 'center'\n\t\t\t\t},\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\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: $.i18n._( 'Schedule' ),\n\t\t\t\t\tid: 'schedule',\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\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: $.i18n._( 'Export' ),\n\t\t\t\t\tid: 'export_excel',\n\t\t\t\t\tgroup: 'other',\n\t\t\t\t\tvue_icon: 'tticon tticon-file_upload_black_24dp',\n\t\t\t\t\tmenu_align: 'right'\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: $.i18n._( 'Edit Employee' ),\n\t\t\t\t\tid: 'edit_employee',\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\t},\n\t\t\t]\n\t\t};\n\n\t\treturn context_menu_model;\n\t}\n\n\tsetCustomDefaultMenuIcon( id, context_btn, grid_selected_length ) {\n\t\tswitch ( id ) {\n\t\t\tcase 'send':\n\t\t\t\tthis.setDefaultMenuSaveIcon( context_btn, grid_selected_length );\n\t\t\t\tbreak;\n\t\t\tcase 'authorization':\n\t\t\t\tthis.setDefaultMenuAuthorizationIcon( context_btn, grid_selected_length );\n\t\t\t\tbreak;\n\t\t\tcase 'pass':\n\t\t\t\tthis.setDefaultMenuPassIcon( context_btn, grid_selected_length );\n\t\t\t\tbreak;\n\t\t\tcase 'decline':\n\t\t\t\tthis.setDefaultMenuDeclineIcon( context_btn, grid_selected_length );\n\t\t\t\tbreak;\n\t\t\tcase 'authorization_request':\n\t\t\t\tthis.setDefaultMenuAuthorizationRequestIcon( context_btn, grid_selected_length );\n\t\t\t\tbreak;\n\t\t\tcase 'authorization_timesheet':\n\t\t\t\tthis.setDefaultMenuAuthorizationTimesheetIcon( context_btn, grid_selected_length );\n\t\t\t\tbreak;\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\tcase 'schedule':\n\t\t\t\tthis.setDefaultMenuViewIcon( context_btn, grid_selected_length, 'schedule' );\n\t\t\t\tbreak;\n\t\t\tcase 'edit_employee':\n\t\t\t\tthis.setDefaultMenuEditEmployeeIcon( context_btn, grid_selected_length );\n\t\t\t\tbreak;\n\t\t\tcase 'authorization_expense':\n\t\t\t\tthis.setDefaultMenuAuthorizationExpenseIcon( context_btn, grid_selected_length );\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\tsetDefaultMenuAuthorizationExpenseIcon( context_btn, grid_selected_length ) {\n\n\t\tif ( !( Global.getProductEdition() >= 25 ) ) {\n\t\t\tContextMenuManager.hideMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, false )\n\t\t}\n\n\t\tContextMenuManager.disableMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, true );\n\t}\n\n\tsetCustomEditMenuIcon( id, context_btn ) {\n\t\tswitch ( id ) {\n\t\t\tcase 'send':\n\t\t\t\tthis.setEditMenuSaveIcon( context_btn );\n\t\t\t\tbreak;\n\t\t\tcase 'authorization':\n\t\t\t\tthis.setEditMenuAuthorizationIcon( context_btn );\n\t\t\t\tbreak;\n\t\t\tcase 'pass':\n\t\t\t\tthis.setEditMenuPassIcon( context_btn );\n\t\t\t\tbreak;\n\t\t\tcase 'decline':\n\t\t\t\tthis.setEditMenuDeclineIcon( context_btn );\n\t\t\t\tbreak;\n\t\t\tcase 'authorization_request':\n\t\t\t\tthis.setEditMenuAuthorizationRequestIcon( context_btn );\n\t\t\t\tbreak;\n\t\t\tcase 'authorization_timesheet':\n\t\t\t\tthis.setEditMenuAuthorizationTimesheetIcon( context_btn );\n\t\t\t\tbreak;\n\t\t\tcase 'timesheet':\n\t\t\t\tthis.setEditMenuNavViewIcon( context_btn, 'punch' );\n\t\t\t\tbreak;\n\t\t\tcase 'schedule':\n\t\t\t\tthis.setEditMenuNavViewIcon( context_btn, 'schedule' );\n\t\t\t\tbreak;\n\t\t\tcase 'edit_employee':\n\t\t\t\tthis.setEditMenuNavEditIcon( context_btn, 'user' );\n\t\t\t\tbreak;\n\t\t\tcase 'authorization_expense':\n\t\t\t\tthis.setEditMenuAuthorizationExpenseIcon( context_btn );\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\tsetEditMenuAuthorizationExpenseIcon( context_btn ) {\n\t\tif ( !this.current_edit_record || !this.current_edit_record.id ) {\n\t\t\tContextMenuManager.disableMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, false );\n\t\t} else {\n\t\t\tContextMenuManager.disableMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, true );\n\t\t}\n\t}\n\n\tonCustomContextClick( id ) {\n\t\tswitch ( id ) {\n\t\t\tcase 'send':\n\t\t\t\tthis.onSaveClick();\n\t\t\t\tbreak;\n\t\t\tcase 'authorization':\n\t\t\t\tthis.onAuthorizationClick();\n\t\t\t\tbreak;\n\t\t\tcase 'pass':\n\t\t\t\tthis.onPassClick();\n\t\t\t\tbreak;\n\t\t\tcase 'decline':\n\t\t\t\tthis.onDeclineClick();\n\t\t\t\tbreak;\n\t\t\tcase 'authorization_request':\n\t\t\t\tthis.onAuthorizationRequestClick();\n\t\t\t\tbreak;\n\t\t\tcase 'authorization_timesheet':\n\t\t\t\tthis.onAuthorizationTimesheetClick();\n\t\t\t\tbreak;\n\t\t\tcase 'authorization_expense':\n\t\t\t\tthis.onAuthorizationExpenseClick();\n\t\t\t\tbreak;\n\t\t\tcase 'timesheet':\n\t\t\tcase 'schedule':\n\t\t\tcase 'edit_employee':\n\t\t\t\tthis.onNavigationClick( id );\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\tonViewclick() {\n\t\tsuper.onViewclick();\n\t\tAuthorizationHistory.init( this );\n\t}\n\n\tonAuthorizationExpenseClick() {\n\t\tIndexViewController.goToView( 'ExpenseAuthorization' );\n\t}\n\n\tonSaveClick( ignoreWarning ) {\n\t\tif ( !Global.isSet( ignoreWarning ) ) {\n\t\t\tignoreWarning = false;\n\t\t}\n\t\tif ( this.is_edit ) {\n\n\t\t\tvar $this = this;\n\t\t\tvar record;\n\t\t\tthis.is_add = false;\n\n\t\t\trecord = this.current_edit_record;\n\n\t\t\trecord = this.uniformVariable( record );\n\n\t\t\tEmbeddedMessage.reply( record, ignoreWarning, function( result ) {\n\t\t\t\tif ( result.isValid() ) {\n\t\t\t\t\tvar id = $this.current_edit_record.id;\n\n\t\t\t\t\t//see #2224 - Unable to get property 'find' of undefined\n\t\t\t\t\t$this.removeEditView();\n\t\t\t\t\t$this.onViewClick( id );\n\t\t\t\t} else {\n\t\t\t\t\t$this.setErrorTips( result );\n\t\t\t\t\t$this.setErrorMenu();\n\t\t\t\t}\n\t\t\t} );\n\t\t}\n\t}\n\n\tonAuthorizationClick( ignoreWarning ) {\n\t\tvar $this = this;\n\n\t\tif ( !Global.isSet( ignoreWarning ) ) {\n\t\t\tignoreWarning = false;\n\t\t}\n\n\t\t//Error: TypeError: $this.current_edit_record is null in /interface/html5/framework/jquery.min.js?v=7.4.6-20141027-074127 line 2 > eval line 629\n\t\tif ( !$this.current_edit_record ) {\n\t\t\treturn;\n\t\t}\n\n\t\tvar request_data;\n\t\tif ( Global.getProductEdition() >= 15 && ( this.current_edit_record.type_id == 30 || this.current_edit_record.type_id == 40 ) ) {\n\t\t\trequest_data = $this.buildDataForAPI( this.current_edit_record );\n\t\t} else {\n\t\t\trequest_data = this.getSelectedItem();\n\t\t}\n\n\t\tLocalCacheData.current_doing_context_action = 'authorize';\n\n\t\t//Check if Edit permissions exist, if not, only authorize the request to avoid a API permission error.\n\t\tif ( this.enable_edit_view_ui == true ) {\n\t\t\t$this.api_request['setRequest']( request_data, false, ignoreWarning, {\n\t\t\t\tonResult: function( res ) {\n\t\t\t\t\tif ( res.getResult() != false ) {\n\t\t\t\t\t\tauthorizeRequest();\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$this.setErrorMenu();\n\t\t\t\t\t\t$this.setErrorTips( res, true );\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t} );\n\t\t} else {\n\t\t\tauthorizeRequest();\n\t\t}\n\n\t\tfunction authorizeRequest() {\n\t\t\tif ( $this.current_edit_record ) {\n\t\t\t\tvar filter = {};\n\t\t\t\tfilter.authorized = true;\n\t\t\t\tfilter.object_id = $this.current_edit_record.id;\n\t\t\t\tfilter.object_type_id = $this.current_edit_record.hierarchy_type_id;\n\n\t\t\t\t$this.authorization_api['setAuthorization']( [filter], {\n\t\t\t\t\tonResult: function( result ) {\n\t\t\t\t\t\tvar retval = result.getResult();\n\t\t\t\t\t\tif ( retval != false ) {\n\t\t\t\t\t\t\t$this.is_changed = false;\n\t\t\t\t\t\t\t$this.updateBadgeCount();\n\t\t\t\t\t\t\t$this.onRightArrowClick( function() {\n\t\t\t\t\t\t\t\t// Note: if side effects occur here, previously the search(false) function was accidentally called as a evaluated param (run each time, parallel), rather than callback (run at the end, on last record)\n\t\t\t\t\t\t\t\t$this.search( false );\n\t\t\t\t\t\t\t\t$().TFeedback( {\n\t\t\t\t\t\t\t\t\tsource: 'Authorize'\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t$this.setErrorMenu();\n\t\t\t\t\t\t\t$this.setErrorTips( result, true );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t}\n\t\t}\n\t}\n\n\tonPassClick() {\n\t\tvar $this = this;\n\n\t\tfunction doNext() {\n\t\t\t$this.onRightArrowClick( function() {\n\t\t\t\t$this.search();\n\t\t\t\t$().TFeedback( {\n\t\t\t\t\tsource: 'Pass'\n\t\t\t\t} );\n\t\t\t} );\n\t\t}\n\n\t\tif ( this.is_changed ) {\n\t\t\tTAlertManager.showConfirmAlert( Global.modify_alert_message, null, function( flag ) {\n\t\t\t\tif ( flag === true ) {\n\t\t\t\t\tdoNext();\n\t\t\t\t}\n\t\t\t} );\n\t\t} else {\n\t\t\tdoNext();\n\t\t}\n\t}\n\n\tonAuthorizationRequestClick() {\n\t\tthis.search( false );\n\t}\n\n\tonDeclineClick() {\n\t\tvar $this = this;\n\n\t\tfunction doNext() {\n\t\t\tvar filter = {};\n\n\t\t\tfilter.authorized = false;\n\t\t\tfilter.object_id = $this.current_edit_record.id;\n\t\t\tfilter.object_type_id = $this.current_edit_record.hierarchy_type_id;\n\n\t\t\t$this.authorization_api['setAuthorization']( [filter], {\n\t\t\t\tonResult: function( res ) {\n\t\t\t\t\t$this.updateBadgeCount();\n\t\t\t\t\t$this.onRightArrowClick( function() {\n\t\t\t\t\t\t$this.search( false );\n\t\t\t\t\t\t$().TFeedback( {\n\t\t\t\t\t\t\tsource: 'Decline'\n\t\t\t\t\t\t} );\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t} );\n\t\t}\n\n\t\tif ( this.is_changed ) {\n\t\t\tTAlertManager.showConfirmAlert( Global.modify_alert_message, null, function( flag ) {\n\t\t\t\tif ( flag === true ) {\n\t\t\t\t\tdoNext();\n\t\t\t\t}\n\t\t\t} );\n\t\t} else {\n\t\t\tdoNext();\n\t\t}\n\t}\n\n\tonAuthorizationTimesheetClick() {\n\t\tIndexViewController.goToView( 'TimeSheetAuthorization' );\n\t}\n\n\tuniformVariable( records ) {\n\t\tif ( this.is_edit ) {\n\t\t\treturn this.uniformMessageVariable( records );\n\t\t}\n\t\treturn records;\n\t}\n\n\tonGridDblClickRow() {\n\n\t\tProgressBar.showOverlay();\n\t\tthis.onViewClick();\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\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\t$this.search();\n\t\t\t}\n\n\t\t\t$this.onSaveDone( result );\n\n\t\t\tif ( $this.is_edit ) {\n\t\t\t\t$this.onViewClick( $this.current_edit_record.id );\n\t\t\t} else {\n\n\t\t\t\t$this.removeEditView();\n\t\t\t}\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\tsetEditMenuAuthorizationIcon( context_btn ) {\n\t\tif ( this.is_edit ) {\n\t\t\tContextMenuManager.disableMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, false );\n\t\t} else {\n\t\t\tContextMenuManager.disableMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, true );\n\t\t}\n\t}\n\n\tsetEditMenuPassIcon( context_btn ) {\n\t\tif ( this.is_edit ) {\n\t\t\tContextMenuManager.disableMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, false );\n\t\t} else {\n\t\t\tContextMenuManager.disableMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, true );\n\t\t}\n\t}\n\n\tsetEditMenuDeclineIcon( context_btn ) {\n\t\tif ( this.is_edit ) {\n\t\t\tContextMenuManager.disableMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, false );\n\t\t} else {\n\t\t\tContextMenuManager.disableMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, true );\n\t\t}\n\t}\n\n\tsetEditMenuAuthorizationRequestIcon( context_btn ) {\n\t\tif ( !this.current_edit_record || !this.current_edit_record.id ) {\n\t\t\tContextMenuManager.disableMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, false );\n\t\t} else {\n\t\t\tContextMenuManager.disableMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, true );\n\t\t}\n\t}\n\n\tsetEditMenuAuthorizationTimesheetIcon( context_btn ) {\n\t\tif ( !this.current_edit_record || !this.current_edit_record.id ) {\n\t\t\tContextMenuManager.disableMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, false );\n\t\t} else {\n\t\t\tContextMenuManager.disableMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, true );\n\t\t}\n\t}\n\n\tsetEditMenuSaveIcon( context_btn ) {\n\t\tif ( this.is_edit ) {\n\t\t\tContextMenuManager.disableMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, true );\n\t\t} else {\n\t\t\tContextMenuManager.hideMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, false );\n\t\t}\n\t}\n\n\tsetDefaultMenuSaveIcon( context_btn, grid_selected_length ) {\n\t\tContextMenuManager.hideMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, false )\n\t\tContextMenuManager.disableMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, false );\n\t}\n\n\tsetDefaultMenuEditIcon( context_btn, grid_selected_length ) {\n\t\tContextMenuManager.disableMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, false );\n\t}\n\n\tsetDefaultMenuEditEmployeeIcon( context_btn, grid_selected_length ) {\n\t\tif ( !this.editPermissionValidate( 'user' ) ) {\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\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\tsetDefaultMenuAuthorizationIcon( context_btn, grid_selected_length ) {\n\t\tif ( !this.is_viewing ) {\n\t\t\tContextMenuManager.hideMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, false );\n\t\t}\n\n\t\tContextMenuManager.disableMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, false );\n\t}\n\n\tsetDefaultMenuPassIcon( context_btn, grid_selected_length ) {\n\t\tif ( !this.is_viewing ) {\n\t\t\tContextMenuManager.hideMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, false );\n\t\t}\n\n\t\tContextMenuManager.disableMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, false );\n\t}\n\n\tsetDefaultMenuDeclineIcon( context_btn, grid_selected_length ) {\n\t\tif ( !this.is_viewing ) {\n\t\t\tContextMenuManager.hideMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, false );\n\t\t}\n\n\t\tContextMenuManager.disableMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, false );\n\t}\n\n\tsetDefaultMenuAuthorizationRequestIcon( context_btn, grid_selected_length ) {\n\t\tContextMenuManager.disableMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, true );\n\t}\n\n\tsetDefaultMenuAuthorizationTimesheetIcon( context_btn, grid_selected_length ) {\n\t\tContextMenuManager.disableMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, true );\n\t}\n\n\tbuildSearchFields() {\n\n\t\tsuper.buildSearchFields();\n\t\tthis.search_fields = [\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\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\tmultiple: true,\n\t\t\t\tfield: 'type_id',\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._( 'Start Date' ),\n\t\t\t\tin_column: 1,\n\t\t\t\tfield: 'start_date',\n\t\t\t\tbasic_search: true,\n\t\t\t\tadv_search: false,\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._( 'End Date' ),\n\t\t\t\tin_column: 1,\n\t\t\t\tfield: 'end_date',\n\t\t\t\tbasic_search: true,\n\t\t\t\tadv_search: false,\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._( 'Hierarchy Level' ),\n\t\t\t\tin_column: 2,\n\t\t\t\tmultiple: false,\n\t\t\t\tfield: 'hierarchy_level',\n\t\t\t\tbasic_search: true,\n\t\t\t\tadv_search: false,\n\t\t\t\tset_any: 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._( '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: 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._( '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: true,\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\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\tthis.current_edit_record[key] = c_value;\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\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 'user_id':\n\t\t\tcase 'branch_id':\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}\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, 'job_id', 'job_item_id' );\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_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 'type_id':\n\t\t\t\tthis.onTypeChanged();\n\t\t\t\tbreak;\n\t\t\tcase 'overlap_type_id':\n\t\t\t\tif ( ( Global.getProductEdition() >= 15 ) ) {\n\t\t\t\t\tthis.getOverlappingShifts();\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 'date_stamp':\n\t\t\t\tthis.onDateStampChanged();\n\t\t\t\tbreak;\n\t\t\tcase 'request_schedule_status_id':\n\t\t\t\tthis.onWorkingStatusChanged();\n\t\t\t\tbreak;\n\t\t\tcase 'start_date':\n\t\t\t\t$this.getScheduleTotalTime();\n\t\t\t\t$this.onStartDateChanged();\n\t\t\t\t$this.current_edit_record.start_date = $this.edit_view_ui_dic.start_date.getValue();\n\t\t\t\t$this.current_edit_record.date_stamp = $this.edit_view_ui_dic.start_date.getValue();\n\t\t\t\tif ( $this.edit_view_ui_dic.date_stamp ) {\n\t\t\t\t\t$this.edit_view_ui_dic.date_stamp.setValue( $this.edit_view_ui_dic.start_date.getValue() );\n\t\t\t\t}\n\t\t\t\tif ( ( Global.getProductEdition() >= 15 ) ) {\n\t\t\t\t\t$this.getOverlappingShifts();\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 'end_date':\n\t\t\t\t$this.getScheduleTotalTime();\n\t\t\t\t$this.current_edit_record.end_date = $this.edit_view_ui_dic.end_date.getValue();\n\t\t\t\tif ( ( Global.getProductEdition() >= 15 ) ) {\n\t\t\t\t\t$this.getOverlappingShifts();\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 'sun':\n\t\t\tcase 'mon':\n\t\t\tcase 'tue':\n\t\t\tcase 'wed':\n\t\t\tcase 'thu':\n\t\t\tcase 'fri':\n\t\t\tcase 'sat':\n\t\t\t\t$this.getScheduleTotalTime();\n\t\t\t\tif ( ( Global.getProductEdition() >= 15 ) ) {\n\t\t\t\t\tthis.getOverlappingShifts();\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 'start_time':\n\t\t\tcase 'end_time':\n\t\t\tcase 'schedule_policy_id':\n\t\t\t\tif ( ( Global.getProductEdition() >= 15 ) ) {\n\t\t\t\t\tthis.getOverlappingShifts();\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase'absence_policy_id':\n\t\t\t\tthis.selected_absence_policy_record = this.edit_view_ui_dic.absence_policy_id.getValue();\n\t\t\t\tthis.getAvailableBalance();\n\t\t\t\tbreak;\n\t\t\tcase 'is_replace_with_open_shift':\n\t\t\t\tif ( ( Global.getProductEdition() >= 15 ) ) {\n\t\t\t\t\tthis.getOverlappingShifts();\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t}\n\n\t\tif ( key === 'date_stamp' ||\n\t\t\tkey === 'start_date_stamps' ||\n\t\t\tkey === 'start_date_stamp' ||\n\t\t\tkey === 'start_time' ||\n\t\t\tkey === 'end_time' ||\n\t\t\tkey === 'schedule_policy_id' ||\n\t\t\tkey === 'absence_policy_id' ) {\n\n\t\t\tif ( this.current_edit_record['date_stamp'] !== '' &&\n\t\t\t\tthis.current_edit_record['start_time'] !== '' &&\n\t\t\t\tthis.current_edit_record['end_time'] !== '' ) {\n\n\t\t\t\tthis.getScheduleTotalTime();\n\n\t\t\t} else {\n\t\t\t\tthis.onAvailableBalanceChange();\n\t\t\t}\n\n\t\t}\n\n\t\tif ( !doNotValidate ) {\n\t\t\tthis.validate();\n\t\t}\n\t}\n\n\t//set widget disablebility if view mode or edit mode\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 ( Global.isSet( widget.setEnabled ) ) {\n\t\t\t\twidget.setEnabled( this.enable_edit_view_ui );\n\t\t\t}\n\t\t}\n\t}\n\n\tonAvailableBalanceChange() {\n\t\tthis.getAvailableBalance();\n\t}\n\n\tsetURL() {\n\n\t\tif ( LocalCacheData.current_doing_context_action === 'edit' ) {\n\t\t\tLocalCacheData.current_doing_context_action = '';\n\t\t\treturn;\n\t\t}\n\n\t\tsuper.setURL();\n\t}\n\n\tgetSubViewFilter( filter ) {\n\t\tif ( filter.length === 0 ) {\n\t\t\tfilter = {};\n\t\t}\n\n\t\tif ( !Global.isSet( filter.type_id ) ) {\n\t\t\tfilter['type_id'] = [-1];\n\t\t}\n\n\t\tif ( !Global.isSet( filter.hierarchy_level ) ) {\n\t\t\tfilter['hierarchy_level'] = 1;\n\t\t\tthis.filter_data['hierarchy_level'] = {\n\t\t\t\tfield: 'hierarchy_level',\n\t\t\t\tid: '',\n\t\t\t\tvalue: this.basic_search_field_ui_dic['hierarchy_level'].getValue( true )\n\t\t\t};\n\t\t}\n\n\t\treturn filter;\n\t}\n\n\tbuildEditViewUI() {\n\t\tsuper.buildEditViewUI();\n\n\t\tvar tab_model = {\n\t\t\t'tab_request': { 'label': $.i18n._( 'Message' ) },\n\t\t\t'tab_audit': true,\n\t\t};\n\t\tthis.setTabModel( tab_model );\n\n\t\t//This hides the audit tab as this view is always used for creating/replying to an existing request.\n\t\t//For some reason removing 'tab_audit' from the model above results in a blank tab appearing.\n\t\tvar tab_audit_label = this.edit_view.find( 'a[ref=tab_audit]' );\n\t\ttab_audit_label.css( 'display', 'none' );\n\n\t\t//Tab 0 start\n\n\t\tvar tab_request = this.edit_view_tab.find( '#tab_request' );\n\n\t\tvar tab_request_column1 = tab_request.find( '.first-column' );\n\n\t\tvar tab_request_column2 = tab_request.find( '.second-column' );\n\n\t\tthis.edit_view_tabs[0] = [];\n\n\t\tthis.edit_view_tabs[0].push( tab_request_column1 );\n\n\t\t// Subject\n\t\tvar form_item_input = Global.loadWidgetByName( FormItemType.TEXT_INPUT );\n\n\t\tform_item_input.TTextInput( { field: 'subject', width: 359 } );\n\t\tthis.addEditFieldToColumn( $.i18n._( 'Subject' ), form_item_input, tab_request_column1, '' );\n\n\t\t// Body\n\t\tform_item_input = Global.loadWidgetByName( FormItemType.TEXT_AREA );\n\n\t\tform_item_input.TTextArea( { field: 'body', width: 600, height: 400 } );\n\n\t\tthis.addEditFieldToColumn( $.i18n._( 'Body' ), form_item_input, tab_request_column1, '', null, null, true );\n\n\t\ttab_request_column2.css( 'display', 'none' );\n\t}\n\n\tsearch( set_default_menu, page_action, page_number, callBack ) {\n\t\tthis.refresh_id = null;\n\t\tthis.updateBadgeCount();\n\t\tsuper.search( set_default_menu, page_action, page_number, callBack );\n\t}\n\n\tupdateBadgeCount() {\n\t\tthis.event_bus.emit( 'tt_topbar', 'profile_pending_counts', { //Update all \"My Profile\" badges.\n\t\t\tobject_types: [ 'notification', 'request_authorization' ]\n\t\t} );\n\t}\n\n\tsetCurrentEditRecordData() {\n\t\tvar $this = this;\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\twidget.setValue( this.current_edit_record['first_name'] + ' ' + this.current_edit_record['last_name'] );\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'subject':\n\t\t\t\t\t\twidget.setValue( this.current_edit_record[key] );\n\t\t\t\t\t\tif ( this.is_edit ) {\n\t\t\t\t\t\t\twidget.setValue( 'Re: ' + this.messages[0].subject );\n\t\t\t\t\t\t}\n\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 'punch_tag_quick_search':\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.setEditViewDataDone();\n\t}\n\n\tsetEditViewDataDone() {\n\t\tvar $this = this;\n\t\tsuper.setEditViewDataDone();\n\t\tif ( !this.is_viewing ) {\n\t\t\tif ( Global.isSet( $this.messages ) ) {\n\t\t\t\t$this.messages = null;\n\t\t\t}\n\t\t}\n\n\t\tif ( ( Global.getProductEdition() >= 15 ) ) {\n\t\t\t$this.getOverlappingShifts();\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\n\t\tvar record = {};\n\n\t\tif ( this.is_edit ) {\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.buildDataForAPI( this.current_edit_record );\n\t\t}\n\n\t\trecord = this.uniformVariable( record );\n\t\tif ( this.is_edit ) {\n\t\t\tthis.message_control_api['validate' + this.message_control_api.key_name]( record, {\n\t\t\t\tonResult: function( result ) {\n\t\t\t\t\t$this.validateResult( result );\n\t\t\t\t}\n\t\t\t} );\n\t\t} else if ( this.is_viewing ) {\n\t\t\tthis.api_request['validate' + this.api.key_name]( record, {\n\t\t\t\tonResult: function( result ) {\n\t\t\t\t\t$this.validateResult( result );\n\t\t\t\t}\n\t\t\t} );\n\t\t}\n\t}\n\n\topenAuthorizationView() {\n\t\tif ( !this.edit_view ) {\n\t\t\tthis.initEditViewUI( this.viewId, this.edit_view_tpl );\n\t\t}\n\t}\n}//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNTM5Ni5qcyIsIm1hcHBpbmdzIjoiOzs7Ozs7QUFBTztBQUNQLDJCQUEyQjtBQUMzQixFQUFFLENBQUM7QUFDSDs7QUFFQTtBQUNBO0FBQ0E7O0FBRUE7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7O0FBRUE7O0FBRUE7O0FBRUE7QUFDQTs7QUFFQSw2QkFBNkI7QUFDN0IsSUFBSTs7QUFFSjtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsMkJBQTJCLENBQUM7QUFDNUIsMEJBQTBCLENBQUM7QUFDM0I7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQSxvQ0FBb0Msc0JBQXNCOztBQUUxRDtBQUNBOztBQUVBOztBQUVBO0FBQ0E7O0FBRUE7QUFDQTs7QUFFQTtBQUNBLEtBQUs7QUFDTDs7QUFFQTtBQUNBLG1CQUFtQiw2REFBNkQ7QUFDaEY7O0FBRUE7O0FBRUEsdURBQXVELGVBQWU7QUFDdEU7QUFDQTtBQUNBO0FBQ0E7QUFDQ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