TimeTrex/interface/html5/dist/company-wage-WageViewController.bundle.js

1 line
56 KiB
JavaScript
Raw Normal View History

2022-12-13 07:10:06 +01:00
"use strict";(self.webpackChunktimetrex=self.webpackChunktimetrex||[]).push([["company-wage-WageViewController"],{2085:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"WageViewController\": () => (/* binding */ WageViewController)\n/* harmony export */ });\n/* provided dependency */ var _ = __webpack_require__(9050);\n/* provided dependency */ var $ = __webpack_require__(9755);\nclass WageViewController extends BaseViewController {\n\tconstructor( options = {} ) {\n\t\t_.defaults( options, {\n\t\t\tel: '#wage_view_container', //Must set el here and can only set string, so events can work\n\n\n\n\t\t\tuser_api: null,\n\t\t\tuser_group_api: null,\n\t\t\tcompany_api: null,\n\t\t\tcurrency_api: null,\n\n\t\t\ttype_array: null,\n\t\t\tstatus_array: null,\n\t\t\tsex_array: null,\n\t\t\tuser_group_array: null,\n\t\t\tcountry_array: null,\n\t\t\tprovince_array: null,\n\n\t\t\te_province_array: null,\n\n\t\t\tcurrency: '',\n\t\t\tcode: '',\n\n\t\t\tis_mass_adding: false,\n\t\t\tevents: {}\n\t\t} );\n\n\t\tsuper( options );\n\t}\n\n\tinit( options ) {\n\n\t\t//this._super('initialize', options );\n\t\tthis.edit_view_tpl = 'WageEditView.html';\n\t\tthis.permission_id = 'wage';\n\t\tthis.script_name = 'WageView';\n\t\tthis.viewId = 'Wage';\n\t\tthis.table_name_key = 'user_wage';\n\t\tthis.context_menu_name = $.i18n._( 'Wage' );\n\t\tthis.navigation_label = $.i18n._( 'Wage' );\n\t\tthis.document_object_type_id = 110;\n\t\tthis.api = TTAPI.APIUserWage;\n\t\tthis.user_group_api = TTAPI.APIUserGroup;\n\t\tthis.company_api = TTAPI.APICompany;\n\t\tthis.user_api = TTAPI.APIUser;\n\t\tthis.currency_api = TTAPI.APICurrency;\n\t\tthis.render();\n\n\t\tif ( this.sub_view_mode ) {\n\t\t\tthis.buildContextMenu( true );\n\t\t} else {\n\t\t\tthis.buildContextMenu();\n\t\t}\n\n\t\t//call init data in parent view\n\t\tif ( !this.sub_view_mode ) {\n\t\t\tthis.initData();\n\t\t}\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', api: this.user_api },\n\t\t\t{ option_name: 'country', field_name: 'country', api: this.company_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 ) {\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\t}\n\n\tgetCustomContextMenuModel() {\n\t\tvar context_menu_model = {\n\t\t\texclude: ['copy'],\n\t\t\tinclude: [{\n\t\t\t\tlabel: $.i18n._( 'Import' ),\n\t\t\t\tid: 'import_icon',\n\t\t\t\tmenu_align: 'right',\n\t\t\t\taction_group: 'import_export',\n\t\t\t\tgroup: 'other',\n\t\t\t\tvue_icon: 'tticon tticon-file_download_black_24dp',\n\t\t\t\tpermission_result: PermissionManager.checkTopLevelPermission( 'ImportCSVWage' ),\n\t\t\t\tpermission: null,\n\t\t\t\tsort_order: 9010\n\t\t\t}]\n\t\t};\n\n\t\treturn context_menu_model;\n\t}\n\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\t\tthis.current_edit_record[key] = c_value;\n\n\t\tswitch ( key ) {\n\t\t\tcase 'type_id':\n\t\t\t\tthis.onTypeChange( true );\n\t\t\t\tbreak;\n\t\t\tcase 'user_id':\n\t\t\t\tif ( $.isArray( this.current_edit_record.user_id ) && this.current_edit_record.user_id.length > 1 ) {\n\t\t\t\t\tthis.is_mass_adding = true;\n\t\t\t\t} else {\n\t\t\t\t\tthis.is_mass_adding = false;\n\t\t\t\t}\n\t\t\t\tthis.setCurrency();\n\t\t\t\tbreak;\n\t\t\tcase 'wage':\n\t\t\tcase 'weekly_time':\n\t\t\t\tthis.getHourlyRate();\n\t\t\t\tbreak;\n\t\t}\n\n\t\tif ( !doNotValidate ) {\n\t\t\tthis.validate();\n\t\t}\n\t}\n\n\t//Make sure this.current_ed