TimeTrex/interface/html5/dist/attendance-in_out-InOutViewController.bundle.js

1 line
84 KiB
JavaScript

"use strict";(self.webpackChunktimetrex=self.webpackChunktimetrex||[]).push([["attendance-in_out-InOutViewController"],{1690:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"InOutViewController\": () => (/* binding */ InOutViewController)\n/* harmony export */ });\n/* provided dependency */ var _ = __webpack_require__(9050);\n/* provided dependency */ var $ = __webpack_require__(9755);\nclass InOutViewController extends BaseViewController {\n\tconstructor( options = {} ) {\n\t\t_.defaults( options, {\n\n\t\t\ttype_array: null,\n\n\t\t\tjob_api: null,\n\t\t\tjob_item_api: null,\n\t\t\tpunch_tag_api: null,\n\t\t\tuser_api: null,\n\t\t\tdepartment_api: null,\n\t\t\tsystem_job_queue_api: null,\n\n\t\t\tdefault_punch_tag: [],\n\t\t\tprevious_punch_tag_selection: [],\n\n\t\t\told_type_status: {},\n\n\t\t\tshow_job_ui: false,\n\t\t\tshow_job_item_ui: false,\n\t\t\tshow_punch_tag_ui: false,\n\t\t\tshow_branch_ui: false,\n\t\t\tshow_department_ui: false,\n\t\t\tshow_good_quantity_ui: false,\n\t\t\tshow_bad_quantity_ui: false,\n\t\t\tshow_transfer_ui: false,\n\t\t\tshow_node_ui: false,\n\n\t\t\toriginal_note: false,\n\t\t\tnew_note: false,\n\n\t\t\tdo_not_prevalidate: true //Help reduce server load by skipping prevalidation. Enabled if validation fails during save.\n\t\t} );\n\n\t\tsuper( options );\n\t}\n\n\tinit( options ) {\n\t\tGlobal.setUINotready( true );\n\n\t\tthis.permission_id = 'punch';\n\t\tthis.viewId = 'InOut';\n\t\tthis.script_name = 'InOutView';\n\t\tthis.table_name_key = 'punch';\n\t\tthis.context_menu_name = $.i18n._( 'In/Out' );\n\t\tthis.api = TTAPI.APIPunch;\n\t\tthis.system_job_queue_api = TTAPI.APISystemJobQueue;\n\t\tthis.event_bus = new TTEventBus({ view_id: this.viewId });\n\n\t\t//Tried to fix Cannot call method 'getJobItem' of null. Use ( Global.getProductEdition() >= 20 )\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.user_api = TTAPI.APIUser;\n\t\t\tthis.department_api = TTAPI.APIDepartment;\n\t\t}\n\n\t\tthis.render();\n\t\t// this.buildContextMenu(); // #VueContextMenu#EditOnly - Commented out as must happen after initEditViewUI\n\n\t\tthis.initPermission();\n\n\t\tthis.initData();\n\t\tthis.is_changed = true;\n\t}\n\n\tgetCustomContextMenuModel() {\n\t\tvar context_menu_model = {\n\t\t\texclude: ['default'],\n\t\t\tinclude: ['save', 'cancel']\n\t\t};\n\n\t\treturn context_menu_model;\n\t}\n\n\taddPermissionValidate( p_id ) {\n\t\tif ( !Global.isSet( p_id ) ) {\n\t\t\tp_id = this.permission_id;\n\t\t}\n\n\t\tif ( p_id === 'report' ) {\n\t\t\treturn true;\n\t\t}\n\n\t\tif ( PermissionManager.validate( p_id, 'punch_in_out' ) ) {\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tjobUIValidate() {\n\t\tif ( PermissionManager.validate( 'job', 'enabled' ) &&\n\t\t\tPermissionManager.validate( 'punch', 'edit_job' ) ) {\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tjobItemUIValidate() {\n\t\tif ( PermissionManager.validate( 'punch', 'edit_job_item' ) ) {\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tpunchTagUIValidate() {\n\t\tif ( PermissionManager.validate( 'punch', 'edit_punch_tag' ) ) {\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tbranchUIValidate() {\n\t\tif ( PermissionManager.validate( 'punch', 'edit_branch' ) ) {\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tdepartmentUIValidate() {\n\t\tif ( PermissionManager.validate( 'punch', 'edit_department' ) ) {\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tgoodQuantityUIValidate() {\n\t\tif ( PermissionManager.validate( 'punch', 'edit_quantity' ) ) {\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tbadQuantityUIValidate() {\n\t\tif ( PermissionManager.validate( 'punch', 'edit_quantity' ) &&\n\t\t\tPermissionManager.validate( 'punch', 'edit_bad_quantity' ) ) {\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\ttransferUIValidate() {\n\t\tif ( PermissionManager.validate( 'punch', 'edit_transfer' ) ) {\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tnoteUIValidate() {\n\t\tif ( PermissionManager.validate( 'punch', 'edit_note' ) ) {\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\t//Speical permission check for views, need override\n\tinitPermission() {\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\tif ( this.goodQuantityUIValidate() ) {\n\t\t\tthis.show_good_quantity_ui = true;\n\t\t} else {\n\t\t\tthis.show_good_quantity_ui = false;\n\t\t}\n\n\t\tif ( this.badQuantityUIValidate() ) {\n\t\t\tthis.show_bad_quantity_ui = true;\n\t\t} else {\n\t\t\tthis.show_bad_quantity_ui = false;\n\t\t}\n\n\t\tif ( this.transferUIValidate() ) {\n\t\t\tthis.show_transfer_ui = true;\n\t\t} else {\n\t\t\tthis.show_transfer_ui = false;\n\t\t}\n\n\t\tif ( this.noteUIValidate() ) {\n\t\t\tthis.show_node_ui = true;\n\t\t} else {\n\t\t\tthis.show_node_ui = false;\n\t\t}\n\n\t\tvar result = false;\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\tresult = company_api.isBranchAndDepartmentAndJobAndJobItemAndPunchTagEnabled( { async: false } );\n\t\t}\n\n\t\t//tried to fix Unable to get property 'getResult' of undefined or null reference, added if(!result)\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\tresult = result.getResult();\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\n\t\tif ( !this.show_job_ui && !this.show_job_item_ui ) {\n\t\t\tthis.show_bad_quantity_ui = false;\n\t\t\tthis.show_good_quantity_ui = false;\n\t\t}\n\t}\n\n\trender() {\n\t\tsuper.render();\n\t}\n\n\tinitOptions( callBack ) {\n\n\t\tvar options = [\n\t\t\t{ option_name: 'type' },\n\t\t\t{ option_name: 'status' }\n\t\t];\n\n\t\tthis.initDropDownOptions( options, function( result ) {\n\t\t\tif ( callBack ) {\n\t\t\t\tcallBack( result ); // First to initialize drop down options, and then to initialize edit view UI.\n\t\t\t}\n\t\t} );\n\t}\n\tgetUserPunch( callBack ) {\n\t\tvar $this = this;\n\n\t\tvar station_id = Global.getStationID();\n\n\t\tvar api_station = TTAPI.APIStation;\n\n\t\tif ( station_id ) {\n\t\t\tapi_station.getCurrentStation( station_id, '10', {\n\t\t\t\tonResult: function( result ) {\n\t\t\t\t\tdoNext( result );\n\t\t\t\t}\n\t\t\t} );\n\t\t} else {\n\t\t\tapi_station.getCurrentStation( '', '10', {\n\t\t\t\tonResult: function( result ) {\n\t\t\t\t\tdoNext( result );\n\t\t\t\t}\n\t\t\t} );\n\t\t}\n\n\t\tfunction doNext( result ) {\n\n\t\t\t// Error: Uncaught TypeError: undefined is not a function in /interface/html5/#!m=TimeSheet&date=20150324&user_id=36135&sm=InOut line 285\n\t\t\tif ( !$this.api || typeof $this.api['getUserPunch'] !== 'function' ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tvar res_data = result.getResult();\n\t\t\t//setCookie( 'StationID', res_data );\n\t\t\tGlobal.setStationID( res_data );\n\n\t\t\t$this.api.getUserPunch( {\n\t\t\t\tonResult: function( result ) {\n\t\t\t\t\tvar result_data = result.getResult();\n\t\t\t\t\t//keep the inout view fields consistent for screenshots in unit test mode\n\t\t\t\t\tif ( Global.UNIT_TEST_MODE === true ) {\n\t\t\t\t\t\tresult_data.punch_date = 'UNITTEST';\n\t\t\t\t\t\tresult_data.punch_time = 'UNITTEST';\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( !result.isValid() ) {\n\t\t\t\t\t\tTAlertManager.showErrorAlert( result );\n\t\t\t\t\t\t$this.onCancelClick( true );\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( Global.isSet( result_data ) ) {\n\t\t\t\t\t\tcallBack( result_data );\n\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$this.onCancelClick();\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t} );\n\n\t\t}\n\t}\n\n\tonCancelClick( force_no_confirm ) {\n\t\tthis.is_changed = true;\n\t\tsuper.onCancelClick( force_no_confirm );\n\t}\n\n\topenEditView() {\n\t\tvar $this = this;\n\n\t\tif ( this.edit_only_mode && this.api ) {\n\n\t\t\tthis.initOptions( function( result ) {\n\t\t\t\tif ( !$this.edit_view ) {\n\t\t\t\t\t$this.initEditViewUI( 'InOut', 'InOutEditView.html' );\n\t\t\t\t\t$this.buildContextMenu(); // #VueContextMenu#EditOnly - Must happen after initEditViewUI\n\t\t\t\t}\n\n\t\t\t\t$this.getUserPunch( function( result ) {\n\t\t\t\t\t// Waiting for the TTAPI.API returns data to set the current edit record.\n\t\t\t\t\t$this.current_edit_record = result;\n\n\t\t\t\t\t//keep fields consistent in unit test mode for consistent screenshots\n\t\t\t\t\tif ( Global.UNIT_TEST_MODE === true ) {\n\t\t\t\t\t\t$this.current_edit_record.punch_date = 'UNITTEST';\n\t\t\t\t\t\t$this.current_edit_record.punch_time = 'UNITTEST';\n\t\t\t\t\t}\n\t\t\t\t\t$this.initEditView();\n\n\t\t\t\t} );\n\n\t\t\t} );\n\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\n\t\tdoNotValidate = this.do_not_prevalidate; //Help reduce server load. Defaults to true unless validation fails on save.\n\n\t\tswitch ( key ) {\n\t\t\tcase 'transfer':\n\t\t\t\tthis.onTransferChanged();\n\t\t\t\tbreak;\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 'user_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 '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\tTTPromise.wait( 'BaseViewController', 'onJobQuickSearch', function() {\n\t\t\t\t\t\t$this.setPunchTagValuesWhenCriteriaChanged( $this.getPunchTagFilterData(), 'punch_tag_id' );\n\t\t\t\t\t} );\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 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}\n\n\t\tif ( !doNotValidate ) {\n\t\t\tthis.validate();\n\t\t}\n\t}\n\n\tonTransferChanged( initial_load ) {\n\n\t\tvar is_transfer = false;\n\t\tif ( this.edit_view_ui_dic && this.edit_view_ui_dic['transfer'] && this.edit_view_ui_dic['transfer'].getValue() == true ) {\n\t\t\tis_transfer = true;\n\t\t}\n\n\t\t// type_id_widget is undefined in interface/html5/framework/jquery.min.js?v=9.0.1-20151022-091549 line 2 > eval line 390\n\t\tvar type_id_widget = this.edit_view_ui_dic['type_id'];\n\t\tvar status_id_widget = this.edit_view_ui_dic['status_id'];\n\t\tif ( is_transfer && type_id_widget && status_id_widget ) {\n\n\t\t\ttype_id_widget.setEnabled( false );\n\t\t\tstatus_id_widget.setEnabled( false );\n\n\t\t\tthis.old_type_status.type_id = type_id_widget.getValue();\n\t\t\tthis.old_type_status.status_id = status_id_widget.getValue();\n\n\t\t\ttype_id_widget.setValue( 10 );\n\t\t\tstatus_id_widget.setValue( 10 );\n\n\t\t\tthis.current_edit_record.type_id = 10;\n\t\t\tthis.current_edit_record.status_id = 10;\n\n\t\t} else if ( type_id_widget && status_id_widget ) {\n\t\t\ttype_id_widget.setEnabled( true );\n\t\t\tstatus_id_widget.setEnabled( true );\n\n\t\t\tif ( this.old_type_status.hasOwnProperty( 'type_id' ) ) {\n\t\t\t\ttype_id_widget.setValue( this.old_type_status.type_id );\n\t\t\t\tstatus_id_widget.setValue( this.old_type_status.status_id );\n\n\t\t\t\tthis.current_edit_record.type_id = this.old_type_status.type_id;\n\t\t\t\tthis.current_edit_record.status_id = this.old_type_status.status_id;\n\t\t\t}\n\n\t\t}\n\n\t\tif ( is_transfer == true ) {\n\t\t\tif ( this.original_note == '' ) {\n\t\t\t\tthis.original_note = this.current_edit_record.note;\n\t\t\t} else {\n\t\t\t\tthis.original_note = this.edit_view_ui_dic.note.getValue();\n\t\t\t}\n\t\t\tthis.edit_view_ui_dic.note.setValue( this.new_note ? this.new_note : '' );\n\t\t\tthis.current_edit_record.note = this.new_note ? this.new_note : '';\n\n\t\t} else if ( typeof initial_load == 'undefined' || initial_load === false ) {\n\n\t\t\tthis.new_note = this.edit_view_ui_dic.note.getValue();\n\t\t\tthis.edit_view_ui_dic.note.setValue( this.original_note ? this.original_note : '' );\n\t\t\tthis.current_edit_record.note = this.original_note ? this.original_note : '';\n\t\t}\n\t}\n\n\t//Make sure this.current_edit_record is updated before validate\n\tvalidate() {\n\n\t\tvar $this = this;\n\n\t\tvar record = {};\n\n\t\tif ( this.is_mass_editing ) {\n\t\t\tfor ( var key in this.edit_view_ui_dic ) {\n\n\t\t\t\tif ( !this.edit_view_ui_dic.hasOwnProperty( key ) ) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tvar widget = this.edit_view_ui_dic[key];\n\n\t\t\t\tif ( Global.isSet( widget.isChecked ) ) {\n\t\t\t\t\tif ( widget.isChecked() && widget.getEnabled() ) {\n\t\t\t\t\t\trecord[key] = widget.getValue();\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t}\n\n\t\t} else {\n\t\t\trecord = this.current_edit_record;\n\t\t}\n\n\t\trecord = this.uniformVariable( record );\n\n\t\tthis.api.setUserPunch( record, true, {\n\t\t\tonResult: function( result ) {\n\t\t\t\t$this.validateResult( result );\n\n\t\t\t}\n\t\t} );\n\t}\n\n\t// Overrides BaseViewController\n\tdoSaveAPICall( record, ignoreWarning, callback ) {\n\t\tvar current_api = this.getCurrentAPI();\n\n\t\tif ( !callback ) {\n\t\t\tcallback = {\n\t\t\t\tonResult: function( result ) {\n\t\t\t\t\tthis.onSaveResult( result );\n\t\t\t\t}.bind( this )\n\t\t\t};\n\t\t}\n\n\t\tcurrent_api.setIsIdempotent( true ); //Force to idempotent API call to avoid duplicate network requests from causing errors displayed to the user.\n\t\treturn current_api.setUserPunch( record, false, ignoreWarning, callback );\n\t}\n\n\tconvertSetUserPunchToGetPunch( record ) {\n\t\trecord.id = TTUUID.not_exist_id;\n\t\trecord.longitude = null;\n\t\trecord.latitude = null;\n\t\trecord.position_accuracy = null;\n\t\trecord.pay_period_id = null;\n\t\trecord.punch_control_id = record.punch_control_id ? record.punch_control_id : null;\n\t\trecord.tainted = false;\n\t\trecord.has_image = false;\n\n\t\treturn record;\n\t}\n\n\tonSaveResult( result ) {\n\t\tlet pending_punch = _.clone( this.current_edit_record );\n\t\tsuper.onSaveResult( result );\n\t\t//If pending punch is null that means the In/Out view has already been closed. Multiple clicks of save under latency could cause this.\n\t\t//Do not continue further or exceptions will be thrown trying to read a null punch. \n\t\tif ( result && result.isValid() && pending_punch != null ) {\n\t\t\tLocalCacheData.setLastPunchTime( new Date().getTime() ); //Update last punch time so that we can limit the user from punching in more than once a minute.\n\t\t\tvar system_job_queue = result.getAttributeInAPIDetails( 'system_job_queue' );\n\t\t\tif ( system_job_queue ) {\n\t\t\t\tLocalCacheData.setJobQueuePunchData( this.convertSetUserPunchToGetPunch( pending_punch ) );\n\t\t\t\tthis.event_bus.emit( 'tt_topbar', 'toggle_job_queue_spinner', {\n\t\t\t\t\tshow: true,\n\t\t\t\t\tget_job_data: true\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\tif ( LocalCacheData.current_open_primary_controller && LocalCacheData.current_open_primary_controller.viewId === 'TimeSheet' ) {\n\t\t\t\tLocalCacheData.current_open_primary_controller.search();\n\t\t\t}\n\t\t} else {\n\t\t\tthis.do_not_prevalidate = false;\n\t\t}\n\t}\n\n\tsetErrorMenu() {\n\t\tvar context_menu_array = ContextMenuManager.getMenuModelByMenuId( this.determineContextMenuMountAttributes().id );\n\t\tvar len = context_menu_array.length;\n\n\t\tfor ( var i = 0; i < len; i++ ) {\n\t\t\tlet context_btn = context_menu_array[i];\n\t\t\tlet id = context_menu_array[i].id;\n\t\t\tContextMenuManager.disableMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, true );\n\n\t\t\tswitch ( id ) {\n\t\t\t\tcase 'cancel':\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tContextMenuManager.disableMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, false );\n\t\t\t\t\tbreak;\n\t\t\t}\n\n\t\t}\n\t}\n\n\tgetCustomFieldReferenceField() {\n\t\treturn 'note';\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_punch': { 'label': $.i18n._( 'Punch' ) },\n\t\t\t'tab_audit': false,\n\t\t};\n\t\tthis.setTabModel( tab_model );\n\n\t\t//Tab 0 start\n\n\t\tvar tab_punch = this.edit_view_tab.find( '#tab_punch' );\n\n\t\tvar tab_punch_column1 = tab_punch.find( '.first-column' );\n\n\t\tthis.edit_view_tabs[0] = [];\n\n\t\tthis.edit_view_tabs[0].push( tab_punch_column1 );\n\n\t\tvar form_item_input;\n\t\tvar widgetContainer;\n\t\tvar label;\n\n\t\t// Employee\n\t\tform_item_input = Global.loadWidgetByName( FormItemType.TEXT );\n\n\t\tform_item_input.TText( {\n\t\t\tfield: 'user_id_readonly'\n\t\t} );\n\t\tthis.addEditFieldToColumn( $.i18n._( 'Employee' ), form_item_input, tab_punch_column1, '' );\n\n\t\t// Time\n\t\tform_item_input = Global.loadWidgetByName( FormItemType.TIME_PICKER );\n\n\t\tform_item_input.TTimePicker( { field: 'punch_time' } );\n\n\t\tthis.addEditFieldToColumn( $.i18n._( 'Time' ), form_item_input, tab_punch_column1 );\n\n\t\t// Date\n//\t\t punch_date, punch_dates\n\t\tform_item_input = Global.loadWidgetByName( FormItemType.DATE_PICKER );\n\n\t\tform_item_input.TDatePicker( { field: 'punch_date' } );\n\n\t\tthis.addEditFieldToColumn( $.i18n._( 'Date' ), form_item_input, tab_punch_column1 );\n\n\t\t//Transfer\n\n\t\tform_item_input = Global.loadWidgetByName( FormItemType.CHECKBOX );\n\t\tform_item_input.TCheckbox( { field: 'transfer' } );\n\n\t\tthis.addEditFieldToColumn( $.i18n._( 'Transfer' ), form_item_input, tab_punch_column1, '', null, true );\n\n\t\tif ( !this.show_transfer_ui ) {\n\t\t\tthis.detachElement( 'transfer' );\n\t\t}\n\n\t\t// Punch\n\n\t\tform_item_input = Global.loadWidgetByName( FormItemType.COMBO_BOX );\n\t\tform_item_input.TComboBox( { field: 'type_id' } );\n\t\tform_item_input.setSourceData( $this.type_array );\n\n\t\tthis.addEditFieldToColumn( $.i18n._( 'Punch Type' ), form_item_input, tab_punch_column1 );\n\n\t\t// In/Out\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.status_array );\n\t\tthis.addEditFieldToColumn( $.i18n._( 'In/Out' ), form_item_input, tab_punch_column1 );\n\n\t\t// Branch\n\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} );\n\t\tthis.addEditFieldToColumn( $.i18n._( 'Branch' ), form_item_input, tab_punch_column1, '', null, true );\n\n\t\tif ( !this.show_branch_ui ) {\n\t\t\tthis.detachElement( 'branch_id' );\n\t\t}\n\n\t\t// Department\n\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} );\n\t\tthis.addEditFieldToColumn( $.i18n._( 'Department' ), form_item_input, tab_punch_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\n\t\t\t//Job\n\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\talways_include_columns: ['group_id'],\n\t\t\t\tsetRealValueCallBack: ( function( val ) {\n\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} );\n\n\t\t\twidgetContainer = $( '<div class=\\'widget-h-box\\'></div>' );\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_punch_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\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\talways_include_columns: ['group_id'],\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} );\n\n\t\t\twidgetContainer = $( '<div class=\\'widget-h-box\\'></div>' );\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_punch_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\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} );\n\n\t\t\twidgetContainer = $( '<div class=\\'widget-h-box\\'></div>' );\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_punch_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// Quantity\n\n\t\tif ( ( Global.getProductEdition() >= 20 ) ) {\n\n\t\t\tvar good = Global.loadWidgetByName( FormItemType.TEXT_INPUT );\n\t\t\tgood.TTextInput( { field: 'quantity', width: 40 } );\n\t\t\tgood.addClass( 'quantity-input' );\n\n\t\t\tvar good_label = $( '<span class=\\'widget-right-label\\'>' + $.i18n._( 'Good' ) + ': </span>' );\n\n\t\t\tvar bad = Global.loadWidgetByName( FormItemType.TEXT_INPUT );\n\t\t\tbad.TTextInput( { field: 'bad_quantity', width: 40 } );\n\t\t\tbad.addClass( 'quantity-input' );\n\n\t\t\tvar bad_label = $( '<span class=\\'widget-right-label\\'>/ ' + $.i18n._( 'Bad' ) + ': </span>' );\n\n\t\t\twidgetContainer = $( '<div class=\\'widget-h-box\\'></div>' );\n\n\t\t\twidgetContainer.append( good_label );\n\t\t\twidgetContainer.append( good );\n\t\t\twidgetContainer.append( bad_label );\n\t\t\twidgetContainer.append( bad );\n\n\t\t\tthis.addEditFieldToColumn( $.i18n._( 'Quantity' ), [good, bad], tab_punch_column1, '', widgetContainer, true );\n\n\t\t\tif ( !this.show_bad_quantity_ui && !this.show_good_quantity_ui ) {\n\t\t\t\tthis.detachElement( 'quantity' );\n\t\t\t} else {\n\t\t\t\tif ( !this.show_bad_quantity_ui ) {\n\t\t\t\t\tbad_label.hide();\n\t\t\t\t\tbad.hide();\n\t\t\t\t}\n\n\t\t\t\tif ( !this.show_good_quantity_ui ) {\n\t\t\t\t\tgood_label.hide();\n\t\t\t\t\tgood.hide();\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\n\t\t//Note\n\t\tform_item_input = Global.loadWidgetByName( FormItemType.TEXT_AREA );\n\n\t\tform_item_input.TTextArea( { field: 'note', width: '100%' } );\n\n\t\tthis.addEditFieldToColumn( $.i18n._( 'Note' ), form_item_input, tab_punch_column1, '', null, true, true );\n\n\t\tform_item_input.parent().width( '45%' );\n\n\t\tif ( !this.show_node_ui ) {\n\t\t\tthis.detachElement( 'note' );\n\t\t}\n\t}\n\n\tsetCurrentEditRecordData() {\n\t\tvar $this = this;\n\t\t// reset old_types, should only be set when type change and transfer is true. fixed bug 1500\n\t\tthis.old_type_status = {};\n\t\t//Set current edit record data to all widgets\n\t\tfor ( var key in this.current_edit_record ) {\n\n\t\t\tif ( !this.current_edit_record.hasOwnProperty( key ) ) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tvar widget = this.edit_view_ui_dic[key];\n\t\t\tif ( Global.isSet( widget ) ) {\n\t\t\t\tswitch ( key ) {\n\t\t\t\t\tcase 'user_id_readonly':\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 '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 punch_tag_widget = widget;\n\t\t\t\t\t\t\tTTPromise.wait( null, null, function() {\n\t\t\t\t\t\t\t\t//Update default args for punch tags AComboBox last as they rely on data from job, job item and related fields.\n\t\t\t\t\t\t\t\tvar args = {};\n\t\t\t\t\t\t\t\targs.filter_data = $this.getPunchTagFilterData();\n\t\t\t\t\t\t\t\tpunch_tag_widget.setDefaultArgs( args );\n\t\t\t\t\t\t\t} );\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 = { status_id: 10, 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 = { status_id: 10, 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 'job_quick_search':\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'job_item_quick_search':\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 'transfer':\n\t\t\t\t\t\t// do this at last\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'punch_time':\n\t\t\t\t\tcase 'punch_date':\n\t\t\t\t\t\twidget.setEnabled( false );\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\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\t//Error: Uncaught TypeError: Cannot read property 'setValue' of undefined in interface/html5/#!m=TimeSheet&date=20151019&user_id=25869&show_wage=0&sm=InOut line 926\n\t\t//The API will return if transfer should be enabled/disabled by default.\n\t\tif ( this.show_transfer_ui && this.edit_view_ui_dic['transfer'] ) {\n\t\t\tthis.edit_view_ui_dic['transfer'].setValue( this.current_edit_record['transfer'] );\n\t\t}\n\n\t\tthis.onTransferChanged( true );\n\n\t\tthis.collectUIDataToCurrentEditRecord();\n\t\tthis.setEditViewDataDone();\n\t}\n\n\tsetEditViewDataDone() {\n\t\tsuper.setEditViewDataDone();\n\t\tthis.confirm_on_exit = true; //confirm on leaving even if no changes have been made so users can't accidentally not save punches by logging out without clicking save for example\n\t}\n}\n\nInOutViewController.loadView = function() {\n\n\tGlobal.loadViewSource( 'InOut', 'InOutView.html', function( result ) {\n\n\t\tvar args = {};\n\t\tvar template = _.template( result );\n\n\t\tGlobal.contentContainer().html( template( args ) );\n\t} );\n\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTY5MC5qcyIsIm1hcHBpbmdzIjoiOzs7Ozs7QUFBTztBQUNQLDJCQUEyQjtBQUMzQixFQUFFLENBQUM7O0FBRUg7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7O0FBRUEsc0JBQXNCOztBQUV0QjtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTs7QUFFQTtBQUNBLElBQUk7O0FBRUo7QUFDQTs7QUFFQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsMkJBQTJCLENBQUM7QUFDNUI7QUFDQTtBQUNBLG9DQUFvQyxzQkFBc0I7O0FBRTFEO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQSw4QkFBOEI7O0FBRTlCOztBQUVBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQU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