1 line
12 KiB
JavaScript
1 line
12 KiB
JavaScript
|
"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 = $( '<div class=\\'wizard-acombobox-div\\'></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 = $( '<div class=\\'wizard-acombobox-div\\'></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\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.stepsDat
|