TimeTrex/interface/html5/dist/invoice-products-ProductViewController.bundle.js

1 line
73 KiB
JavaScript
Raw Normal View History

2022-12-13 07:10:06 +01:00
"use strict";(self.webpackChunktimetrex=self.webpackChunktimetrex||[]).push([["invoice-products-ProductViewController"],{1744:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"ProductViewController\": () => (/* binding */ ProductViewController)\n/* harmony export */ });\n/* provided dependency */ var _ = __webpack_require__(9050);\n/* provided dependency */ var $ = __webpack_require__(9755);\nclass ProductViewController extends BaseViewController {\n\tconstructor( options = {} ) {\n\t\t_.defaults( options, {\n\t\t\tel: '#product_view_container',\n\n\t\t\ttype_array: null,\n\t\t\tapply_frequency_array: null,\n\t\t\tmonth_of_year_array: null,\n\t\t\tday_of_month_array: null,\n\t\t\tday_of_week_array: null,\n\t\t\tlength_of_service_unit_array: null,\n\t\t\tdate_api: null,\n\t\t\tgroup_api: null,\n\n\t\t\tproduct_price_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 = 'ProductEditView.html';\n\t\tthis.permission_id = 'product';\n\t\tthis.viewId = 'Product';\n\t\tthis.script_name = 'ProductView';\n\t\tthis.table_name_key = 'product';\n\t\tthis.context_menu_name = $.i18n._( 'Products' );\n\t\tthis.navigation_label = $.i18n._( 'Product' );\n\t\tthis.api = TTAPI.APIProduct;\n\t\tthis.date_api = TTAPI.APITTDate;\n\t\tthis.group_api = TTAPI.APIProductGroup;\n\t\tthis.product_price_api = TTAPI.APIProductPrice;\n\n\t\tthis.render();\n\t\tthis.buildContextMenu();\n\n\t\tthis.initData();\n\t}\n\n\tinitOptions( callBack ) {\n\t\tvar $this = this;\n\t\tvar options = [\n\t\t\t{ option_name: 'type', field_name: null, api: null },\n\t\t\t{ option_name: 'status', field_name: null, api: null },\n\t\t\t{ option_name: 'unit_price_type', field_name: null, api: null },\n\t\t\t{ option_name: 'weight_unit', field_name: null, api: null },\n\t\t\t{ option_name: 'dimension_unit', field_name: null, api: null },\n\t\t\t{ option_name: 'country', field_name: null, api: TTAPI.APICompany }\n\n\t\t];\n\n\t\tthis.initDropDownOptions( options, function( result ) {\n\n\t\t\t$this.group_api.getProductGroup( '', false, false, {\n\t\t\t\tonResult: function( res ) {\n\n\t\t\t\t\tres = res.getResult();\n\t\t\t\t\tres = Global.buildTreeRecord( res );\n\n\t\t\t\t\tif ( !$this.edit_only_mode ) {\n\t\t\t\t\t\tif ( !$this.sub_view_mode && $this.basic_search_field_ui_dic['group_id'] ) {\n\t\t\t\t\t\t\t$this.basic_search_field_ui_dic['group_id'].setSourceData( res );\n//\t\t\t\t\t\t$this.adv_search_field_ui_dic['group_id'].setSourceData( res );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t$this.group_array = res;\n\n\t\t\t\t\tif ( callBack ) {\n\t\t\t\t\t\tcallBack( result ); // First to initialize drop down options, and then to initialize edit view UI.\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t} );\n\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_product': { 'label': $.i18n._( 'Product' ) },\n\t\t\t'tab_pricing': {\n\t\t\t\t'label': $.i18n._( 'Pricing' ),\n\t\t\t\t'html_template': this.getProductPricingTabHtml()\n\t\t\t},\n\t\t\t'tab_shipping': { 'label': $.i18n._( 'Shipping' ) },\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.APIProduct,\n\t\t\tid: this.script_name + '_navigation',\n\t\t\tallow_multiple_selection: false,\n\t\t\tlayout_name: 'global_product',\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_product = this.edit_view_tab.find( '#tab_product' );\n\n\t\tvar tab_product_column1 = tab_product.find( '.first-column' );\n\n\t\tthis.edit_view_tabs[0] = [];\n\n\t\tthis.edit_view_tabs[0].push( tab_product_column1 );\n\n\t\t//Type\n\t\tvar form_item_input = Global.loadWidgetByName( FormItemType.COMBO_BOX );\n\n\t\tform_item_input.TComboBox( { field: 'type_id', set_empty: false }