"use strict";(self.webpackChunktimetrex=self.webpackChunktimetrex||[]).push([["wizard-formula_builder_wizard-FormulaBuilderWizardController"],{3313:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"FormulaBuilderWizardController\": () => (/* binding */ FormulaBuilderWizardController)\n/* harmony export */ });\n/* provided dependency */ var _ = __webpack_require__(9050);\n/* provided dependency */ var $ = __webpack_require__(9755);\nclass FormulaBuilderWizardController extends BaseWizardController {\n\tconstructor( options = {} ) {\n\t\t_.defaults( options, {\n\t\t\tel: '.wizard-bg',\n\n\t\t\tformula_selection_pos: 0\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._( 'Formula Builder' );\n\t\tthis.steps = 1;\n\t\tthis.current_step = 1;\n\n\t\tthis.render();\n\t}\n\n\trender() {\n\t\tsuper.render();\n\n\t\t$( this.el ).find( '.progress-bar' ).hide();\n\t\tthis.next_btn.hide();\n\t\tthis.back_btn.hide();\n\t\t$( this.el ).css( 'max-height', 500 );\n\t\tthis.content_div.css( 'top', 20 );\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( '' );\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\tform_item.css( 'margin-left', 0 );\n\n\t\t\t\tvar combobox = this.getAComboBox( null, null, 'global_option_column', 'custom_variables', false );\n\n\t\t\t\tform_item_label.text( $.i18n._( 'Custom Variables' ) );\n\t\t\t\tform_item_input_div.append( combobox );\n\n\t\t\t\tcombobox.setSourceData( this.default_data.variables );\n\n\t\t\t\tcombobox.unbind( 'mousedown' ).bind( 'mousedown', function() {\n\t\t\t\t\t$this.formula_selection_pos = formula[0].selectionStart;\n\t\t\t\t} );\n\n\t\t\t\tcombobox.unbind( 'formItemChange' ).bind( 'formItemChange', onOptionSelect );\n\n\t\t\t\tthis.content_div.append( form_item );\n\n\t\t\t\tif ( !this.default_data.do_not_show_functions ) {\n\t\t\t\t\tform_item = $( Global.loadWidget( 'global/widgets/wizard_form_item/WizardFormItem.html' ) );\n\t\t\t\t\tform_item_label = form_item.find( '.form-item-label' );\n\t\t\t\t\tform_item_input_div = form_item.find( '.form-item-input-div' );\n\n\t\t\t\t\tform_item.css( 'margin-left', 0 );\n\n\t\t\t\t\tvar formula_func = this.getComboBox( 'formula_function', true );\n\n\t\t\t\t\tform_item_label.text( $.i18n._( 'Formula Functions' ) );\n\t\t\t\t\tform_item_input_div.append( formula_func );\n\n\t\t\t\t\tformula_func.setSourceData( this.default_data.functions );\n\n\t\t\t\t\tformula_func.unbind( 'mousedown' ).bind( 'mousedown', function() {\n\t\t\t\t\t\t$this.formula_selection_pos = formula[0].selectionStart;\n\t\t\t\t\t} );\n\n\t\t\t\t\tformula_func.unbind( 'formItemChange' ).bind( 'formItemChange', onOptionSelect );\n\n\t\t\t\t\tthis.content_div.append( form_item );\n\t\t\t\t}\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\tform_item.css( 'margin-left', 0 );\n\n\t\t\t\tvar formula = this.getTextArea( 'formula', 730 );\n\n\t\t\t\tform_item_label.text( $.i18n._( 'Formula' ) );\n\t\t\t\tform_item_input_div.append( formula );\n\n\t\t\t\tthis.content_div.append( form_item );\n\n\t\t\t\tthis.stepsWidgetDic[this.current_step][combobox.getField()] = combobox;\n\t\t\t\tif ( !this.default_data.do_not_show_functions ) {\n\t\t\t\t\tthis.stepsWidgetDic[this.current_step][formula_func.getField()] = formula_func;\n\t\t\t\t}\n\t\t\t\tthis.stepsWidgetDic[this.current_step][formula.getField()] = formula;\n\n\t\t\t\tformula.focus();\n\n\t\t\t\tbreak;\n\n\t\t}\n\n\t\tfunction onOptionSelect( e, target ) {\n\t\t\tvar val = target.getValue();\n\t\t\tif ( val === 0 ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tvar text = formula.getValue();\n\t\t\tvar pos = $this.formula_selection_pos;\n\t\t\tvar first_part = text.substring( 0, pos );\n\t\t\tvar sec_part = text.substring( pos, text.length );\n\t\t\tformula.setValue( first_part + val + sec_part );\n\t\t\tformula.focus();\n\t\t\tformula[0].selectionStart = pos + val.length;\n\t\t\tformula[0].selectionEnd = pos + val.length;\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\tcurrent_step_ui.formula.setValue( this.default_data.formula );\n\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 current_edit_record = this.default_data.current_edit_record;\n\t\tvar new_formula_text = this.stepsDataDic[1].formula;\n\n\t\tvar formulaInput = this.stepsWidgetDic[1].formula;\n\n\t\tif ( this.default_data.api.key_name === 'CompanyDeduction' ) {\n\t\t\tcurrent_edit_record.company_value1 = new_formula_text;\n\t\t} else {\n\t\t\tcurrent_edit_record.formula = new_formula_text;\n\t\t}\n\n\t\tfunction closeAndCallBack() {\n\t\t\t$( $this.el ).remove();\n\t\t\t$this.call_back( new_formula_text );\n\t\t}\n\n\t\tif ( !this.default_data.do_not_validate ) {\n\t\t\tthis.default_data.api['validate' + this.default_data.api.key_name]( current_edit_record, {\n\t\t\t\tonResult: function( result ) {\n\t\t\t\t\tif ( result.isValid() ) {\n\t\t\t\t\t\t$( $this.el ).remove();\n\t\t\t\t\t\t$this.call_back( new_formula_text );\n\t\t\t\t\t\tcloseAndCallBack();\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tvar details = result.getDetails();\n\n\t\t\t\t\t\tif ( !details ) {\n\t\t\t\t\t\t\tcloseAndCallBack();\n\t\t\t\t\t\t\t//Cannot set property 'formula' of null in /interface/html5/#!m=SavedReport&sm=PayStubSummaryReport&sid=4584 line 162\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif ( Global.isArray( details ) || typeof details === 'object' ) {\n\n\t\t\t\t\t\t\tvar found = false;\n\t\t\t\t\t\t\t$.each( details, function( index, val ) {\n\n\t\t\t\t\t\t\t\tfor ( var key in val ) {\n\n\t\t\t\t\t\t\t\t\tif ( $this.default_data.api.key_name === 'CompanyDeduction' ) {\n\t\t\t\t\t\t\t\t\t\tif ( key === 'company_value1' ) {\n\t\t\t\t\t\t\t\t\t\t\tformulaInput.setErrorStyle( val[key], true );\n\t\t\t\t\t\t\t\t\t\t\tfound = true;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\tif ( key === 'formula' ) {\n\t\t\t\t\t\t\t\t\t\t\tformulaInput.setErrorStyle( val[key], true );\n\t\t\t\t\t\t\t\t\t\t\tfound = true;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tif ( !found ) {\n\t\t\t\t\t\t\t\t\tcloseAndCallBack();\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tcloseAndCallBack();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} );\n\t\t} else {\n\t\t\tcloseAndCallBack();\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\tdefault:\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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMzMxMy5qcyIsIm1hcHBpbmdzIjoiOzs7Ozs7QUFBTztBQUNQLDJCQUEyQjtBQUMzQixFQUFFLENBQUM7QUFDSDs7QUFFQTtBQUNBLElBQUk7O0FBRUo7QUFDQTs7QUFFQTtBQUNBOztBQUVBLGVBQWUsQ0FBQztBQUNoQjtBQUNBOztBQUVBO0FBQ0E7O0FBRUE7QUFDQTs7QUFFQSxFQUFFLENBQUM7QUFDSDtBQUNBO0FBQ0EsRUFBRSxDQUFDO0FBQ0g7O0FBRUE7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBOztBQUVBLG9CQUFvQixDQUFDO0FBQ3JCO0FBQ0E7O0FBRUE7O0FBRUE7O0FBRUEsMEJBQTBCLENBQUM7QUFDM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