TimeTrex/interface/html5/dist/wizard-pay_code-PayCodeWizardController.bundle.js

1 line
13 KiB
JavaScript
Raw Permalink Normal View History

2022-12-13 07:10:06 +01:00
"use strict";(self.webpackChunktimetrex=self.webpackChunktimetrex||[]).push([["wizard-pay_code-PayCodeWizardController"],{538:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"PayCodeWizardController\": () => (/* binding */ PayCodeWizardController)\n/* harmony export */ });\n/* provided dependency */ var _ = __webpack_require__(9050);\n/* provided dependency */ var $ = __webpack_require__(9755);\nclass PayCodeWizardController 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._( 'Migrate Pay Codes' );\n\t\tthis.steps = 2;\n\t\tthis.current_step = 1;\n\t\t$( this.el ).width( 1010 );\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.html( $.i18n._( 'This wizard will migrate data associated with one pay code to another pay code without recalculating timesheets or otherwise affecting employees time or wages.' ) + '<br><br>' +\n\t\t\t\t\t'<span style=\"color: #ff0000; font-weight: bold;\">' + $.i18n._( 'WARNING' ) + ': ' + '</span>' +\n\t\t\t\t\t$.i18n._( 'This operation can not be reversed once complete.' ) );\n\n\t\t\t\tthis.content_div.append( label );\n\t\t\t\tbreak;\n\t\t\tcase 2:\n\t\t\t\tvar content = $( $( this.el ).find( '.wizard-content' ) );\n\n\t\t\t\tvar content_clone = content.clone();\n\n\t\t\t\tthis.stepsWidgetDic[this.current_step] = {};\n\n\t\t\t\t// Select Source Pay Codes\n\n\t\t\t\tvar first_hr = content_clone.find( '.first-hr' );\n\t\t\t\tfirst_hr.find( '.wizard-item-label > span' ).text( $.i18n._( 'Select Source Pay Codes' ) );\n\t\t\t\tvar a_combobox = this.getAComboBox( TTAPI.APIPayCode, true, 'global_pay_code', 'source_pay_code_ids' );\n\t\t\t\tfirst_hr.find( '.wizard-item-widget' ).append( a_combobox );\n\n\t\t\t\tthis.stepsWidgetDic[this.current_step][a_combobox.getField()] = a_combobox;\n\n\t\t\t\t// Select Destination Pay Code\n\n\t\t\t\tvar second_hr = content_clone.find( '.second-hr' );\n\t\t\t\tsecond_hr.find( '.wizard-item-label > span' ).text( $.i18n._( 'Select Destination Pay Code' ) );\n\t\t\t\ta_combobox = this.getAComboBox( TTAPI.APIPayCode, false, 'global_pay_code', 'dest_pay_code_id' );\n\t\t\t\tsecond_hr.find( '.wizard-item-widget' ).append( a_combobox );\n\n\t\t\t\tthis.stepsWidgetDic[this.current_step][a_combobox.getField()] = a_combobox;\n\n\t\t\t\tcontent_clone.appendTo( this.content_div );\n\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\tvar source_pay_code_ids = this.stepsDataDic[2].source_pay_code_ids;\n\t\tvar dest_pay_code_id = this.stepsDataDic[2].dest_pay_code_id;\n\n\t\tvar pay_code_api = TTAPI.APIPayCode;\n\n\t\tpay_code_api.migratePayCode( source_pay_code_ids, dest_pay_code_id, {\n\t\t\tonResult: function( result ) {\n\t\t\t\tvar result_data = result.getResult();\n\t\t\t\tif ( result_data ) {\n\t\t\t\t\t$this.onCloseClick();\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\t\t\t\t} else {\n\t\t\t\t\tTAlertManager.showErrorAlert( result );\n\t\t\t\t}\n\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.source_pay_code_ids ) {\n\t\t\t\t\tcurrent_step_ui.source_pay_code_ids.setValue( current