"use strict";(self.webpackChunktimetrex=self.webpackChunktimetrex||[]).push([["attendance-job_item_amendment-JobItemAmendmentViewController"],{1960:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"JobItemAmendmentViewController\": () => (/* binding */ JobItemAmendmentViewController)\n/* harmony export */ });\n/* provided dependency */ var _ = __webpack_require__(9050);\n/* provided dependency */ var $ = __webpack_require__(9755);\nclass JobItemAmendmentViewController extends BaseViewController {\n\tconstructor( options = {} ) {\n\t\t_.defaults( options, {\n\t\t\tel: '#job_item_amendment_view_container',\n\n\n\t\t\tcurrent_default_record: {}\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 = 'JobItemAmendmentEditView.html';\n\t\tthis.permission_id = 'job_item';\n\t\tthis.viewId = 'JobItemAmendment';\n\t\tthis.script_name = 'JobItemAmendmentView';\n\t\tthis.table_name_key = 'job_item_amendment';\n\t\tthis.context_menu_name = $.i18n._( 'Task Amendments' );\n\t\tthis.navigation_label = $.i18n._( 'Task Amendment' );\n\n\t\tthis.api = TTAPI.APIJobItemAmendment;\n\n\t\tthis.job_api = TTAPI.APIJob;\n\t\tthis.job_item_api = TTAPI.APIJobItem;\n\n\t\tthis.render();\n\t\tthis.buildContextMenu();\n\n\t\tthis.initData();\n\t}\n\n\tgetCustomContextMenuModel() {\n\t\tvar context_menu_model = {\n\t\t\texclude: ['copy'],\n\t\t\tinclude: []\n\t\t};\n\n\t\treturn context_menu_model;\n\t}\n\n\tbuildEditViewUI() {\n\n\t\tsuper.buildEditViewUI();\n\n\t\tvar $this = this;\n\n\t\tvar tab_model = {\n\t\t\t'tab_task_amendment': { 'label': $.i18n._( 'Task Amendment' ) },\n\t\t\t'tab_audit': true,\n\t\t};\n\t\tthis.setTabModel( tab_model );\n\n\t\tthis.navigation.AComboBox( {\n\t\t\tapi_class: TTAPI.APIJobItemAmendment,\n\t\t\tid: this.script_name + '_navigation',\n\t\t\tallow_multiple_selection: false,\n\t\t\tlayout_name: 'global_job_item_amendment',\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_task_amendment = this.edit_view_tab.find( '#tab_task_amendment' );\n\n\t\tvar tab_task_amendment_column1 = tab_task_amendment.find( '.first-column' );\n\n\t\tthis.edit_view_tabs[0] = [];\n\n\t\tthis.edit_view_tabs[0].push( tab_task_amendment_column1 );\n\n\t\tvar form_item_input;\n\t\tvar widgetContainer;\n\t\tvar label;\n\n\t\t//Job\n\t\tform_item_input = Global.loadWidgetByName( FormItemType.AWESOME_BOX );\n\n\t\tform_item_input.AComboBox( {\n\t\t\tapi_class: TTAPI.APIJob,\n\t\t\tallow_multiple_selection: false,\n\t\t\tlayout_name: 'global_job',\n\t\t\tshow_search_inputs: true,\n\t\t\tset_empty: false,\n\t\t\tsetRealValueCallBack: ( function( val ) {\n\n\t\t\t\tif ( val ) {\n\t\t\t\t\tjob_coder.setValue( val.manual_id );\n\t\t\t\t}\n\t\t\t} ),\n\t\t\tfield: 'job_id'\n\t\t} );\n\n\t\twidgetContainer = $( '
' );\n\n\t\tvar job_coder = Global.loadWidgetByName( FormItemType.TEXT_INPUT );\n\t\tjob_coder.TTextInput( { field: 'job_quick_search', disable_keyup_event: true } );\n\t\tjob_coder.addClass( 'job-coder' );\n\n\t\twidgetContainer.append( job_coder );\n\t\twidgetContainer.append( form_item_input );\n\t\tthis.addEditFieldToColumn( $.i18n._( 'Job' ), [form_item_input, job_coder], tab_task_amendment_column1, '', widgetContainer );\n\n\t\t// Task\n\t\tform_item_input = Global.loadWidgetByName( FormItemType.AWESOME_BOX );\n\n\t\tform_item_input.AComboBox( {\n\t\t\tapi_class: TTAPI.APIJobItem,\n\t\t\tallow_multiple_selection: false,\n\t\t\tlayout_name: 'global_job_item',\n\t\t\tshow_search_inputs: true,\n\t\t\tset_empty: true,\n\t\t\tsetRealValueCallBack: ( function( val ) {\n\n\t\t\t\tif ( val ) {\n\t\t\t\t\tjob_item_coder.setValue( val.manual_id );\n\t\t\t\t}\n\t\t\t} ),\n\t\t\tfield: 'item_id'\n\t\t} );\n\n\t\twidgetContainer = $( '' );\n\n\t\tvar job_item_coder = Global.loadWidgetByName( FormItemType.TEXT_INPUT );\n\t\tjob_item_coder.TTextInput( { field: 'job_item_quick_search', disable_keyup_event: true } );\n\t\tjob_item_coder.addClass( 'job-coder' );\n\n\t\twidgetContainer.append( job_item_coder );\n\t\twidgetContainer.append( form_item_input );\n\t\tthis.addEditFieldToColumn( $.i18n._( 'Task' ), [form_item_input, job_item_coder], tab_task_amendment_column1, '', widgetContainer );\n\n\t\t//Estimated Time\n\t\tform_item_input = Global.loadWidgetByName( FormItemType.TEXT_INPUT );\n\t\tform_item_input.TTextInput( { field: 'estimate_time', mode: 'time_unit', need_parser_sec: true } );\n\n\t\tthis.addEditFieldToColumn( $.i18n._( 'Estimated Time' ), form_item_input, tab_task_amendment_column1, '', null, true, true );\n\n\t\t//Billable Rate\n\t\tform_item_input = Global.loadWidgetByName( FormItemType.TEXT_INPUT );\n\n\t\tform_item_input.TTextInput( { field: 'billable_rate', width: 86 } );\n\t\tthis.addEditFieldToColumn( $.i18n._( 'Billable Rate' ), form_item_input, tab_task_amendment_column1 );\n\n\t\t//Minimum Time\n\t\tform_item_input = Global.loadWidgetByName( FormItemType.TEXT_INPUT );\n\t\tform_item_input.TTextInput( { field: 'minimum_time', mode: 'time_unit', need_parser_sec: true } );\n\n\t\tthis.addEditFieldToColumn( $.i18n._( 'Minimum Billable Time' ), form_item_input, tab_task_amendment_column1, '', null );\n\n\t\t//Estimated Quantity\n\t\tform_item_input = Global.loadWidgetByName( FormItemType.TEXT_INPUT );\n\n\t\tform_item_input.TTextInput( { field: 'estimate_quantity', width: 150 } );\n\t\tthis.addEditFieldToColumn( $.i18n._( 'Estimated Quantity' ), form_item_input, tab_task_amendment_column1 );\n\n\t\t//Estimated Bad Quantity\n\t\tform_item_input = Global.loadWidgetByName( FormItemType.TEXT_INPUT );\n\n\t\tform_item_input.TTextInput( { field: 'estimate_bad_quantity', width: 150 } );\n\t\tthis.addEditFieldToColumn( $.i18n._( 'Estimated Bad Quantity' ), form_item_input, tab_task_amendment_column1 );\n\n\t\t//Bad Quantity Rate\n\t\tform_item_input = Global.loadWidgetByName( FormItemType.TEXT_INPUT );\n\n\t\tform_item_input.TTextInput( { field: 'bad_quantity_rate', width: 150 } );\n\t\tthis.addEditFieldToColumn( $.i18n._( 'Bad Quantity Rate' ), form_item_input, tab_task_amendment_column1 );\n\t}\n\n\t/* jshint ignore:start */\n\tsetCurrentEditRecordData() {\n\t\t//Set current edit record data to all widgets\n\n\t\tif ( Global.isFalseOrNull( this.current_edit_record['user_id'] ) ) {\n\t\t\tthis.current_edit_record['user_id'] = LocalCacheData.getLoginUser().id;\n\t\t}\n\n\t\tfor ( var key in this.current_edit_record ) {\n\t\t\tvar widget = this.edit_view_ui_dic[key];\n\t\t\tif ( Global.isSet( widget ) ) {\n\t\t\t\tswitch ( key ) {\n\t\t\t\t\tcase 'item_id':\n\t\t\t\t\t\tvar args = {};\n\t\t\t\t\t\targs.filter_data = { job_id: this.current_edit_record.job_id };\n\t\t\t\t\t\twidget.setDefaultArgs( args );\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\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['item_id'] ? this.current_edit_record['item_id'] : 0 );\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tif ( Global.isSet( this.current_default_record[key] ) ) {\n\t\t\t\t\t\t\tthis.current_edit_record[key] = this.current_default_record[key];\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}\n\n\t\t\t}\n\t\t}\n\n\t\tthis.collectUIDataToCurrentEditRecord();\n\t\tthis.setEditViewDataDone();\n\t}\n\n\tsetEditViewDataDone() {\n\t\tthis.current_default_record = {};\n\t\tsuper.setEditViewDataDone();\n\t}\n\n\t/* jshint ignore:start */\n\tonFormItemChange( target, doNotValidate ) {\n\t\tvar $this = this;\n\n\t\tthis.setIsChanged( target );\n\t\tthis.setMassEditingFieldsWhenFormChange( target );\n\n\t\tvar key = target.getField();\n\t\tvar c_value = target.getValue();\n\n\t\tthis.current_edit_record[key] = c_value;\n\n\t\tvar amount_arr = false;\n\n\t\tswitch ( key ) {\n\t\t\tcase 'job_id':\n\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\tthis.setJobItemValueWhenJobChanged( target.getValue( true ), 'item_id', { job_id: $this.current_edit_record.job_id } );\n\t\t\t\tthis.edit_view_ui_dic['job_quick_search'].setCheckBox( true );\n\t\t\t\tbreak;\n\t\t\tcase 'item_id':\n\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\tthis.setJobItemAmendmentDefaultData();\n\t\t\t\tthis.edit_view_ui_dic['job_item_quick_search'].setCheckBox( true );\n\t\t\t\tbreak;\n\t\t\tcase 'job_quick_search':\n\t\t\tcase 'job_item_quick_search':\n\t\t\t\tthis.onJobQuickSearch( key, c_value, 'job_id', 'item_id' );\n\n\t\t\t\tTTPromise.wait( 'BaseViewController', 'onJobQuickSearch', function() {\n\t\t\t\t\t$this.setJobItemAmendmentDefaultData();\n\t\t\t\t} );\n\n\t\t\t\tTTPromise.wait( 'BaseViewController', 'setJobItemValueWhenJobChanged', function() {\n\t\t\t\t\t$this.setJobItemAmendmentDefaultData();\n\t\t\t\t} );\n\n\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\tvar doNotValidate = true;\n\n\t\t\t\tbreak;\n\n\t\t}\n\n\t\tif ( !doNotValidate ) {\n\t\t\tthis.validate();\n\t\t}\n\t}\n\n\tvalidate() {\n\n\t\tvar $this = this;\n\n\t\tvar record = {};\n\n\t\tif ( this.is_mass_editing ) {\n\n\t\t\tif ( $this.sub_view_mode && $this.parent_key ) {\n\t\t\t\trecord[$this.parent_key] = $this.parent_value;\n\t\t\t}\n\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['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\tsetJobItemAmendmentDefaultData() {\n\t\tvar $this = this;\n\t\tvar job_item_id;\n\t\tif ( TTUUID.isUUID( this.current_edit_record.item_id ) && this.current_edit_record.item_id != TTUUID.zero_id && this.is_add ) {\n\t\t\tjob_item_id = this.current_edit_record.item_id;\n\t\t\tthis.api['get' + this.api.key_name + 'DefaultData']( job_item_id, {\n\t\t\t\tonResult: function( result ) {\n\t\t\t\t\tvar result_data = result.getResult();\n\t\t\t\t\tif ( !result_data ) {\n\t\t\t\t\t\tresult_data = [];\n\t\t\t\t\t}\n\n\t\t\t\t\t$this.current_default_record = result_data;\n\t\t\t\t\t$this.setCurrentEditRecordData();\n\t\t\t\t}\n\t\t\t} );\n\t\t}\n\t}\n\n\t/* jshint ignore:end */\n\n}\n\nJobItemAmendmentViewController.loadSubView = function( container, beforeViewLoadedFun, afterViewLoadedFun ) {\n\n\tGlobal.loadViewSource( 'JobItemAmendment', 'SubJobItemAmendmentView.html', function( result ) {\n\t\tvar args = {};\n\t\tvar template = _.template( result );\n\n\t\tif ( Global.isSet( beforeViewLoadedFun ) ) {\n\t\t\tbeforeViewLoadedFun();\n\t\t}\n\n\t\tif ( Global.isSet( container ) ) {\n\t\t\tcontainer.html( template( args ) );\n\t\t\tif ( Global.isSet( afterViewLoadedFun ) ) {\n\n\t\t\t\tTTPromise.wait( 'BaseViewController', 'initialize', function() {\n\t\t\t\t\tafterViewLoadedFun( sub_job_item_amendment_view_controller );\n\t\t\t\t} );\n\t\t\t}\n\t\t}\n\t} );\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTk2MC5qcyIsIm1hcHBpbmdzIjoiOzs7Ozs7QUFBTztBQUNQLDJCQUEyQjtBQUMzQixFQUFFLENBQUM7QUFDSDs7O0FBR0E7QUFDQSxJQUFJOztBQUVKO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQSwyQkFBMkIsQ0FBQztBQUM1QiwwQkFBMEIsQ0FBQzs7QUFFM0I7O0FBRUE7QUFDQTs7QUFFQTtBQUNBOztBQUVBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBOztBQUVBOztBQUVBOztBQUVBOztBQUVBO0FBQ0EsMkJBQTJCLFNBQVMsQ0FBQyw2QkFBNkI7QUF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