"use strict";(self.webpackChunktimetrex=self.webpackChunktimetrex||[]).push([["wizard-re_calculate_timesheet-ReCalculateTimeSheetWizardController"],{2971:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"ReCalculateTimeSheetWizardController\": () => (/* binding */ ReCalculateTimeSheetWizardController)\n/* harmony export */ });\n/* provided dependency */ var _ = __webpack_require__(9050);\n/* provided dependency */ var $ = __webpack_require__(9755);\nclass ReCalculateTimeSheetWizardController 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._( 'TimeSheet ReCalculation 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\n\t\tthis.content_div.empty();\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._( 'Recalculating timesheets is only required when policies have been modified and need to be applied retroactively.' ) );\n\n\t\t\t\tthis.content_div.append( label );\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 one or more pay periods' ) );\n\n\t\t\t\tvar a_combobox = this.getAComboBox( TTAPI.APIPayPeriod, true, 'global_Pay_period', 'pay_period_id' );\n\t\t\t\tvar div = $( '
' );\n\t\t\t\tdiv.append( a_combobox );\n\n\t\t\t\tthis.stepsWidgetDic[this.current_step] = {};\n\t\t\t\tthis.stepsWidgetDic[this.current_step][a_combobox.getField()] = 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\tbreak;\n\t\t\tcase 3:\n\t\t\t\tlabel = this.getLabel();\n\t\t\t\tlabel.text( $.i18n._( 'Select one or more employees' ) );\n\n\t\t\t\ta_combobox = this.getAComboBox( TTAPI.APIUser, true, 'global_user', 'user_id', true );\n\t\t\t\tdiv = $( '
' );\n\t\t\t\tdiv.append( a_combobox );\n\n\t\t\t\tthis.stepsWidgetDic[this.current_step] = {};\n\t\t\t\tthis.stepsWidgetDic[this.current_step][a_combobox.getField()] = a_combobox;\n\n\t\t\t\tthis.content_div.append( label );\n\t\t\t\tthis.content_div.append( div );\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\tbuildCurrentStepData() {\n\t}\n\n\tonDoneClick() {\n\t\tvar $this = this;\n\t\tsuper.onDoneClick();\n\t\tthis.saveCurrentStep();\n\t\tif ( this.stepsDataDic && this.stepsDataDic[2] && this.stepsDataDic[3] ) {\n\t\t\tvar pay_period_ids = this.stepsDataDic[2].pay_period_id;\n\t\t\tvar user_ids = this.stepsDataDic[3].user_id;\n\n\t\t\tvar timesheet_api = TTAPI.APITimeSheet;\n\n\t\t\t//this is outside the callback to prevent hammer-clicking which was causing problems.\n\t\t\tthis.onCloseClick();\n\t\t\ttimesheet_api.reCalculateTimeSheet( pay_period_ids, user_ids, {\n\t\t\t\tonResult: function( result ) {\n\n\t\t\t\t\tif ( $this.call_back ) {\n\t\t\t\t\t\t$this.call_back();\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t} );\n\t\t}\n\t}\n\n\tsetCurrentStepValues() {\n\n\t\tif ( !this.stepsDataDic[this.current_step] ) {\n\t\t\treturn;\n\t\t} else {\n\t\t\tvar current_step_data = this.stepsDataDic[this.current_step];\n\t\t\tvar current_step_ui = this.stepsWidgetDic[this.current_step];\n\t\t}\n\n\t\tswitch ( this.current_step ) {\n\t\t\tcase 1:\n\t\t\t\tbreak;\n\t\t\tcase 2:\n\t\t\t\tif ( current_step_data.pay_period_id ) {\n\t\t\t\t\tcurrent_step_ui.pay_period_id.setValue( current_step_data.pay_period_id );\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 3:\n\n\t\t\t\tif ( current_step_data.user_id ) {\n\t\t\t\t\tcurrent_step_ui.user_id.setValue( current_step_data.user_id );\n\t\t\t\t}\n\n\t\t\t\tbreak;\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 1:\n\t\t\t\tbreak;\n\t\t\tcase 2:\n\t\t\t\tcurrent_step_data.pay_period_id = current_step_ui.pay_period_id.getValue();\n\t\t\t\tbreak;\n\t\t\tcase 3:\n\t\t\t\tcurrent_step_data.user_id = current_step_ui.user_id.getValue();\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\n\t\tthis.stepsDataDic[2] = {};\n\t\tthis.stepsDataDic[3] = {};\n\n\t\tif ( this.getDefaultData( 'user_id' ) ) {\n\t\t\tthis.stepsDataDic[3].user_id = this.getDefaultData( 'user_id' );\n\t\t}\n\n\t\tif ( this.getDefaultData( 'pay_period_id' ) ) {\n\t\t\tthis.stepsDataDic[2].pay_period_id = this.getDefaultData( 'pay_period_id' );\n\t\t}\n\t}\n\n}//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMjk3MS5qcyIsIm1hcHBpbmdzIjoiOzs7Ozs7QUFBTztBQUNQLDJCQUEyQjtBQUMzQixFQUFFLENBQUM7QUFDSDtBQUNBLElBQUk7O0FBRUo7QUFDQTs7QUFFQTtBQUNBOztBQUVBLGVBQWUsQ0FBQztBQUNoQjtBQUNBOztBQUVBO0FBQ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