TimeTrex/interface/html5/dist/payroll-pay_stub_amendment-PayStubAmendmentViewController.bundle.js

1 line
86 KiB
JavaScript
Raw Permalink Normal View History

2022-12-13 07:10:06 +01:00
"use strict";(self.webpackChunktimetrex=self.webpackChunktimetrex||[]).push([["payroll-pay_stub_amendment-PayStubAmendmentViewController"],{4776:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"PayStubAmendmentViewController\": () => (/* binding */ PayStubAmendmentViewController)\n/* harmony export */ });\n/* harmony import */ var decimal_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(482);\n/* provided dependency */ var _ = __webpack_require__(9050);\n/* provided dependency */ var $ = __webpack_require__(9755);\n\n\nclass PayStubAmendmentViewController extends BaseViewController {\n\tconstructor( options = {} ) {\n\t\t_.defaults( options, {\n\t\t\tel: '#pay_stub_amendment_view_container',\n\n\t\t\tuser_status_array: null,\n\t\t\tfiltered_status_array: null,\n\t\t\ttype_array: null,\n\t\t\tis_mass_adding: false,\n\n\t\t\tuser_api: null,\n\t\t\tuser_group_api: null,\n\t\t\tuser_wage_api: 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 = 'PayStubAmendmentEditView.html';\n\t\tthis.permission_id = 'pay_stub_amendment';\n\t\tthis.viewId = 'PayStubAmendment';\n\t\tthis.script_name = 'PayStubAmendmentView';\n\t\tthis.table_name_key = 'pay_stub_amendment';\n\t\tthis.context_menu_name = $.i18n._( 'Pay Stub Amendment' );\n\t\tthis.navigation_label = $.i18n._( 'Pay Stub Amendment' );\n\t\tthis.api = TTAPI.APIPayStubAmendment;\n\t\tthis.user_api = TTAPI.APIUser;\n\t\tthis.user_group_api = TTAPI.APIUserGroup;\n\t\tthis.currency_api = TTAPI.APICurrency;\n\t\tthis.user_wage_api = TTAPI.APIUserWage;\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\n\t\tvar options = [\n\t\t\t{ option_name: 'type', api: this.api },\n\t\t\t{ option_name: 'status', field_name: 'user_status_id', api: this.user_api },\n\t\t\t{ option_name: 'filtered_status', field_name: 'status_id', api: this.api },\n\t\t];\n\n\t\tthis.initDropDownOptions( options );\n\n\t\tthis.user_group_api.getUserGroup( '', false, false, {\n\t\t\tonResult: function( res ) {\n\t\t\t\tres = res.getResult();\n\n\t\t\t\tres = Global.buildTreeRecord( res );\n\t\t\t\t$this.user_group_array = res;\n\n\t\t\t\tif ( !$this.sub_view_mode && $this.basic_search_field_ui_dic['group_id'] ) {\n\t\t\t\t\t$this.basic_search_field_ui_dic['group_id'].setSourceData( res );\n\t\t\t\t\t$this.adv_search_field_ui_dic['group_id'].setSourceData( res );\n\t\t\t\t}\n\n\t\t\t}\n\t\t} );\n\n\t\tthis.api.getOptions( 'status', false, false, {\n\t\t\tonResult: function( res ) {\n\t\t\t\tvar status_array = Global.buildRecordArray( res.getResult() );\n\n\t\t\t\tif ( !$this.sub_view_mode && $this.basic_search_field_ui_dic['status_id'] ) {\n\t\t\t\t\t$this.basic_search_field_ui_dic['status_id'].setSourceData( status_array );\n\t\t\t\t\tif ( $this.adv_search_field_ui_dic['status_id'] ) {\n\t\t\t\t\t\t$this.adv_search_field_ui_dic['status_id'].setSourceData( status_array );\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t}\n\t\t} );\n\t}\n\n\tgetUserHourlyRate( user_id ) {\n\t\tvar $this = this;\n\n\t\tif ( !user_id ) {\n\t\t\tuser_id = this.current_edit_record['user_id'];\n\t\t}\n\n\t\tif ( TTUUID.isUUID( user_id ) == false || ( $.isArray( user_id ) && user_id.length != 1 ) ) {\n\t\t\tuser_id = TTUUID.zero_id;\n\t\t}\n\n\t\t//Last Wage record only.\n\t\tthis.user_wage_api.getUserWage( {\n\t\t\tfilter_data: {\n\t\t\t\tuser_id: user_id,\n\t\t\t\twage_group_id: TTUUID.zero_id\n\t\t\t}\n\t\t}, false, true, {\n\t\t\tonResult: function( result ) {\n\t\t\t\tvar rate = '0.00';\n\n\t\t\t\tvar result_data = result.getResult();\n\t\t\t\tif ( result_data && result_data.length > 0 ) {\n\t\t\t\t\tresult_data = result_data[0];\n\n\t\t\t\t\trate = result_data.hourly_rate;\n\t\t\t\t}\n\n\t\t\t\t$this.edit_view_ui_dic['rate'].setValue( rate );\n\t\t\t\t$this.current_edit_record['rate'] = rate;\n\t\t\t\t$this.calcAmount();\n\t\t