TimeTrex/interface/html5/dist/invoice-area_policy-AreaPolicyViewController.bundle.js

1 line
21 KiB
JavaScript
Raw Permalink Normal View History

2022-12-13 07:10:06 +01:00
"use strict";(self.webpackChunktimetrex=self.webpackChunktimetrex||[]).push([["invoice-area_policy-AreaPolicyViewController"],{8477:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"AreaPolicyViewController\": () => (/* binding */ AreaPolicyViewController)\n/* harmony export */ });\n/* provided dependency */ var _ = __webpack_require__(9050);\n/* provided dependency */ var $ = __webpack_require__(9755);\nclass AreaPolicyViewController extends BaseViewController {\n\tconstructor( options = {} ) {\n\t\t_.defaults( options, {\n\t\t\tel: '#area_policy_view_container',\n\n\t\t\tstatus_array: null,\n\n\t\t\tcountry_array: null,\n\t\t\tdistrict_array: null,\n\t\t\tprovince_array: null,\n\n\t\t\tcompany_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 = 'AreaPolicyEditView.html';\n\t\tthis.permission_id = 'area_policy';\n\t\tthis.viewId = 'AreaPolicy';\n\t\tthis.script_name = 'AreaPolicyView';\n\t\tthis.table_name_key = 'area_policy';\n\t\tthis.context_menu_name = $.i18n._( 'Area Policy' );\n\t\tthis.navigation_label = $.i18n._( 'Area' );\n\t\tthis.api = TTAPI.APIAreaPolicy;\n\t\tthis.company_api = TTAPI.APICompany;\n\n\t\tthis.render();\n\t\tthis.buildContextMenu();\n\n\t\tthis.initData();\n\t}\n\n\t//Don't call super if override this function.\n\tonFormItemChange( target, doNotValidate ) {\n\t\tthis.setIsChanged( target );\n\t\tthis.setMassEditingFieldsWhenFormChange( target );\n\t\tvar key = target.getField();\n\t\tvar c_value = target.getValue();\n\n\t\tswitch ( key ) {\n\t\t\tcase 'country':\n\t\t\t\tif ( c_value.toString() === this.current_edit_record[key].toString() ) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tvar widget = this.edit_view_ui_dic['province'];\n\t\t\t\tvar widget2 = this.edit_view_ui_dic['district'];\n\t\t\t\twidget.setValue( null );\n\t\t\t\twidget2.setValue( null );\n\t\t\t\tthis.current_edit_record.province = false;\n\t\t\t\tthis.current_edit_record.district = false;\n\t\t\t\tvar p = this.edit_view_ui_dic['province'].getValue();\n\t\t\t\tthis.eSetProvince( c_value );\n\t\t\t\tthis.setDistrict( c_value, p );\n\t\t\t\tbreak;\n\t\t\tcase 'province':\n\n\t\t\t\tif ( c_value.toString() === this.current_edit_record[key].toString() ) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\twidget = this.edit_view_ui_dic['district'];\n\t\t\t\twidget.setValue( null );\n\t\t\t\tvar c = this.edit_view_ui_dic['country'].getValue();\n\t\t\t\tthis.setDistrict( c, c_value );\n\t\t\t\tbreak;\n\t\t}\n\n\t\tthis.current_edit_record[key] = c_value;\n\n\t\tif ( key === 'country' ) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.validate();\n\t}\n\n\tinitOptions() {\n\t\tvar $this = this;\n\n\t\tthis.initDropDownOption( 'country', null, this.company_api );\n\t}\n\n\tsetDistrict( c, p ) {\n\t\tvar $this = this;\n\t\tvar district_widget = $this.edit_view_ui_dic['district'];\n\n\t\tif ( !Global.isSet( c ) || c === '-1' || c === '0' || !Global.isSet( p ) || p === '-1' || p === '0' ) {\n\t\t\t$this.district_array = [];\n\t\t\tdistrict_widget.setSourceData( [] );\n\t\t} else {\n\n\t\t\tthis.api.getDistrictOptions( c, p, {\n\t\t\t\tonResult: function( res ) {\n\t\t\t\t\tres = res.getResult();\n\t\t\t\t\t$this.district_array = Global.buildRecordArray( res );\n\t\t\t\t\tdistrict_widget.setSourceData( $this.district_array );\n\n\t\t\t\t}\n\t\t\t} );\n\t\t}\n\t}\n\n\teSetProvince( val, refresh ) {\n\t\tvar $this = this;\n\t\tvar province_widget = $this.edit_view_ui_dic['province'];\n\n\t\tif ( !val || val === '-1' || val === '0' ) {\n\t\t\t$this.e_province_array = [];\n\t\t\tprovince_widget.setSourceData( [] );\n\t\t} else {\n\t\t\tthis.api.getProvinceOptions( val, {\n\t\t\t\tonResult: function( res ) {\n\t\t\t\t\tres = res.getResult();\n\t\t\t\t\tif ( !res ) {\n\t\t\t\t\t\tres = [];\n\t\t\t\t\t}\n\n\t\t\t\t\t$this.province_array = Global.buildRecordArray( res );\n\t\t\t\t\tprovince_widget.setSourceData( $this.provin