TimeTrex/interface/html5/dist/employees-user_contact-UserContactViewController.bundle.js

1 line
47 KiB
JavaScript
Raw Normal View History

2022-12-13 07:10:06 +01:00
"use strict";(self.webpackChunktimetrex=self.webpackChunktimetrex||[]).push([["employees-user_contact-UserContactViewController"],{6738:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"UserContactViewController\": () => (/* binding */ UserContactViewController)\n/* harmony export */ });\n/* provided dependency */ var _ = __webpack_require__(9050);\n/* provided dependency */ var $ = __webpack_require__(9755);\nclass UserContactViewController extends BaseViewController {\n\tconstructor( options = {} ) {\n\t\t_.defaults( options, {\n\t\t\tel: '#user_contact_view_container',\n\n\n\n\t\t\tuser_api: null,\n\t\t\tcompany_api: null,\n\t\t\tethnic_group_api: null,\n\t\t\tstatus_array: null,\n\t\t\ttype_array: null,\n\t\t\tsex_array: null,\n\t\t\tcountry_array: null,\n\t\t\tprovince_array: null,\n\t\t\te_province_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 = 'UserContactEditView.html';\n\t\tthis.permission_id = 'user_contact';\n\t\tthis.viewId = 'UserContact';\n\t\tthis.script_name = 'UserContactView';\n\t\tthis.table_name_key = 'user_contact';\n\t\tthis.context_menu_name = $.i18n._( 'Employee Contacts' );\n\t\tthis.navigation_label = $.i18n._( 'Employee Contact' );\n\t\tthis.api = TTAPI.APIUserContact;\n\t\tthis.user_api = TTAPI.APIUser;\n\t\tthis.company_api = TTAPI.APICompany;\n\t\tthis.ethnic_group_api = TTAPI.APIEthnicGroup;\n\t\tthis.document_object_type_id = 115;\n\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\tgetCustomContextMenuModel() {\n\t\tvar context_menu_model = {\n\t\t\texclude: ['copy'],\n\t\t\tinclude: []\n\t\t};\n\n\t\treturn context_menu_model;\n\t}\n\n\tinitOptions() {\n\t\tvar options = [\n\t\t\t{ option_name: 'status', api: this.api },\n\t\t\t{ option_name: 'type', api: this.api },\n\t\t\t{ option_name: 'sex', api: this.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\t}\n\n\tonFormItemChange( target, doNotValidate ) {\n\t\tthis.setIsChanged( target );\n\t\tthis.setMassEditingFieldsWhenFormChange( target );\n\t\tvar key = target.getField();\n\t\tswitch ( key ) {\n\t\t\tcase 'country':\n\t\t\t\tvar widget = this.edit_view_ui_dic['province'];\n\t\t\t\twidget.setValue( null );\n\t\t\t\tbreak;\n\t\t}\n\n\t\tthis.current_edit_record[key] = target.getValue();\n\n\t\tif ( key === 'country' ) {\n\t\t\tthis.onCountryChange();\n\t\t\treturn;\n\t\t}\n\n\t\tif ( !doNotValidate ) {\n\t\t\tthis.validate();\n\t\t}\n\t}\n\n\tsetSelectLayout() {\n\t\tif ( this.sub_view_mode ) {\n\t\t\tsuper.setSelectLayout( ['employee_first_name', 'employee_last_name', 'title', 'user_group', 'default_branch', 'default_department'] );\n\t\t} else {\n\t\t\tsuper.setSelectLayout();\n\t\t}\n\t}\n\n\tbuildEditViewUI() {\n\t\tsuper.buildEditViewUI();\n\n\t\tvar $this = this;\n\n\t\tvar tab_model = {\n\t\t\t'tab_employee_contact': { 'label': $.i18n._( 'Employee Contact' ), 'is_multi_column': true },\n\t\t\t'tab_attachment': true,\n\t\t\t'tab_audit': true,\n\t\t};\n\t\tthis.setTabModel( tab_model );\n\n\t\tthis.navigation.AComboBox( {\n\t\t\tapi_class: TTAPI.APIUserContact,\n\t\t\tid: this.script_name + '_navigation',\n\t\t\tallow_multiple_selection: false,\n\t\t\tlayout_name: 'global_user_contact',\n\t\t\tnavigation_mode: true,\n\t\t\tshow_search_inputs: true\n\t\t} );\n\n\t\tthis.setNavigation();\n\n\t\tvar tab_employee_contact = this.edit_view_tab.find( '#tab_employee_contact' );\n\t\tvar tab_employee_contact_column1 = tab_employee_contact.find( '.first-column' );\n\t\tvar tab_employee_contact_column2 = tab_employee_contact.find( '.second-column' );\n\n\t\tthis.edit_view_tabs[0] = [];\n\n\