(self.webpackChunktimetrex=self.webpackChunktimetrex||[]).push([["attendance-punches-PunchesViewController","filebrowser-TImage"],{1469:(__unused_webpack_module,__unused_webpack_exports,__webpack_require__)=>{eval("/* provided dependency */ var jQuery = __webpack_require__(9755);\n( function( $ ) {\n\n\t$.fn.TImage = function( options ) {\n\n\t\tGlobal.addCss( 'global/widgets/filebrowser/TImageBrowser.css' );\n\t\tvar opts = $.extend( {}, $.fn.TImage.defaults, options );\n\n\t\tvar $this = this;\n\t\tvar field;\n\n\t\tthis.clearErrorStyle = function() {\n\n\t\t};\n\n\t\tthis.getField = function() {\n\t\t\treturn field;\n\t\t};\n\n\t\tthis.getValue = function() {\n\t\t\treturn null;\n\t\t};\n\n\t\tthis.setValue = function( val ) {\n\t\t\tif ( !val ) {\n\t\t\t\tthis.attr( 'src', '' );\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tvar d = new Date();\n\t\t\tthis.attr( 'src', val + '&t=' + d.getTime() );\n\n\t\t};\n\n\t\tthis.each( function() {\n\n\t\t\tvar o = $.meta ? $.extend( {}, opts, $( this ).data() ) : opts;\n\n\t\t\tfield = o.field;\n\n\t\t} );\n\n\t\treturn this;\n\n\t};\n\n\t$.fn.TImage.defaults = {};\n\n\t$( document ).on( 'mouseover', '.file-browser img', function( e ) {\n\t\tvar $this_image_widget = $( e.target ).parents( '.file-browser' );\n\n\t\tif ( !$( '.file_browser_overlay' )[0] && $( e.target ).attr( 'enable-delete' ) == 1 ) {\n\t\t\tvar height = $( e.target ).height();\n\t\t\tvar top = ( height - 32 ) / 2;\n\t\t\tvar left = top;\n\n\t\t\tvar file_browser_overlay = $( '
' );\n\t\t\tfile_browser_overlay.css( 'position', 'absolute' );\n\t\t\tfile_browser_overlay.css( 'top', '0px' );\n\t\t\tfile_browser_overlay.css( 'left', '0' );\n\t\t\tfile_browser_overlay.css( 'cursor', 'pointer' );\n\t\t\tfile_browser_overlay.css( 'height', height + 'px' );\n\t\t\tfile_browser_overlay.css( 'width', '100%' );\n\t\t\tfile_browser_overlay.css( 'background', 'rgba(255,255,255,0.85)' );\n\n\t\t\t$( e.target ).parents( '.file-browser' ).append( file_browser_overlay );\n\n\t\t\t$( document ).on( 'click', '.file_browser_overlay', function( e ) {\n\t\t\t\tvar img_src = $( e.target ).parent().find( 'img' ).attr( 'src' );\n\t\t\t\tTAlertManager.showConfirmAlert( $.i18n._( 'This will permanently delete the image. Are you sure?' ), '', function( flag ) {\n\t\t\t\t\tif ( flag ) {\n\t\t\t\t\t\tvar e = { type: 'deleteClick', message: 'Delete image clicked.', time: new Date() };\n\t\t\t\t\t\t$this_image_widget.trigger( e );\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t} );\n\n\t\t\t$( document ).on( 'mouseleave', '.file-browser', function() {\n\t\t\t\t$( document ).off( 'click', '.file_browser_overlay' );\n\t\t\t\tif ( $( '.file_browser_overlay' )[0] ) {\n\t\t\t\t\tvar file_browser_overlay = $( this ).find( '.file_browser_overlay' );\n\t\t\t\t\tfile_browser_overlay.off().remove();\n\t\t\t\t}\n\t\t\t} );\n\t\t}\n\t} );\n\n} )( jQuery );//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTQ2OS5qcyIsIm1hcHBpbmdzIjoiO0FBQUE7O0FBRUE7O0FBRUE7QUFDQSx5QkFBeUI7O0FBRXpCO0FBQ0E7O0FBRUE7O0FBRUE7O0FBRUE7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTs7QUFFQTs7QUFFQSxnQ0FBZ0M7O0FBRWhDOztBQUVBLElBQUk7O0FBRUo7O0FBRUE7O0FBRUE7O0FBRUE7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQSw0SUFBNEksV0FBVyxZQUFZLGtCQUFrQixvQkFBb0I7QUFDek07QUFDQTtBQU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dXJlPycgKSwgJycsIGZ1bmN0aW9uKCBmbGFnICkge1xuXHRcdFx0XHRcdGlmICggZmxhZyApIHtcblx0XHRcdFx0XHRcdHZhciBlID0geyB0eXBlOiAnZGVsZXRlQ2xpY2snLCBtZXNzYWdlOiAnRGVsZXRlIGltYWdlIGNsaWNrZWQuJywgdGltZTogbmV3IERhdGUoKSB9O1xuXHRcdFx0XHRcdFx0JHRoaXNfaW1hZ2Vfd2lkZ2V0LnRyaWdnZXIoIGUgKTtcblx0XHRcdFx0XHR9XG5cdFx0XHRcdH0gKTtcblx0XHRcdH0gKTtcblxuXHRcdFx0JCggZG9jdW1lbnQgKS5vbiggJ21vdXNlbGVhdmUnLCAnLmZpbGUtYnJvd3NlcicsIGZ1bmN0aW9uKCkge1xuXHRcdFx0XHQkKCBkb2N1bWVudCApLm9mZiggJ2NsaWNrJywgJy5maWxlX2Jyb3dzZXJfb3ZlcmxheScgKTtcblx0XHRcdFx0aWYgKCAkKCAnLmZpbGVfYnJvd3Nlcl9vdmVybGF5JyApWzBdICkge1xuXHRcdFx0XHRcdHZhciBmaWxlX2Jyb3dzZXJfb3ZlcmxheSA9ICQoIHRoaXMgKS5maW5kKCAnLmZpbGVfYnJvd3Nlcl9vdmVybGF5JyApO1xuXHRcdFx0XHRcdGZpbGVfYnJvd3Nlcl9vdmVybGF5Lm9mZigpLnJlbW92ZSgpO1xuXHRcdFx0XHR9XG5cdFx0XHR9ICk7XG5cdFx0fVxuXHR9ICk7XG5cbn0gKSggalF1ZXJ5ICk7Il0sIm5hbWVzIjpbXSwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///1469\n")},1274:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"PunchesViewController\": () => (/* binding */ PunchesViewController)\n/* harmony export */ });\n/* harmony import */ var _global_widgets_filebrowser_TImage__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1469);\n/* harmony import */ var _global_widgets_filebrowser_TImage__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_global_widgets_filebrowser_TImage__WEBPACK_IMPORTED_MODULE_0__);\n/* provided dependency */ var _ = __webpack_require__(9050);\n/* provided dependency */ var $ = __webpack_require__(9755);\n\n\nclass PunchesViewController extends BaseViewController {\n\tconstructor( options = {} ) {\n\t\t_.defaults( options, {\n\t\t\tel: '#punches_view_container',\n\n\t\t\t// _required_files: {\n\t\t\t// \t10: ['TImage'],\n\t\t\t// \t15: ['leaflet-timetrex']\n\t\t\t// },\n\t\t\t// TODO: breakdown leaflet-timetrex so only the convert functions are needed in ViewControllers.\n\n\t\t\told_type_status: {},\n\n\t\t\tuser_api: null,\n\t\t\tuser_group_api: null,\n\t\t\tapi_station: null,\n\t\t\ttype_array: 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\tactual_time_label: null,\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 = 'PunchesEditView.html';\n\t\tthis.permission_id = 'punch';\n\t\tthis.viewId = 'Punches';\n\t\tthis.script_name = 'PunchesView';\n\t\tthis.table_name_key = 'punch';\n\t\tthis.context_menu_name = $.i18n._( 'Punches' );\n\t\tthis.navigation_label = $.i18n._( 'Punch' );\n\t\tthis.api = TTAPI.APIPunch;\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}\n\n\t\tthis.api_station = TTAPI.APIStation;\n\n\t\tthis.initPermission();\n\t\tthis.render();\n\n\t\tthis.buildContextMenu();\n\t\tthis.initData();\n\t}\n\n\tjobUIValidate( p_id ) {\n\n\t\tif ( !p_id ) {\n\t\t\tp_id = 'punch';\n\t\t}\n\n\t\tif ( PermissionManager.validate( 'job', 'enabled' ) &&\n\t\t\tPermissionManager.validate( p_id, 'edit_job' ) ) {\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 = 'punch';\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 = 'punch';\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 = 'punch';\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 = 'punch';\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\tgoodQuantityUIValidate( p_id ) {\n\n\t\tif ( !p_id ) {\n\t\t\tp_id = 'punch';\n\t\t}\n\n\t\tif ( PermissionManager.validate( p_id, 'edit_quantity' ) ) {\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tbadQuantityUIValidate( p_id ) {\n\n\t\tif ( !p_id ) {\n\t\t\tp_id = 'punch';\n\t\t}\n\n\t\tif ( PermissionManager.validate( p_id, 'edit_quantity' ) &&\n\t\t\tPermissionManager.validate( p_id, 'edit_bad_quantity' ) ) {\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\ttransferUIValidate( p_id ) {\n\n\t\tif ( !p_id ) {\n\t\t\tp_id = 'punch';\n\t\t}\n\n\t\tif ( PermissionManager.validate( p_id, 'edit_transfer' ) ) {\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tnoteUIValidate( p_id ) {\n\n\t\tif ( !p_id ) {\n\t\t\tp_id = 'punch';\n\t\t}\n\n\t\tif ( PermissionManager.validate( p_id, 'edit_note' ) ) {\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tlocationUIValidate( p_id ) {\n\n\t\tif ( !p_id ) {\n\t\t\tp_id = 'punch';\n\t\t}\n\n\t\tif ( PermissionManager.validate( p_id, 'edit_location' ) ) {\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tstationValidate() {\n\t\tif ( PermissionManager.validate( 'station', 'enabled' ) ) {\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\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\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_note_ui = true;\n\t\t} else {\n\t\t\tthis.show_note_ui = false;\n\t\t}\n\n\t\tif ( this.locationUIValidate() ) {\n\t\t\tthis.show_location_ui = true;\n\t\t} else {\n\t\t\tthis.show_location_ui = false;\n\t\t}\n\n\t\tif ( this.stationValidate() ) {\n\t\t\tthis.show_station_ui = true;\n\t\t} else {\n\t\t\tthis.show_station_ui = false;\n\t\t}\n\t}\n\n\tinitOptions() {\n\t\tvar $this = this;\n\n\t\tthis.initDropDownOption( 'type' );\n\n\t\tthis.initDropDownOption( 'status', 'status_id', this.api, null, 'status_array' );\n\n\t\tthis.initDropDownOption( 'status', 'user_status_id', this.user_api, null, 'user_status_array' );\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\t\t\t\t$this.basic_search_field_ui_dic['group_id'].setSourceData( res );\n\t\t\t\t$this.adv_search_field_ui_dic['group_id'].setSourceData( res );\n\n\t\t\t}\n\t\t} );\n\t}\n\n\tonEditStationDone() {\n\t\tthis.setStation();\n\t}\n\n\tsetStation() {\n\n\t\tvar $this = this;\n\t\tvar arg = { filter_data: { id: this.current_edit_record.station_id } };\n\n\t\tthis.api_station.getStation( arg, {\n\t\t\tonResult: function( result ) {\n\t\t\t\t$this.station = result.getResult()[0];\n\t\t\t\tvar widget = $this.edit_view_ui_dic['station_id'];\n\t\t\t\twidget.setValue( $this.station.type + '-' + $this.station.description );\n\t\t\t\twidget.css( 'cursor', 'pointer' );\n\n\t\t\t}\n\t\t} );\n\t}\n\n\tuniformVariable( records ) {\n\t\tif ( this.is_mass_editing == false ) {\n\t\t\trecords = this.buildMassAddRecord( records );\n\t\t}\n\n\t\tif ( Array.isArray( records ) ) {\n\t\t\tfor ( let i = 0; i < records.length; i++ ) {\n\t\t\t\tif ( !records[i].hasOwnProperty( 'time_stamp' ) ) {\n\t\t\t\t\trecords[i].time_stamp = false;\n\t\t\t\t}\n\t\t\t}\n\t\t} else if ( !records.hasOwnProperty( 'time_stamp' ) ) {\n\t\t\trecords.time_stamp = false;\n\t\t}\n\n\t\treturn records;\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_punch': { 'label': $.i18n._( 'Punch' ) },\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.APIPunch,\n\t\t\tid: this.script_name + '_navigation',\n\t\t\tallow_multiple_selection: false,\n\t\t\tlayout_name: 'global_punch',\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_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\t// Employee\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: true,\n\t\t\tfield: 'user_id'\n\t\t} );\n\n\t\tvar default_args = {};\n\t\tdefault_args.permission_section = 'punch';\n\t\tform_item_input.setDefaultArgs( default_args );\n\t\tthis.addEditFieldToColumn( $.i18n._( 'Employee' ), form_item_input, tab_punch_column1, '', null, true );\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', validation_field: 'time_stamp' } );\n\n\t\twidgetContainer = $( '
' );\n\t\tthis.actual_time_label = $( '' );\n\t\twidgetContainer.append( form_item_input );\n\t\twidgetContainer.append( this.actual_time_label );\n\t\tthis.addEditFieldToColumn( $.i18n._( 'Time' ), form_item_input, tab_punch_column1, '', widgetContainer );\n\n\t\t//Date\n\t\tform_item_input = Global.loadWidgetByName( FormItemType.DATE_PICKER );\n\t\tform_item_input.TDatePicker( { field: 'punch_date', validation_field: 'date_stamp' } );\n\t\tthis.addEditFieldToColumn( $.i18n._( 'Date' ), form_item_input, tab_punch_column1, '', null, true );\n\n\t\t//Mass Add Date\n\t\tform_item_input = Global.loadWidgetByName( FormItemType.DATE_PICKER );\n\t\tform_item_input.TRangePicker( { field: 'punch_dates', validation_field: 'date_stamp' } );\n\t\tthis.addEditFieldToColumn( $.i18n._( 'Date' ), form_item_input, tab_punch_column1, '', null, true );\n\n\t\t//Transfer\n\t\tform_item_input = Global.loadWidgetByName( FormItemType.CHECKBOX );\n\t\tform_item_input.TCheckbox( { field: 'transfer' } );\n\t\tthis.addEditFieldToColumn( $.i18n._( 'Transfer' ), form_item_input, tab_punch_column1, '', null, true );\n\t\tif ( this.show_transfer_ui == false || this.is_add == false ) {\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\twidgetContainer = $( '
' );\n\n\t\tvar check_box = Global.loadWidgetByName( FormItemType.CHECKBOX );\n\t\tcheck_box.TCheckbox( { field: 'disable_rounding' } );\n\n\t\tvar label = $( '' + $.i18n._( 'Disable Rounding' ) + '' );\n\n\t\twidgetContainer.append( form_item_input );\n\n\t\t// Check if view only mode. To prevent option appearing but disabled, as disabled checkboxes are not very clear - same in TimeSheetViewController\n\t\tif ( this.is_viewing ) {\n\t\t\t// dev-note: not sure if we need to pass widgetContainer here, or if we can omit if its only one element now (due to the if is_viewing).\n\t\t\t// to be safe, will continue to use widgetContainer for this case. We only want to affect viewing mode (hide rounding checkbox), less risk of regression to keep widget container in.\n\t\t\tthis.addEditFieldToColumn( $.i18n._( 'Punch Type' ), form_item_input, tab_punch_column1, '', widgetContainer, true );\n\t\t} else {\n\t\t\twidgetContainer.append( label );\n\t\t\twidgetContainer.append( check_box );\n\t\t\tthis.addEditFieldToColumn( $.i18n._( 'Punch Type' ), [form_item_input, check_box], tab_punch_column1, '', widgetContainer, true );\n\t\t}\n\n\t\t// In/Out\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\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\t{ value: 'ffffffff-ffff-ffff-ffff-000000000002', label: $.i18n._( '-- Current Shift --' ) }\n\t\t\t]\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\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\t{ value: 'ffffffff-ffff-ffff-ffff-000000000002', label: $.i18n._( '-- Current Shift --' ) }\n\t\t\t]\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\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\t{ value: 'ffffffff-ffff-ffff-ffff-000000000002', label: $.i18n._( '-- Current Shift --' ) }\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_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//Job Item\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\t{ value: 'ffffffff-ffff-ffff-ffff-000000000002', label: $.i18n._( '-- Current Shift --' ) }\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_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\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 = $( '
' );\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\n\t\t}\n\n\t\tif ( ( Global.getProductEdition() >= 20 ) ) {\n\t\t\t// Quantity\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 = $( '' + $.i18n._( 'Good' ) + ': ' );\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 = $( '/ ' + $.i18n._( 'Bad' ) + ': ' );\n\n\t\t\twidgetContainer = $( '
' );\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\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_note_ui ) {\n\t\t\tthis.detachElement( 'note' );\n\t\t}\n\n\t\t//Location\n\t\tif ( Global.getProductEdition() >= 15 ) {\n\t\t\tvar latitude = Global.loadWidgetByName( FormItemType.TEXT );\n\t\t\tlatitude.TText( { field: 'latitude' } );\n\t\t\tvar longitude = Global.loadWidgetByName( FormItemType.TEXT );\n\t\t\tlongitude.TText( { field: 'longitude' } );\n\t\t\twidgetContainer = $( '
' );\n\t\t\tvar accuracy = Global.loadWidgetByName( FormItemType.TEXT );\n\t\t\taccuracy.TText( { field: 'position_accuracy' } );\n\t\t\tlabel = $( '' + $.i18n._( 'Accuracy' ) + ':' );\n\n\t\t\tvar map_icon = $( '' ); // TODO, fix image location so that its not in a library folder incase library removed.\n\n\t\t\tthis.location_wrapper = $( '
' );\n\t\t\twidgetContainer.append( map_icon );\n\t\t\twidgetContainer.append( this.location_wrapper );\n\t\t\tthis.location_wrapper.append( latitude );\n\t\t\tthis.location_wrapper.append( $( ', ' ) );\n\t\t\tthis.location_wrapper.append( longitude );\n\t\t\tthis.location_wrapper.append( label );\n\t\t\tthis.location_wrapper.append( accuracy );\n\t\t\tthis.location_wrapper.append( $( 'm' ) );\n\t\t\tthis.addEditFieldToColumn( $.i18n._( 'Location' ), [latitude, longitude, accuracy], tab_punch_column1, '', widgetContainer, true );\n\t\t\twidgetContainer.click( function() {\n\t\t\t\t$this.onMapClick();\n\t\t\t} );\n\n\t\t\t// #2117 - Manual location only supported in edit because we need a punch record to append the data to.\n\t\t\tif ( ( !this.is_edit && !this.is_viewing ) || !this.show_location_ui ) {\n\t\t\t\twidgetContainer.parents( '.edit-view-form-item-div' ).hide();\n\t\t\t}\n\t\t}\n\n\t\t// Station\n\t\tform_item_input = Global.loadWidgetByName( FormItemType.TEXT );\n\t\tform_item_input.TText( { field: 'station_id' } );\n\t\tthis.addEditFieldToColumn( $.i18n._( 'Station' ), form_item_input, tab_punch_column1, '', null, true, true );\n\n\t\tform_item_input.click( function() {\n\t\t\tif ( $this.current_edit_record.station_id && $this.show_station_ui ) {\n\t\t\t\tIndexViewController.openEditView( $this, 'Station', $this.current_edit_record.station_id );\n\t\t\t}\n\n\t\t} );\n\n\t\t//Split Punch Control\n\t\tform_item_input = Global.loadWidgetByName( FormItemType.CHECKBOX );\n\t\tform_item_input.TCheckbox( { field: 'split_punch_control' } );\n\t\tthis.addEditFieldToColumn( $.i18n._( 'Split Existing Punches' ), form_item_input, tab_punch_column1, '', null, true );\n\t\tif ( this.is_add == false ) {\n\t\t\tthis.detachElement( 'split_punch_control' );\n\t\t}\n\n\t\t//Punch Image\n\t\tform_item_input = Global.loadWidgetByName( FormItemType.IMAGE );\n\t\tform_item_input.TImage( { field: 'punch_image' } );\n\t\tthis.addEditFieldToColumn( $.i18n._( 'Image' ), form_item_input, tab_punch_column1, '', null, true, true );\n\n\t\tif ( this.is_mass_editing ) {\n\t\t\tthis.detachElement( 'punch_image' );\n\t\t\tthis.detachElement( 'user_id' );\n\t\t}\n\t}\n\n\tonSourceDataCreate( target, source_data ) {\n\t\tvar display_columns = target.getDisplayColumns();\n\t\tvar first_item = {};\n\t\tvar second_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\n\t\t\tsecond_item.id = 'ffffffff-ffff-ffff-ffff-000000000002';\n\t\t\tsecond_item[content.name] = $.i18n._( '-- Current Shift --' );\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\n\t\tsource_data.unshift( second_item );\n\t\tsource_data.unshift( first_item );\n\n\t\treturn source_data;\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\tvar widgetContainer = this.edit_view_form_item_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\tswitch ( key ) {\n\t\t\t\tcase 'punch_dates':\n\t\t\t\t\tif ( !this.is_mass_editing && ( this.isMassAdding() || !this.current_edit_record.id || this.current_edit_record.id == TTUUID.zero_id ) ) {\n\t\t\t\t\t\tthis.attachElement( key );\n\t\t\t\t\t\twidget.css( 'opacity', 1 ); //show\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis.detachElement( key );\n\t\t\t\t\t\twidget.css( 'opacity', 0 ); //hide\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'punch_date':\n\t\t\t\t\tif ( !this.is_mass_editing && ( this.isMassAdding() || !this.current_edit_record.id || this.current_edit_record.id == TTUUID.zero_id ) ) {\n\t\t\t\t\t\tthis.detachElement( key );\n\t\t\t\t\t\twidget.css( 'opacity', 0 ); //hide - opposite from above\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis.attachElement( key );\n\t\t\t\t\t\twidget.css( 'opacity', 1 ); //show\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t}\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\n\t\t\t\t\twidget.setEnabled( true );\n\n\t\t\t\t}\n\t\t\t}\n\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\trecord.id = this.mass_edit_record_ids[0];\n\t\t\trecord = this.uniformVariable( record );\n\n\t\t} else {\n\t\t\trecord = this.current_edit_record;\n\t\t\trecord = this.uniformVariable( record );\n\t\t}\n\n\t\tthis.api['validate' + this.api.key_name]( record, {\n\t\t\tonResult: function( result ) {\n\t\t\t\t$this.validateResult( result );\n\n\t\t\t}\n\t\t} );\n\t}\n\n\t// TODO: not ideal to need to have this here. want to use the base view version,\n\t// but need this in order to prevent it using the uniformVariable function in BaseViewController version,\n\t// as Punches uniformVariable function does something additional\n\tbuildMassEditSaveRecord( mass_edit_record_ids, changed_fields ) {\n\t\tvar $this = this;\n\t\tvar mass_records = [];\n\t\t$.each( mass_edit_record_ids, function( index, value ) {\n\t\t\tvar common_record = Global.clone( changed_fields );\n\t\t\tcommon_record.id = value;\n\t\t\tmass_records.push( common_record );\n\t\t} );\n\t\treturn mass_records;\n\t}\n\n\tbuildMassAddRecord( current_edit_record ) {\n\t\tvar record = [];\n\t\tvar dates_array = current_edit_record.punch_dates;\n\n\t\tif ( dates_array && dates_array.indexOf( ' - ' ) > 0 ) {\n\t\t\tdates_array = this.parserDatesRange( dates_array );\n\t\t}\n\n\t\tif ( dates_array ) {\n\t\t\tfor ( var i = 0; i < dates_array.length; i++ ) {\n\t\t\t\tvar common_record = Global.clone( current_edit_record );\n\t\t\t\tdelete common_record.punch_dates;\n\t\t\t\tcommon_record.punch_date = dates_array[i];\n\t\t\t\tvar user_id = this.current_edit_record.user_id;\n\n\t\t\t\tif ( Global.isArray( user_id ) ) {\n\t\t\t\t\tfor ( var j = 0; j < user_id.length; j++ ) {\n\t\t\t\t\t\tvar final_record = Global.clone( common_record );\n\t\t\t\t\t\tfinal_record.user_id = this.current_edit_record.user_id[j];\n\t\t\t\t\t\trecord.push( final_record );\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\trecord.push( common_record );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn 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\n\t\tresultArray.push( dates[1] );\n\n\t\treturn resultArray;\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\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 'punch_dates':\n\t\t\t\t\t\tvar date_array;\n\t\t\t\t\t\tif ( !this.current_edit_record.punch_dates ) {\n\t\t\t\t\t\t\tdate_array = [this.current_edit_record['punch_date']];\n\t\t\t\t\t\t\tthis.current_edit_record.punch_dates = date_array;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tdate_array = this.current_edit_record.punch_dates;\n\t\t\t\t\t\t}\n\t\t\t\t\t\twidget.setValue( date_array );\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'country': //popular case\n\t\t\t\t\t\tthis.setCountryValue( widget, key );\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'enable_email_notification_message':\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_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 'punch_tag_quick_search':\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'job_quick_search':\n//\t\t\t\t\t\twidget.setValue( this.current_edit_record['job_id'] ? this.current_edit_record['job_id'] : 0 );\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'job_item_quick_search':\n//\t\t\t\t\t\twidget.setValue( this.current_edit_record['job_item_id'] ? this.current_edit_record['job_item_id'] : 0 );\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'station_id':\n\t\t\t\t\t\tif ( this.current_edit_record[key] ) {\n\t\t\t\t\t\t\tthis.setStation();\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\twidget.setValue( 'N/A' );\n\t\t\t\t\t\t\twidget.css( 'cursor', 'default' );\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'punch_image':\n\t\t\t\t\t\tvar station_form_item = this.edit_view_form_item_dic['station_id'];\n\t\t\t\t\t\tif ( this.current_edit_record['has_image'] ) {\n\t\t\t\t\t\t\tthis.attachElement( 'punch_image' );\n\t\t\t\t\t\t\twidget.setValue( ServiceCaller.getURLByObjectType( 'file_download' ) + '&object_type=punch_image&parent_id=' + this.current_edit_record.user_id + '&object_id=' + this.current_edit_record.id );\n\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tthis.detachElement( 'punch_image' );\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\twidget.setValue( this.current_edit_record[key] );\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t}\n\t\t}\n\n\t\tvar actual_time_value;\n\t\tif ( this.current_edit_record.id ) {\n\n\t\t\tif ( this.current_edit_record.actual_time_stamp ) {\n\t\t\t\tactual_time_value = $.i18n._( 'Actual Time' ) + ': ' + this.current_edit_record.actual_time_stamp;\n\t\t\t} else {\n\t\t\t\tactual_time_value = 'N/A';\n\t\t\t}\n\n\t\t}\n\t\tthis.actual_time_label.text( actual_time_value );\n\n\t\tthis.collectUIDataToCurrentEditRecord();\n\t\tthis.setLocationValue();\n\n\t\tthis.setEditViewDataDone();\n\t\tthis.isEditChange();\n\t}\n\n\tsetLocationValue( location_data ) {\n\t\tif ( Global.getProductEdition() >= 15 ) {\n\t\t\tif ( location_data ) {\n\t\t\t\tthis.current_edit_record.latitude = location_data.latitude;\n\t\t\t\tthis.current_edit_record.longitude = location_data.longitude;\n\t\t\t\tthis.current_edit_record.position_accuracy = location_data.position_accuracy; //If position is manually modified, it should always be set to 0m.\n\t\t\t}\n\t\t\tthis.edit_view_ui_dic['latitude'].setValue( this.current_edit_record.latitude );\n\t\t\tthis.edit_view_ui_dic['longitude'].setValue( this.current_edit_record.longitude );\n\t\t\tthis.edit_view_ui_dic['position_accuracy'].setValue( this.current_edit_record.position_accuracy ? this.current_edit_record.position_accuracy : 0 );\n\n\t\t\tif ( !this.current_edit_record.latitude && !this.is_mass_editing ) {\n\t\t\t\tthis.location_wrapper.hide();\n\t\t\t} else {\n\t\t\t\tif ( this.show_location_ui ) {\n\t\t\t\t\tthis.location_wrapper.show();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tisEditChange() {\n\n\t\tif ( this.current_edit_record.id || this.is_mass_editing ) {\n\t\t\tthis.edit_view_ui_dic['user_id'].setEnabled( false );\n\t\t} else {\n\t\t\tthis.edit_view_ui_dic['user_id'].setEnabled( true );\n\t\t}\n\t}\n\n\t//set tab 0 visible after all data set done. This be hide when init edit view data\n\tsetEditViewDataDone() {\n\t\t// Remove this on 14.9.14 because adding tab url support, ned set url when tab index change and\n\t\t// need know what's current doing action. See if this cause any problem\n\t\t//LocalCacheData.current_doing_context_action = '';\n\t\tthis.setTabOVisibility( true );\n\n\t\tif ( this.is_edit == true ) {\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\tif ( this.is_edit == false && ( this.current_edit_record.latitude == 0 || this.current_edit_record.longitude == 0 ) ) {\n\t\t\t$( '.widget-h-box-mapLocationWrapper' ).parents( '.edit-view-form-item-div' ).hide();\n\t\t} else {\n\t\t\tif ( this.show_location_ui ) {\n\t\t\t\t$( '.widget-h-box-mapLocationWrapper' ).parents( '.edit-view-form-item-div' ).show();\n\t\t\t}\n\t\t}\n\n\t\tthis.navigation.setValue( this.current_edit_record.id );\n\n\t\t$( '.edit-view-tab-bar' ).css( 'opacity', 1 );\n\t\tTTPromise.resolve( 'init', 'init' );\n\t}\n\n\tsetSubLogViewFilter() {\n\t\tif ( !this.sub_log_view_controller ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tthis.sub_log_view_controller.getSubViewFilter = function( filter ) {\n\t\t\tfilter['table_name_object_id'] = {\n\t\t\t\t'punch': [this.parent_edit_record.id],\n\t\t\t\t'punch_control': [this.parent_edit_record.punch_control_id]\n\t\t\t};\n\n\t\t\treturn filter;\n\t\t};\n\n\t\treturn true;\n\t}\n\n\tbuildOtherFieldUI( field, label ) {\n\n\t\tif ( !this.edit_view_tab ) {\n\t\t\treturn;\n\t\t}\n\n\t\tvar form_item_input;\n\t\tvar $this = this;\n\t\tvar tab_punch = this.edit_view_tab.find( '#tab_punch' );\n\t\tvar tab_punch_column1 = tab_punch.find( '.first-column' );\n\n\t\tif ( $this.edit_view_ui_dic[field] ) {\n\t\t\tform_item_input = $this.edit_view_ui_dic[field];\n\t\t\tform_item_input.setValue( $this.current_edit_record[field] );\n\t\t} else {\n\t\t\tform_item_input = Global.loadWidgetByName( FormItemType.TEXT_INPUT );\n\t\t\tform_item_input.TTextInput( { field: field } );\n\t\t\tvar input_div = $this.addEditFieldToColumn( label, form_item_input, tab_punch_column1 );\n\n\t\t\tinput_div.insertBefore( this.edit_view_form_item_dic['note'] );\n\n\t\t\tform_item_input.setValue( $this.current_edit_record[field] );\n\t\t}\n\t\tform_item_input.css( 'opacity', 1 );\n\t\tform_item_input.css( 'minWidth', 300 );\n\n\t\tif ( $this.is_viewing ) {\n\t\t\tform_item_input.setEnabled( false );\n\t\t} else {\n\t\t\tform_item_input.setEnabled( true );\n\t\t}\n\t}\n\n\tonAddResult( result ) {\n\t\tvar $this = this;\n\t\tvar result_data = result.getResult();\n\n\t\tif ( !result_data ) {\n\t\t\tresult_data = [];\n\t\t}\n\n\t\tresult_data.company = LocalCacheData.current_company.name;\n\t\tresult_data.punch_date = ( new Date() ).format();\n\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\n\t\t$this.current_edit_record = result_data;\n\t\t$this.initEditView();\n\t}\n\n\tbuildSearchFields() {\n\n\t\tsuper.buildSearchFields();\n\t\tvar default_args = { permission_section: 'punch' };\n\t\tthis.search_fields = [\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: 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._( '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' ),\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\tdefault_args: default_args,\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: 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._( '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._( 'Type' ),\n\t\t\t\tin_column: 1,\n\t\t\t\tfield: 'type_id',\n\t\t\t\tmultiple: true,\n\t\t\t\tbasic_search: true,\n\t\t\t\tadv_search: 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._( 'Group' ),\n\t\t\t\tin_column: 2,\n\t\t\t\tmultiple: true,\n\t\t\t\tfield: 'group_id',\n\t\t\t\tlayout_name: 'global_tree_column',\n\t\t\t\ttree_mode: true,\n\t\t\t\tbasic_search: 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._( 'Title' ),\n\t\t\t\tin_column: 2,\n\t\t\t\tfield: 'title_id',\n\t\t\t\tlayout_name: 'global_user_title',\n\t\t\t\tapi_class: TTAPI.APIUserTitle,\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._( 'Punch 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\tform_item_type: FormItemType.AWESOME_BOX\n\t\t\t} ),\n\n\t\t\tnew SearchField( {\n\t\t\t\tlabel: $.i18n._( 'Punch 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\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\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\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._( 'Punch Tags' ),\n\t\t\t\tin_column: 2,\n\t\t\t\tfield: 'punch_tag_id',\n\t\t\t\tlayout_name: 'global_punch_tag',\n\t\t\t\tapi_class: ( Global.getProductEdition() >= 20 ) ? TTAPI.APIPunchTag : null,\n\t\t\t\tmultiple: true,\n\t\t\t\tbasic_search: false,\n\t\t\t\tadv_search: ( this.show_punch_tag_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._( '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: 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._( '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: false,\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\tgetCustomContextMenuModel() {\n\t\tvar context_menu_model = {\n\t\t\texclude: ['copy'],\n\t\t\tinclude: [\n\t\t\t\t{\n\t\t\t\t\tlabel: $.i18n._( 'Jump To' ),\n\t\t\t\t\tid: 'jump_to_header',\n\t\t\t\t\tmenu_align: 'right',\n\t\t\t\t\taction_group: 'jump_to',\n\t\t\t\t\taction_group_header: true,\n\t\t\t\t\tsort_order: 9050,\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\tsort_order: 9050,\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._( '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\tsort_order: 9050,\n\t\t\t\t\tgroup: 'navigation',\n\t\t\t\t\t}\n\t\t\t]\n\t\t};\n\n\t\tif ( Global.getProductEdition() >= 15 ) {\n\t\t\tcontext_menu_model.include.push(\n\t\t\t\t{\n\t\t\t\t\tlabel: $.i18n._( 'Map' ),\n\t\t\t\t\tid: 'map',\n\t\t\t\t\tmenu_align: 'right',\n\t\t\t\t\tgroup: 'other',\n\t\t\t\t\tvue_icon: 'tticon tticon-map_black_24dp',\n\t\t\t\t\tsort_order: 8000,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: $.i18n._( 'Import' ),\n\t\t\t\t\tid: 'import_icon',\n\t\t\t\t\tmenu_align: 'right',\n\t\t\t\t\taction_group: 'import_export',\n\t\t\t\t\tgroup: 'other',\n\t\t\t\t\tvue_icon: 'tticon tticon-file_download_black_24dp',\n\t\t\t\t\tsort_order: 9010\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\n\t\treturn context_menu_model;\n\t}\n\n\tonMapClick() {\n\t\t// only trigger map load in specific product editions.\n\t\tif ( ( Global.getProductEdition() >= 15 ) ) {\n\t\t\tProgressBar.showProgressBar();\n\n\t\t\t// TODO: this is repeated below, perhaps in future now that getFilterColumnsFromDisplayColumns() is commented out, this can be consolidated?\n\t\t\tvar data = {\n\t\t\t\tfilter_columns: {\n\t\t\t\t\tid: true,\n\t\t\t\t\tlatitude: true,\n\t\t\t\t\tlongitude: true,\n\t\t\t\t\tpunch_date: true,\n\t\t\t\t\tpunch_time: true,\n\t\t\t\t\tposition_accuracy: true,\n\t\t\t\t\tuser_id: true\n\t\t\t\t}\n\t\t\t};\n\n\t\t\tvar punches = [];\n\t\t\tvar map_options = {};\n\n\t\t\tif ( this.is_edit ) {\n\t\t\t\t//when editing, if the user reloads, the grid's selected id array become the whole grid.\n\t\t\t\t//to avoid mapping every punch in that scenario we need to grab the current_edit_record, rather than pull data from getGridSelectIdArray()\n\t\t\t\t//check for mass edit as well. <-- not sure what this refers to, assuming the same happens in mass edit, but maps are disabled on mass edit atm.\n\t\t\t\tpunches.push( this.current_edit_record );\n\t\t\t\t// from the edit view we want to allow single markers to be draggable.\n\t\t\t\tif ( !this.is_viewing ) {\n\t\t\t\t\t// make sure that when view only (so no save) marker is not draggable, and thus no new marker can be added either.\n\t\t\t\t\tmap_options.single_marker_draggable = true;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tvar ids = this.getGridSelectIdArray();\n\t\t\t\t// from the map icon on the ribbon bar we want to PREVENT single markers being draggable. As this is intended as a read only view.\n\t\t\t\tmap_options.single_marker_draggable = false;\n\n\t\t\t\tdata.filter_data = Global.convertLayoutFilterToAPIFilter( this.select_layout );\n\t\t\t\tif ( ids.length > 0 ) {\n\t\t\t\t\tdata.filter_data.id = ids;\n\t\t\t\t}\n\t\t\t\t// data.filter_columns = this.getFilterColumnsFromDisplayColumns()\n\t\t\t\tdata.filter_columns.first_name = true;\n\t\t\t\tdata.filter_columns.last_name = true;\n\t\t\t\tdata.filter_columns.user_id = true;\n\t\t\t\tdata.filter_columns.date_stamp = true; // #2735 - grouping punches by date_stamp instead of punch_date, to allow cross date punch controls to plot distances.\n\t\t\t\tdata.filter_columns.punch_date = true;\n\t\t\t\tdata.filter_columns.punch_time = true;\n\t\t\t\tdata.filter_columns.time_stamp = true;\n\t\t\t\tdata.filter_columns.status = true;\n\t\t\t\tdata.filter_columns.punch_control_id = true;\n\t\t\t\tdata.filter_columns.branch = true;\n\t\t\t\tdata.filter_columns.branch_id = true;\n\t\t\t\tdata.filter_columns.department = true;\n\t\t\t\tdata.filter_columns.department_id = true;\n\t\t\t\tdata.filter_columns.job_manual_id = true;\n\t\t\t\tdata.filter_columns.job = true;\n\t\t\t\tdata.filter_columns.job_id = true;\n\t\t\t\tdata.filter_columns.job_item_manual_id = true;\n\t\t\t\tdata.filter_columns.job_item = true; // also known as Task\n\t\t\t\tdata.filter_columns.job_item_id = true;\n\t\t\t\tdata.filter_columns.punch_tag_id = true;\n\t\t\t\tdata.filter_columns.total_time = true;\n\t\t\t\tdata.filter_columns.latitude = true;\n\t\t\t\tdata.filter_columns.longitude = true;\n\t\t\t\tdata.filter_columns.position_accuracy = true;\n\n\t\t\t\tpunches = this.api.getPunch( data, { async: false } ).getResult();\n\t\t\t}\n\n\t\t\tif ( !this.is_mass_editing ) {\n\t\t\t\tPromise.all(/* import() | leaflet-timetrex */[__webpack_require__.e(\"vendors-node_modules_leaflet_dist_images_marker-icon-2x_png-node_modules_leaflet_dist_images_-78d511\"), __webpack_require__.e(\"interface_html5_framework_leaflet_leaflet-timetrex_js\"), __webpack_require__.e(\"leaflet-timetrex\")]).then(__webpack_require__.bind(__webpack_require__, 6889)).then(( module )=>{\n\t\t\t\t\tvar processed_punches_for_map = module.TTConvertMapData.processPunchesFromViewController( punches, map_options );\n\t\t\t\t\tIndexViewController.openEditView( this, 'Map', processed_punches_for_map );\n\t\t\t\t}).catch( Global.importErrorHandler );\n\t\t\t}\n\t\t}\n\t}\n\n\tonCustomContextClick( id ) {\n\t\tswitch ( id ) {\n\t\t\tcase 'timesheet':\n\t\t\tcase 'edit_employee':\n\t\t\t\tthis.onNavigationClick( id );\n\t\t\t\tbreak;\n\t\t\tcase 'map':\n\t\t\t\tthis.onMapClick();\n\t\t\t\tbreak;\n\t\t\tcase 'import_icon':\n\t\t\t\tthis.onImportClick();\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\tonImportClick() {\n\t\tvar $this = this;\n\t\tIndexViewController.openWizard( 'ImportCSVWizard', 'Punch', function() {\n\t\t\t$this.search();\n\t\t} );\n\t}\n\n\tsetCustomDefaultMenuIcon( id, context_btn, grid_selected_length ) {\n\t\tswitch ( id ) {\n\t\t\tcase 'timesheet':\n\t\t\t\tthis.setDefaultMenuViewIcon( context_btn, grid_selected_length, 'punch' );\n\t\t\t\tbreak;\n\t\t\tcase 'edit_employee':\n\t\t\t\tthis.setDefaultMenuEditIcon( context_btn, grid_selected_length, 'user' );\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\tsetCustomEditMenuIcon( id, context_btn ) {\n\t\tswitch ( id ) {\n\t\t\tcase 'timesheet':\n\t\t\t\tthis.setEditMenuNavViewIcon( context_btn, 'punch' );\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}\n\t}\n\tonNavigationClick( iconName ) {\n\t\tvar $this = this;\n\t\tvar filter;\n\t\tvar temp_filter;\n\t\tvar grid_selected_id_array;\n\t\tvar grid_selected_length;\n\n\t\tswitch ( iconName ) {\n\t\t\tcase 'timesheet':\n\t\t\t\tfilter = { filter_data: {} };\n\t\t\t\tif ( Global.isSet( this.current_edit_record ) ) {\n\n\t\t\t\t\tfilter.user_id = this.current_edit_record.user_id;\n\t\t\t\t\tfilter.base_date = this.current_edit_record.punch_date;\n\t\t\t\t\tGlobal.addViewTab( this.viewId, $.i18n._( 'Punches' ), window.location.href );\n\t\t\t\t\tIndexViewController.goToView( 'TimeSheet', filter );\n\t\t\t\t} else {\n\t\t\t\t\ttemp_filter = {};\n\t\t\t\t\tgrid_selected_id_array = this.getGridSelectIdArray();\n\t\t\t\t\tgrid_selected_length = grid_selected_id_array.length;\n\n\t\t\t\t\tif ( grid_selected_length > 0 ) {\n\t\t\t\t\t\tvar selectedId = grid_selected_id_array[0];\n\n\t\t\t\t\t\ttemp_filter.filter_data = {};\n\t\t\t\t\t\ttemp_filter.filter_data.id = [selectedId];\n\n\t\t\t\t\t\tthis.api['get' + this.api.key_name]( temp_filter, {\n\t\t\t\t\t\t\tonResult: function( result ) {\n\n\t\t\t\t\t\t\t\tvar result_data = result.getResult();\n\n\t\t\t\t\t\t\t\tif ( !result_data ) {\n\t\t\t\t\t\t\t\t\tresult_data = [];\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tresult_data = result_data[0];\n\n\t\t\t\t\t\t\t\tfilter.user_id = result_data.user_id;\n\t\t\t\t\t\t\t\tfilter.base_date = result_data.punch_date;\n\n\t\t\t\t\t\t\t\tGlobal.addViewTab( $this.viewId, $.i18n._( 'Punches' ), window.location.href );\n\t\t\t\t\t\t\t\tIndexViewController.goToView( 'TimeSheet', filter );\n\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} );\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'edit_employee':\n\t\t\t\tfilter = { filter_data: {} };\n\t\t\t\tif ( Global.isSet( this.current_edit_record ) ) {\n\t\t\t\t\tIndexViewController.openEditView( this, 'Employee', this.current_edit_record.user_id );\n\t\t\t\t} else {\n\t\t\t\t\ttemp_filter = {};\n\t\t\t\t\tgrid_selected_id_array = this.getGridSelectIdArray();\n\t\t\t\t\tgrid_selected_length = grid_selected_id_array.length;\n\n\t\t\t\t\tif ( grid_selected_length > 0 ) {\n\t\t\t\t\t\tselectedId = grid_selected_id_array[0];\n\n\t\t\t\t\t\ttemp_filter.filter_data = {};\n\t\t\t\t\t\ttemp_filter.filter_data.id = [selectedId];\n\n\t\t\t\t\t\tthis.api['get' + this.api.key_name]( temp_filter, {\n\t\t\t\t\t\t\tonResult: function( result ) {\n\t\t\t\t\t\t\t\tvar result_data = result.getResult();\n\n\t\t\t\t\t\t\t\tif ( !result_data ) {\n\t\t\t\t\t\t\t\t\tresult_data = [];\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tresult_data = result_data[0];\n\n\t\t\t\t\t\t\t\tIndexViewController.openEditView( $this, 'Employee', result_data.user_id );\n\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} );\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\tsetEditMenuSaveAndContinueIcon( context_btn, pId ) {\n\t\tthis.saveAndContinueValidate( context_btn, pId );\n\n\t\tif ( this.is_mass_editing || this.is_viewing || this.isMassDateOrMassUser() ) {\n\t\t\tContextMenuManager.disableMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, false );\n\t\t}\n\t}\n\n\tcopyAsNewResetIds( data ) {\n\t\t//override where needed.\n\t\tdata.id = '';\n\t\tdata.punch_control_id = ''; //Clear the punch_control_id record as well so we don't force the punch to be assigned to it.\n\t\treturn data;\n\t}\n\n\t_continueDoCopyAsNew() {\n\t\tvar $this = this;\n\t\tthis.setCurrentEditViewState( 'new' );\n\t\tLocalCacheData.current_doing_context_action = 'copy_as_new';\n\t\tif ( Global.isSet( this.edit_view ) ) {\n\t\t\tthis.current_edit_record = this.copyAsNewResetIds( this.current_edit_record );\n\t\t\tvar navigation_div = this.edit_view.find( '.navigation-div' );\n\t\t\tnavigation_div.css( 'display', 'none' );\n\t\t\tthis.openEditView();\n\t\t\tthis.initEditView();\n\t\t\tthis.setEditMenu();\n\t\t\tthis.setTabStatus();\n\t\t\tthis.is_changed = false;\n\t\t\tProgressBar.closeOverlay();\n\t\t} else {\n\t\t\tsuper._continueDoCopyAsNew();\n\t\t}\n\t}\n\n\tisMassDateOrMassUser() {\n\t\tif ( this.isMassAdding() ) {\n\t\t\tif ( this.current_edit_record.punch_dates && this.current_edit_record.punch_dates.length > 1 ) {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\tif ( this.current_edit_record.user_id && this.current_edit_record.user_id.length > 1 ) {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\treturn false;\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tonSaveAndCopy( ignoreWarning ) {\n\t\tvar $this = this;\n\t\tif ( !Global.isSet( ignoreWarning ) ) {\n\t\t\tignoreWarning = false;\n\t\t}\n\t\tthis.is_add = true;\n\t\tthis.is_changed = false;\n\t\tLocalCacheData.current_doing_context_action = 'save_and_copy';\n\t\tvar record = this.current_edit_record;\n\t\trecord = this.uniformVariable( record );\n\n\t\tthis.clearNavigationData();\n\t\tthis.api['set' + this.api.key_name]( record, false, ignoreWarning, {\n\t\t\tonResult: function( result ) {\n\t\t\t\t$this.onSaveAndCopyResult( result );\n\n\t\t\t}\n\t\t} );\n\t}\n\n\tonSaveAndNewClick( ignoreWarning ) {\n\t\tvar $this = this;\n\t\tif ( !Global.isSet( ignoreWarning ) ) {\n\t\t\tignoreWarning = false;\n\t\t}\n\t\tthis.setCurrentEditViewState( 'new' );\n\t\tvar record = this.current_edit_record;\n\t\trecord = this.uniformVariable( record );\n\t\tthis.api['set' + this.api.key_name]( record, false, ignoreWarning, {\n\t\t\tonResult: function( result ) {\n\t\t\t\t$this.onSaveAndNewResult( result );\n\n\t\t\t}\n\t\t} );\n\t}\n\n\tonMassEditClick() {\n\n\t\tvar $this = this;\n\t\t$this.is_add = false;\n\t\t$this.is_viewing = false;\n\t\t$this.is_mass_editing = true;\n\t\tLocalCacheData.current_doing_context_action = 'mass_edit';\n\t\t$this.openEditView();\n\t\tvar filter = {};\n\t\tvar grid_selected_id_array = this.getGridSelectIdArray();\n\t\tvar grid_selected_length = grid_selected_id_array.length;\n\t\tthis.mass_edit_record_ids = [];\n\n\t\t$.each( grid_selected_id_array, function( index, value ) {\n\t\t\t$this.mass_edit_record_ids.push( value );\n\t\t} );\n\n\t\tfilter.filter_data = {};\n\t\tfilter.filter_data.id = this.mass_edit_record_ids;\n\n\t\tthis.api['getCommon' + this.api.key_name + 'Data']( filter, {\n\t\t\tonResult: function( result ) {\n\t\t\t\tvar result_data = result.getResult();\n\n\t\t\t\tif ( !result_data ) {\n\t\t\t\t\tresult_data = [];\n\t\t\t\t}\n\n\t\t\t\t$this.api['getOptions']( 'unique_columns', {\n\t\t\t\t\tonResult: function( result ) {\n\t\t\t\t\t\t$this.unique_columns = result.getResult();\n\t\t\t\t\t\t$this.api['getOptions']( 'linked_columns', {\n\t\t\t\t\t\t\tonResult: function( result1 ) {\n\t\t\t\t\t\t\t\t$this.linked_columns = result1.getResult();\n\n\t\t\t\t\t\t\t\tif ( $this.sub_view_mode && $this.parent_key ) {\n\t\t\t\t\t\t\t\t\tresult_data[$this.parent_key] = $this.parent_value;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t$this.current_edit_record = result_data;\n\t\t\t\t\t\t\t\t$this.initEditView();\n\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} );\n\n\t\t\t\t\t}\n\t\t\t\t} );\n\n\t\t\t}\n\t\t} );\n\t}\n\n\tonSaveAndContinue( ignoreWarning ) {\n\t\tvar $this = this;\n\t\tif ( !Global.isSet( ignoreWarning ) ) {\n\t\t\tignoreWarning = false;\n\t\t}\n\t\tthis.is_changed = false;\n\t\tLocalCacheData.current_doing_context_action = 'save_and_continue';\n\n\t\tif ( this.isMassAdding() ) {\n\n\t\t\tif ( this.current_edit_record.punch_dates && this.current_edit_record.punch_dates.length === 1 ) {\n\t\t\t\tthis.current_edit_record.punch_date = this.current_edit_record.punch_dates[0];\n\t\t\t}\n\n\t\t\tif ( this.current_edit_record.user_id && this.current_edit_record.user_id.length === 1 ) {\n\t\t\t\tthis.current_edit_record.user_id = this.current_edit_record.user_id[0];\n\t\t\t}\n\n\t\t}\n\n\t\tthis.current_edit_record = this.uniformVariable( this.current_edit_record );\n\n\t\tthis.api['set' + this.api.key_name]( this.current_edit_record, false, ignoreWarning, {\n\t\t\tonResult: function( result ) {\n\t\t\t\t$this.onSaveAndContinueResult( result );\n\t\t\t}\n\t\t} );\n\t}\n\n\tonFormItemChange( target, doNotValidate ) {\n\n\t\tvar $this = this;\n\t\tthis.setIsChanged( target );\n\t\tthis.setMassEditingFieldsWhenFormChange( target );\n\t\tvar key = target.getField();\n\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 'user_id':\n\t\t\t\tthis.setEditMenu();\n\t\t\t\tbreak;\n\t\t\tcase 'punch_date':\n\t\t\t\tthis.current_edit_record.punch_dates = [c_value];\n\t\t\t\tbreak;\n\t\t\tcase 'punch_dates':\n\t\t\t\tthis.setEditMenu();\n\t\t\t\tbreak;\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 '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\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}\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\tdefault:\n\t\t\t\tthis.current_edit_record[key] = c_value;\n\t\t\t\tbreak;\n\t\t}\n\n\t\tif ( !doNotValidate ) {\n\t\t\tthis.validate();\n\t\t}\n\t}\n\n\tonMapSaveClick( dataset, successCallback ) {\n\t\tthis.savePunchPosition( dataset, successCallback );\n\t}\n\n\tsavePunchPosition( moved_unsaved_markers, successCallback ) {\n\t\tif ( !moved_unsaved_markers || moved_unsaved_markers.length !== 1 ) {\n\t\t\tDebug.Text( 'ERROR: Invalid params/data passed to function.', 'PunchesViewController.js', 'PunchesViewController', 'savePunchPosition', 1 );\n\t\t\treturn false;\n\t\t}\n\n\t\t// Regardless of record type, we want to just pass the value back, rather than a api save from map, then another save from parent view.\n\t\t// Map info will only be saved if user clicks save on the parent edit view.\n\t\tthis.setLocationValue( moved_unsaved_markers[0] );\n\t\tsuccessCallback();\n\t\tthis.is_changed = true;\n\t\treturn true;\n\t}\n\n\tgetSelectEmployee( full_item ) {\n\t\tvar user;\n\t\tif ( full_item ) {\n\t\t\tuser = LocalCacheData.getLoginUser();\n\t\t} else {\n\t\t\tuser = LocalCacheData.getLoginUser().id;\n\t\t}\n\t\treturn user;\n\t}\n\n\tgetFilterColumnsFromDisplayColumns( column_filter, enable_system_columns ) {\n\t\tif ( column_filter == undefined ) {\n\t\t\tcolumn_filter = {};\n\t\t}\n\t\tcolumn_filter.latitude = true;\n\t\tcolumn_filter.longitude = true;\n\t\treturn this._getFilterColumnsFromDisplayColumns( column_filter, enable_system_columns );\n\t}\n\n\tisMassAdding() {\n\t\tif ( this.current_edit_record && ( Array.isArray( this.current_edit_record.user_id ) === true\n\t\t\t|| ( Array.isArray( this.current_edit_record.punch_dates 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