TimeTrex/interface/html5/dist/payroll-recurring_pay_stub_amendment-RecurringPayStubAmendmentViewController.bundle.js

1 line
36 KiB
JavaScript
Raw Normal View History

2022-12-13 07:10:06 +01:00
"use strict";(self.webpackChunktimetrex=self.webpackChunktimetrex||[]).push([["payroll-recurring_pay_stub_amendment-RecurringPayStubAmendmentViewController"],{4744:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"RecurringPayStubAmendmentViewController\": () => (/* binding */ RecurringPayStubAmendmentViewController)\n/* harmony export */ });\n/* provided dependency */ var _ = __webpack_require__(9050);\n/* provided dependency */ var $ = __webpack_require__(9755);\nclass RecurringPayStubAmendmentViewController extends BaseViewController {\n\tconstructor( options = {} ) {\n\t\t_.defaults( options, {\n\t\t\tel: '#recurring_pay_stub_amendment_view_container',\n\t\t\ttype_array: null,\n\t\t\tfiltered_status_array: null,\n\t\t\tfrequency_array: null\n\t\t} );\n\n\t\tsuper( options );\n\t}\n\n\tinit( options ) {\n\t\t//this._super('initialize', options );\n\t\tthis.edit_view_tpl = 'RecurringPayStubAmendmentEditView.html';\n\t\tthis.permission_id = 'pay_stub_amendment';\n\t\tthis.viewId = 'RecurringPayStubAmendment';\n\t\tthis.script_name = 'RecurringPayStubAmendmentView';\n\t\tthis.table_name_key = 'recurring_ps_amendment';\n\t\tthis.context_menu_name = $.i18n._( 'Recurring PS Amendment' );\n\t\tthis.navigation_label = $.i18n._( 'Recurring PS Amendment' );\n\t\tthis.api = TTAPI.APIRecurringPayStubAmendment;\n\n\t\tthis.render();\n\t\tthis.buildContextMenu();\n\n\t\tthis.initData();\n\t}\n\n\tinitOptions() {\n\t\tvar $this = this;\n\t\tthis.initDropDownOption( 'type' );\n\t\tthis.initDropDownOption( 'filtered_status', 'status_id', this.api, function() {\n\t\t\t$this.basic_search_field_ui_dic['status_id'].setSourceData( $this.filtered_status_array );\n\t\t} );\n\t\tthis.initDropDownOption( 'frequency' );\n\t}\n\n\tonFormItemChange( target, doNotValidate ) {\n\t\tthis.setIsChanged( target );\n\t\tthis.setMassEditingFieldsWhenFormChange( target );\n\n\t\tvar key = target.getField();\n\t\tvar c_value = target.getValue();\n\n\t\tthis.current_edit_record[key] = c_value;\n\n\t\tif ( key === 'type_id' ) {\n\t\t\tthis.onTypeChange();\n\t\t}\n\n\t\tif ( key === 'rate' || key === 'units' || key === 'amount' ) {\n\t\t\tif ( this.is_mass_editing ) {\n\t\t\t\tif ( target.isChecked() ) {\n\t\t\t\t\tthis.edit_view_ui_dic['rate'].setCheckBox( true );\n\t\t\t\t\tthis.edit_view_ui_dic['units'].setCheckBox( true );\n\t\t\t\t\tthis.edit_view_ui_dic['amount'].setCheckBox( true );\n\t\t\t\t} else {\n\t\t\t\t\tthis.edit_view_ui_dic['rate'].setCheckBox( false );\n\t\t\t\t\tthis.edit_view_ui_dic['units'].setCheckBox( false );\n\t\t\t\t\tthis.edit_view_ui_dic['amount'].setCheckBox( false );\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis.current_edit_record['amount'] = this.edit_view_ui_dic['amount'].getValue();\n\t\t}\n\n\t\tif ( !doNotValidate ) {\n\t\t\tthis.validate();\n\t\t}\n\t}\n\n\tuniformVariable( records ) {\n\n\t\tif ( records.type_id == 20 ) {\n\t\t\trecords.amount = records.percent_amount;\n\t\t}\n\n\t\treturn records;\n\t}\n\n\tonTypeChange() {\n\t\tif ( this.current_edit_record.type_id == 10 ) {\n\t\t\tthis.detachElement( 'percent_amount' );\n\t\t\tthis.detachElement( 'percent_amount_entry_name_id' );\n\t\t\tthis.attachElement( 'rate' );\n\t\t\tthis.attachElement( 'units' );\n\t\t\tthis.attachElement( 'amount' );\n\n\t\t} else if ( this.current_edit_record.type_id == 20 ) {\n\t\t\tthis.attachElement( 'percent_amount' );\n\t\t\tthis.attachElement( 'percent_amount_entry_name_id' );\n\t\t\tthis.detachElement( 'rate' );\n\t\t\tthis.detachElement( 'units' );\n\t\t\tthis.detachElement( 'amount' );\n\t\t}\n\n\t\tthis.editFieldResize();\n\t}\n\n\tonFormItemKeyUp( target ) {\n\t\tvar widget_rate = this.edit_view_ui_dic['rate'];\n\t\tvar widget_units = this.edit_view_ui_dic['units'];\n\t\tvar widget_amount = this.edit_view_ui_dic['amount'];\n\n\t\tif ( target.getValue().length === 0 ) {\n\t\t\twidget_amount.setReadOnly( false );\n\t\t}\n\t\tif ( widget_rate.getValue().length > 0 || widget_units.getValue().