"use strict";(self.webpackChunktimetrex=self.webpackChunktimetrex||[]).push([["wizard-job_invoice-JobInvoiceWizardController"],{428:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"JobInvoiceWizardController\": () => (/* binding */ JobInvoiceWizardController)\n/* harmony export */ });\n/* provided dependency */ var _ = __webpack_require__(9050);\n/* provided dependency */ var $ = __webpack_require__(9755);\nclass JobInvoiceWizardController extends BaseWizardController {\n\tconstructor( options = {} ) {\n\t\t_.defaults( options, {\n\t\t\tel: '.wizard-bg'\n\t\t} );\n\n\t\tsuper( options );\n\t}\n\n\tinit( options ) {\n\t\t//this._super('initialize', options );\n\n\t\tthis.title = $.i18n._( 'Job Invoice Wizard' );\n\t\tthis.steps = 3;\n\t\tthis.current_step = 1;\n\n\t\tthis.render();\n\t}\n\n\trender() {\n\t\tsuper.render();\n\n\t\tthis.initCurrentStep();\n\t}\n\n\t//Create each page UI\n\tbuildCurrentStepUI() {\n\t\tvar $this = this;\n\t\tthis.content_div.empty();\n\n\t\tthis.stepsWidgetDic[this.current_step] = {};\n\t\tswitch ( this.current_step ) {\n\t\t\tcase 1:\n\t\t\t\tvar label = this.getLabel();\n\t\t\t\tlabel.text( $.i18n._( 'Select one or more jobs you wish to invoice' ) );\n\n\t\t\t\tvar a_combobox = this.getAComboBox( TTAPI.APIJob, true, 'global_job', 'job_id', true );\n\t\t\t\tvar div = $( '
' );\n\t\t\t\tdiv.append( a_combobox );\n\n\t\t\t\tthis.content_div.append( label );\n\t\t\t\tthis.content_div.append( div );\n\n\t\t\t\tthis.stepsWidgetDic[this.current_step][a_combobox.getField()] = a_combobox;\n\n\t\t\t\tbreak;\n\t\t\tcase 2:\n\t\t\t\tlabel = this.getLabel();\n\t\t\t\tlabel.text( $.i18n._( 'Select the date range you wish to invoice jobs for' ) );\n\n\t\t\t\tthis.content_div.append( label );\n\n\t\t\t\tvar form_item = $( Global.loadWidget( 'global/widgets/wizard_form_item/WizardFormItem.html' ) );\n\t\t\t\tvar form_item_label = form_item.find( '.form-item-label' );\n\t\t\t\tvar form_item_input_div = form_item.find( '.form-item-input-div' );\n\n\t\t\t\tvar combobox = this.getComboBox( 'time_period', true );\n\n\t\t\t\tform_item_label.text( $.i18n._( 'Time Period' ) );\n\t\t\t\tform_item_input_div.append( combobox );\n\n\t\t\t\tthis.content_div.append( form_item );\n\n\t\t\t\tform_item = $( Global.loadWidget( 'global/widgets/wizard_form_item/WizardFormItem.html' ) );\n\t\t\t\tform_item_label = form_item.find( '.form-item-label' );\n\t\t\t\tform_item_input_div = form_item.find( '.form-item-input-div' );\n\n\t\t\t\tvar start_picker = this.getDatePicker( 'start_date' );\n\n\t\t\t\tform_item_label.text( $.i18n._( 'Start Date' ) );\n\t\t\t\tform_item_input_div.append( start_picker );\n\n\t\t\t\tthis.content_div.append( form_item );\n\n\t\t\t\tform_item = $( Global.loadWidget( 'global/widgets/wizard_form_item/WizardFormItem.html' ) );\n\t\t\t\tform_item_label = form_item.find( '.form-item-label' );\n\t\t\t\tform_item_input_div = form_item.find( '.form-item-input-div' );\n\n\t\t\t\tvar end_picker = this.getDatePicker( 'end_date' );\n\n\t\t\t\tform_item_label.text( $.i18n._( 'End Date' ) );\n\t\t\t\tform_item_input_div.append( end_picker );\n\n\t\t\t\tthis.content_div.append( form_item );\n\n\t\t\t\tform_item = $( Global.loadWidget( 'global/widgets/wizard_form_item/WizardFormItem.html' ) );\n\t\t\t\tform_item_label = form_item.find( '.form-item-label' );\n\t\t\t\tform_item_input_div = form_item.find( '.form-item-input-div' );\n\n\t\t\t\tvar pay_period = this.getAComboBox( TTAPI.APIPayPeriod, true, 'global_Pay_period', 'pay_period_id' );\n\n\t\t\t\tform_item_label.text( $.i18n._( 'Pay Period' ) );\n\t\t\t\tform_item_input_div.append( pay_period );\n\n\t\t\t\tthis.content_div.append( form_item );\n\n\t\t\t\tform_item = $( Global.loadWidget( 'global/widgets/wizard_form_item/WizardFormItem.html' ) );\n\t\t\t\tform_item_label = form_item.find( '.form-item-label' );\n\t\t\t\tform_item_input_div = form_item.find( '.form-item-input-div' );\n\n\t\t\t\tvar pay_period_schedule = this.getAComboBox( TTAPI.APIPayPeriodSchedule, true, 'global_pay_period_schedule', 'pay_period_schedule_id' );\n\n\t\t\t\tform_item_label.text( $.i18n._( 'Pay Period Schedule' ) );\n\t\t\t\tform_item_input_div.append( pay_period_schedule );\n\n\t\t\t\tthis.content_div.append( form_item );\n\n\t\t\t\tcombobox.bind( 'formItemChange', function( e, target ) {\n\t\t\t\t\t$this.onTimePeriodChange( target );\n\t\t\t\t} );\n\n\t\t\t\tvar label2 = this.getLabel();\n\t\t\t\tlabel2.text( $.i18n._( 'Select the date to be displayed on the invoice' ) );\n\n\t\t\t\tthis.content_div.append( label2 );\n\n\t\t\t\tvar date_picker = this.getDatePicker( 'effective_date' );\n\n\t\t\t\tthis.content_div.append( date_picker );\n\n\t\t\t\tthis.stepsWidgetDic[this.current_step][combobox.getField()] = combobox;\n\t\t\t\tthis.stepsWidgetDic[this.current_step][date_picker.getField()] = date_picker;\n\t\t\t\tthis.stepsWidgetDic[this.current_step][start_picker.getField()] = start_picker;\n\t\t\t\tthis.stepsWidgetDic[this.current_step][end_picker.getField()] = end_picker;\n\t\t\t\tthis.stepsWidgetDic[this.current_step][pay_period.getField()] = pay_period;\n\t\t\t\tthis.stepsWidgetDic[this.current_step][pay_period_schedule.getField()] = pay_period_schedule;\n\n\t\t\t\t$this.onTimePeriodChange( combobox );\n\n\t\t\t\tbreak;\n\t\t\tcase 3:\n\t\t\t\tlabel = this.getLabel();\n\t\t\t\tlabel.text( $.i18n._( 'Please select invoice options' ) );\n\n\t\t\t\tdiv = $( '' );\n\n\t\t\t\tthis.content_div.append( label );\n\n\t\t\t\tvar check_box = $this.getCheckBox( 'create_invoices' );\n\t\t\t\tvar check_box_label = $( '' );\n\t\t\t\tcheck_box_label.prepend( check_box );\n\t\t\t\tdiv.append( check_box_label );\n\t\t\t\tthis.stepsWidgetDic[this.current_step][check_box.getField()] = check_box;\n\n\t\t\t\tcheck_box = $this.getCheckBox( 'include_pending_transactions' );\n\t\t\t\tcheck_box_label = $( '' );\n\t\t\t\tcheck_box_label.prepend( check_box );\n\t\t\t\tdiv.append( check_box_label );\n\t\t\t\tthis.stepsWidgetDic[this.current_step][check_box.getField()] = check_box;\n\n\t\t\t\tcheck_box = $this.getCheckBox( 'overwrite_duplicate_transactions' );\n\t\t\t\tcheck_box_label = $( '' );\n\t\t\t\tcheck_box_label.prepend( check_box );\n\t\t\t\tdiv.append( check_box_label );\n\t\t\t\tthis.stepsWidgetDic[this.current_step][check_box.getField()] = check_box;\n\n\t\t\t\tthis.content_div.append( div );\n\n\t\t\t\tbreak;\n\n\t\t}\n\t}\n\n\tonTimePeriodChange( target ) {\n\t\tvar value = target.getValue();\n\n\t\tvar start_date_div = this.stepsWidgetDic[this.current_step]['start_date'].parent().parent();\n\t\tvar end_date_div = this.stepsWidgetDic[this.current_step]['end_date'].parent().parent();\n\t\tvar pay_period_div = this.stepsWidgetDic[this.current_step]['pay_period_id'].parent().parent();\n\t\tvar pay_period_schedule_div = this.stepsWidgetDic[this.current_step]['pay_period_schedule_id'].parent().parent();\n\n\t\tif ( value === 'custom_date' ) {\n\t\t\tstart_date_div.css( 'display', 'block' );\n\t\t\tend_date_div.css( 'display', 'block' );\n\t\t\tpay_period_div.css( 'display', 'none' );\n\t\t\tpay_period_schedule_div.css( 'display', 'none' );\n\t\t} else if ( value === 'custom_pay_period' ) {\n\t\t\tstart_date_div.css( 'display', 'none' );\n\t\t\tend_date_div.css( 'display', 'none' );\n\t\t\tpay_period_div.css( 'display', 'block' );\n\t\t\tpay_period_schedule_div.css( 'display', 'none' );\n\t\t} else if ( value === 'this_pay_period' || value === 'last_pay_period' || value === 'to_last_pay_period' || value === 'to_this_pay_period' ) {\n\t\t\tstart_date_div.css( 'display', 'none' );\n\t\t\tend_date_div.css( 'display', 'none' );\n\t\t\tpay_period_div.css( 'display', 'none' );\n\t\t\tpay_period_schedule_div.css( 'display', 'block' );\n\t\t} else {\n\t\t\tstart_date_div.css( 'display', 'none' );\n\t\t\tend_date_div.css( 'display', 'none' );\n\t\t\tpay_period_div.css( 'display', 'none' );\n\t\t\tpay_period_schedule_div.css( 'display', 'none' );\n\t\t}\n\t}\n\n\tbuildCurrentStepData() {\n\t\tvar $this = this;\n\t\tvar current_step_data = this.stepsDataDic[this.current_step];\n\t\tvar current_step_ui = this.stepsWidgetDic[this.current_step];\n\n\t\tswitch ( this.current_step ) {\n\t\t\tcase 1:\n\t\t\t\tif ( !current_step_data ) {\n\t\t\t\t\tfor ( var key in current_step_ui ) {\n\n\t\t\t\t\t\tif ( !current_step_ui.hasOwnProperty( key ) ) {\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcurrent_step_ui[key].setValue( -1 );\n\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tfor ( var key in current_step_data ) {\n\t\t\t\t\t\tif ( !current_step_data.hasOwnProperty( key ) ) {\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tcurrent_step_ui[key].setValue( current_step_data[key] );\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\t\t\tcase 2:\n\t\t\t\tTTAPI.APIJobSummaryReport.getOptions( 'time_period', {\n\t\t\t\t\tonResult: function( result ) {\n\n\t\t\t\t\t\tcurrent_step_ui['time_period'].setSourceData( Global.buildRecordArray( result.getResult() ) );\n\n\t\t\t\t\t\tif ( !current_step_data ) {\n\t\t\t\t\t\t\tvar date = new Date();\n\n\t\t\t\t\t\t\tcurrent_step_ui.effective_date.setValue( date.format() );\n\t\t\t\t\t\t\tcurrent_step_ui.time_period.setValue( 'today' );\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tfor ( var key in current_step_data ) {\n\t\t\t\t\t\t\t\tif ( !current_step_data.hasOwnProperty( key ) ) {\n\t\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tcurrent_step_ui[key].setValue( current_step_data[key] );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t$this.onTimePeriodChange( current_step_ui['time_period'] );\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t\tbreak;\n\t\t\tcase 3:\n\n\t\t\t\tif ( !current_step_data ) {\n\t\t\t\t\tfor ( var key in current_step_ui ) {\n\t\t\t\t\t\tif ( !current_step_ui.hasOwnProperty( key ) ) {\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tcurrent_step_ui[key].setValue( true );\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tfor ( var key in current_step_data ) {\n\t\t\t\t\t\tif ( !current_step_data.hasOwnProperty( key ) ) {\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tcurrent_step_ui[key].setValue( current_step_data[key] );\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tfor ( var key in current_step_data ) {\n\t\t\t\t\tif ( !current_step_data.hasOwnProperty( key ) ) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\n\t\t\t\t\tcurrent_step_ui[key].setValue( current_step_data[key] );\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\tonDoneClick() {\n\t\tvar $this = this;\n\t\tsuper.onDoneClick();\n\t\tthis.saveCurrentStep();\n\n\t\tvar time_period = {};\n\t\ttime_period.time_period = this.stepsDataDic[2].time_period;\n\n\t\tfor ( var key in this.stepsDataDic[2] ) {\n\t\t\tif ( !this.stepsDataDic[2].hasOwnProperty( [key] ) || key === 'time_period' || key === 'effective_date' ) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\ttime_period[key] = this.stepsDataDic[2][key];\n\n\t\t}\n\n\t\tvar effect_date = this.stepsDataDic[2].effective_date;\n\n\t\tvar job_id = this.stepsDataDic[1].job_id;\n\n\t\tvar flags = {};\n\n\t\tflags.create_invoices = this.stepsDataDic[3]['create_invoices'];\n\t\tflags.include_pending_transactions = this.stepsDataDic[3]['include_pending_transactions'];\n\t\tflags.overwrite_duplicate_transactions = this.stepsDataDic[3]['overwrite_duplicate_transactions'];\n\n\t\tTTAPI.APIJob.generateInvoices( time_period, effect_date, job_id, flags, {\n\t\t\tonResult: function( result ) {\n\t\t\t\tif ( result.isValid() ) {\n\t\t\t\t\tvar user_generic_status_batch_id = result.getAttributeInAPIDetails( 'user_generic_status_batch_id' );\n\n\t\t\t\t\tif ( user_generic_status_batch_id && TTUUID.isUUID( user_generic_status_batch_id ) && user_generic_status_batch_id != TTUUID.zero_id && user_generic_status_batch_id != TTUUID.not_exist_id ) {\n\t\t\t\t\t\tUserGenericStatusWindowController.open( user_generic_status_batch_id, [LocalCacheData.getLoginUser().id] );\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t$this.onCloseClick();\n\n\t\t\t\tif ( $this.call_back ) {\n\t\t\t\t\t$this.call_back();\n\t\t\t\t}\n\t\t\t}\n\t\t} );\n\t}\n\n\tsaveCurrentStep() {\n\t\tthis.stepsDataDic[this.current_step] = {};\n\t\tvar current_step_data = this.stepsDataDic[this.current_step];\n\t\tvar current_step_ui = this.stepsWidgetDic[this.current_step];\n\t\tswitch ( this.current_step ) {\n\t\t\tcase 2:\n\t\t\t\tfor ( var key in current_step_ui ) {\n\t\t\t\t\tif ( !current_step_ui.hasOwnProperty( key ) ) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( current_step_ui[key].is( ':visible' ) ) {\n\t\t\t\t\t\tcurrent_step_data[key] = current_step_ui[key].getValue();\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\n\t\t\t\tfor ( var key in current_step_ui ) {\n\t\t\t\t\tif ( !current_step_ui.hasOwnProperty( key ) ) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\n\t\t\t\t\tcurrent_step_data[key] = current_step_ui[key].getValue();\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\tsetDefaultDataToSteps() {\n\n\t\tif ( !this.default_data ) {\n\t\t\treturn null;\n\t\t}\n\t}\n\n}//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNDI4LmpzIiwibWFwcGluZ3MiOiI7Ozs7OztBQUFPO0FBQ1AsMkJBQTJCO0FBQzNCLEVBQUUsQ0FBQztBQUNIO0FBQ0EsSUFBSTs7QUFFSjtBQUNBOztBQUVBO0FBQ0E7O0FBRUEsZUFBZSxDQUFDO0FBQ2hCO0FBQ0E7O0FBRUE7QUFDQTs7QUFFQTtBQUNBOztBQUVBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQSxnQkFBZ0IsQ0FBQzs7QUFFakI7QUFDQSxjQUFjLENBQUM7QUFDZjs7QUFFQTtBQUNBOztBQUVBOztBQUVBO0FBQ0E7QUFDQTtBQUNBLGdCQUFnQixDQUFDOztBQUVqQjs7QUFFQSxvQkFBb0IsQ0FBQztBQUNyQjtBQUNBOztBQUVBOztBQUVBLDBCQUEwQixDQUFDO0FBQzNCOztBQUVBOztBQUVBLGdCQUFnQixDQUFDO0FBQ2pCO0FBQ0E7O0FBRUE7O0FBRUEsMEJBQTBCLENBQUM7QUFDM0I7O0FBRUE7O0FBRUEsZ0JBQWdCLENBQUM7QUFDakI7QUFDQTs7QUFFQTs7QUFFQSwwQkFBMEIsQ0FBQztBQUMzQjs7QUFFQTs7QUFFQSxnQkFBZ0IsQ0FBQztBQUNqQjtBQUNBOztBQUVBOztBQUVBL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