TimeTrex/interface/html5/dist/company-custom_field-CustomFieldViewController.bundle.js

1 line
76 KiB
JavaScript
Raw Permalink Normal View History

2022-12-13 07:10:06 +01:00
"use strict";(self.webpackChunktimetrex=self.webpackChunktimetrex||[]).push([["company-custom_field-CustomFieldViewController"],{7945:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"CustomFieldViewController\": () => (/* binding */ CustomFieldViewController)\n/* harmony export */ });\n/* provided dependency */ var _ = __webpack_require__(9050);\n/* provided dependency */ var $ = __webpack_require__(9755);\nclass CustomFieldViewController extends BaseViewController {\n\tconstructor( options = {} ) {\n\t\t_.defaults( options, {\n\t\t\tel: '#custom_field_view_container',\n\t\t\ttype_array: null,\n\t\t\tparent_table_array: null,\n\t\t\tstatus_array: null,\n\n\t\t\toriginal_custom_field_select_items: [],\n\t\t\tauthentication_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 = 'CustomFieldEditView.html';\n\t\tthis.permission_id = 'custom_field';\n\t\tthis.viewId = 'CustomField';\n\t\tthis.script_name = 'CustomFieldView';\n\t\tthis.table_name_key = 'custom_field_control';\n\t\tthis.context_menu_name = $.i18n._( 'Custom Field' );\n\t\tthis.navigation_label = $.i18n._( 'Custom Field' );\n\t\tthis.api = TTAPI.APICustomField;\n\t\tthis.authentication_api = TTAPI.APIAuthentication;\n\n\t\tthis.render();\n\t\tthis.buildContextMenu();\n\n\t\tthis.initData();\n\t}\n\n\tgetCustomContextMenuModel() {\n\t\tvar context_menu_model = {\n\t\t\texclude: ['copy', 'mass_edit'],\n\t\t\tinclude: []\n\t\t};\n\n\t\treturn context_menu_model;\n\t}\n\n\tinitOptions( callBack ) {\n\t\tvar options = [\n\t\t\t// { option_name: 'type_id', field_name: 'type_id', api: this.api },\n\t\t\t{ option_name: 'type', api: this.api },\n\t\t\t{ option_name: 'status', api: this.api },\n\t\t\t{ option_name: 'parent_table', field_name: 'parent_table', api: this.api }\n\t\t];\n\n\t\tthis.initDropDownOptions( options );\n\t}\n\n\tsearchDone( result ) {\n\n\t\tsuper.searchDone();\n\t\tthis.refreshCustomFieldCache();\n\t}\n\n\trefreshCustomFieldCache() {\n\t\tthis.authentication_api.getCustomFieldData( {}, {\n\t\t\tonResult: function( response ) {\n\t\t\t\tlet result = response.getResult();\n\t\t\t\tLocalCacheData.setCustomFieldData( result );\n\t\t\t}\n\t\t});\n\t}\n\n\tbuildEditViewUI() {\n\n\t\tsuper.buildEditViewUI();\n\n\t\tvar $this = this;\n\n\t\tvar tab_model = {\n\t\t\t'tab_custom_field': {\n\t\t\t\t'label': $.i18n._( 'Custom Field' ),\n\t\t\t\t'is_multi_column': true,\n\t\t\t\t'html_template': this.getCustomFieldTabHtml()\n\t\t\t},\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.APICustomField,\n\t\t\tid: this.script_name + '_navigation',\n\t\t\tallow_multiple_selection: false,\n\t\t\tlayout_name: 'global_custom_field',\n\t\t\tnavigation_mode: true,\n\t\t\tshow_search_inputs: true\n\t\t} );\n\n\t\tthis.setNavigation();\n\n\t\t//Tab 0 start\n\n\t\tvar tab_custom_field = this.edit_view_tab.find( '#tab_custom_field' );\n\n\t\tvar tab_custom_field_column1 = tab_custom_field.find( '.first-column' );\n\t\tvar tab_custom_field_column2 = tab_custom_field.find( '.second-column' );\n\n\t\tthis.edit_view_tabs[0] = [];\n\n\t\tthis.edit_view_tabs[0].push( tab_custom_field_column1 );\n\n\t\t//Status\n\t\tvar form_item_input = Global.loadWidgetByName( FormItemType.COMBO_BOX );\n\t\tform_item_input.TComboBox( { field: 'status_id' } );\n\t\tform_item_input.setSourceData( $this.status_array );\n\t\tthis.addEditFieldToColumn( $.i18n._( 'Status' ), form_item_input, tab_custom_field_column1, '' );\n\n\t\t//Name\n\t\tform_item_input = Global.loadWidgetByName( FormItemType.TEXT_INPUT );\n\t\tform_item_input.TTextInput( { field: 'name' } );\n\t\tthis.addEditFieldToColumn( $.i18n._( 'Name' ), form_item_input, tab_custom_field_column1, '' );\n\n\t\t// Parent Table\n\t\tvar form_item_input = Global.loadWidgetByName( FormItemType.COMBO_BOX );\n\t\tform_item_i