1 line
58 KiB
JavaScript
1 line
58 KiB
JavaScript
"use strict";(self.webpackChunktimetrex=self.webpackChunktimetrex||[]).push([["invoice-invoice_transaction-InvoiceTransactionViewController"],{5229:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"InvoiceTransactionViewController\": () => (/* binding */ InvoiceTransactionViewController)\n/* harmony export */ });\n/* provided dependency */ var _ = __webpack_require__(9050);\n/* provided dependency */ var $ = __webpack_require__(9755);\nclass InvoiceTransactionViewController extends BaseViewController {\n\tconstructor( options = {} ) {\n\t\t_.defaults( options, {\n\t\t\tel: '#invoice_transaction_view_container',\n\n\t\t\tstatus_array: null,\n\t\t\ttype_array: null,\n\t\t\tpayment_type_array: null,\n\t\t\tcurrency_array: null,\n\t\t\tcurrency_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 = 'InvoiceTransactionEditView.html';\n\t\tthis.permission_id = 'transaction';\n\t\tthis.viewId = 'InvoiceTransaction';\n\t\tthis.script_name = 'InvoiceTransactionView';\n\t\tthis.table_name_key = 'invoice_transaction';\n\t\tthis.context_menu_name = $.i18n._( 'Transactions' );\n\t\tthis.navigation_label = $.i18n._( 'Transaction' );\n\t\tthis.api = TTAPI.APITransaction;\n\t\tthis.currency_api = TTAPI.APICurrency;\n\n\t\tthis.render();\n\t\tthis.buildContextMenu();\n\n\t\tif ( !this.sub_view_mode ) {\n\t\t\tthis.initData();\n\t\t}\n\t}\n\n\tinitOptions( callBack ) {\n\t\tvar $this = this;\n\t\tvar filter = { filter_columns: { name: true, id: true } };\n\n\t\tvar options = [\n\t\t\t{ option_name: 'status', field_name: null, api: null },\n\t\t\t{ option_name: 'type', field_name: null, api: null },\n\t\t\t{ option_name: 'payment_type', field_name: null, api: null }\n\t\t];\n\n\t\tthis.currency_api.getCurrency( filter, false, {\n\t\t\tonResult: function( res ) {\n\n\t\t\t\tres = res.getResult();\n\n\t\t\t\tvar temp_currency_arr = {};\n\n\t\t\t\t$.each( res, function( key, item ) {\n\t\t\t\t\ttemp_currency_arr[item.id] = item.name;\n\t\t\t\t} );\n\n\t\t\t\t$this.currency_array = Global.buildRecordArray( temp_currency_arr );\n\n\t\t\t\t$this.initDropDownOptions( options, function( result ) {\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\n\t\t\t}\n\t\t} );\n\t}\n\n\tgetCustomContextMenuModel() {\n\t\tvar context_menu_model = {\n\t\t\texclude: ['default'],\n\t\t\tinclude: [\n\t\t\t\t'edit',\n\t\t\t\t'delete_icon',\n\t\t\t\t'delete_and_next',\n\t\t\t\t'save',\n\t\t\t\t'save_and_continue',\n\t\t\t\t'save_and_next',\n\t\t\t\t'cancel'\n\t\t\t]\n\t\t};\n\n\t\tif ( !this.sub_view_mode && !this.edit_only_mode ) {\n\n\t\t\tcontext_menu_model.include.push(\n\t\t\t\t{\n\t\t\t\t\tlabel: $.i18n._( 'Jump To' ),\n\t\t\t\t\tid: 'jump_to_header',\n\t\t\t\t\tmenu_align: 'right',\n\t\t\t\t\taction_group: 'jump_to',\n\t\t\t\t\taction_group_header: true,\n\t\t\t\t\tpermission_result: false, // to hide it in legacy context menu and avoid errors in legacy parsers.\n\t\t\t\t\tsort_order: 9050,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: $.i18n._( 'Edit Client' ),\n\t\t\t\t\tid: 'edit_client',\n\t\t\t\t\tmenu_align: 'right',\n\t\t\t\t\taction_group: 'jump_to',\n\t\t\t\t\tgroup: 'navigation',\n\t\t\t\t\tsort_order: 9050,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: $.i18n._( 'Client Contacts' ),\n\t\t\t\t\tid: 'client_contact',\n\t\t\t\t\tmenu_align: 'right',\n\t\t\t\t\taction_group: 'jump_to',\n\t\t\t\t\tgroup: 'navigation',\n\t\t\t\t\tsort_order: 9050,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: $.i18n._( 'Invoices' ),\n\t\t\t\t\tid: 'invoice',\n\t\t\t\t\tmenu_align: 'right',\n\t\t\t\t\taction_group: 'jump_to',\n\t\t\t\t\tgroup: 'navigation',\n\t\t\t\t\tsort_order: 9050,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: $.i18n._( 'Payment Methods' ),\n\t\t\t\t\tid: 'payment_method',\n\t\t\t\t\tmenu_align: 'right',\n\t\t\t\t\taction_group: 'jump_to',\n\t\t\t\t\tgroup: 'navigation',\n\t\t\t\t\tsort_order: 9050,\n\t\t\t\t},\n\t\t\t\t'export_excel'\n\t\t\t);\n\t\t}\n\n\t\treturn context_menu_model;\n\t}\n\n\tsetCustomDefaultMenuIcon( id, context_btn, grid_selected_length ) {\n\t\tswitch ( id ) {\n\t\t\tcase 'edit_client':\n\t\t\t\tthis.setDefaultMenuEditClientIcon( context_btn, grid_selected_length );\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\tsetDefaultMenuEditClientIcon( context_btn, grid_selected_length, pId ) {\n\t\tif ( grid_selected_length === 1 ) {\n\t\t\tContextMenuManager.disableMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, true );\n\t\t} else {\n\t\t\tContextMenuManager.disableMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, false );\n\t\t}\n\t}\n\n\tonCustomContextClick( id ) {\n\t\tswitch ( id ) {\n\t\t\tcase 'edit_client':\n\t\t\tcase 'client_contact':\n\t\t\tcase 'invoice':\n\t\t\tcase 'payment_method':\n\t\t\tcase 'export_excel':\n\t\t\t\tthis.onNavigationClick( id );\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\tonNavigationClick( iconName ) {\n\n\t\tvar $this = this;\n\n\t\tvar grid_selected_id_array;\n\n\t\tvar filter = { filter_data: {} };\n\n\t\tvar client_ids = [];\n\n\t\tif ( $this.edit_view && $this.current_edit_record.id ) {\n\t\t\tclient_ids.push( $this.current_edit_record.client_id );\n\t\t} else {\n\t\t\tgrid_selected_id_array = this.getGridSelectIdArray();\n\t\t\t$.each( grid_selected_id_array, function( index, value ) {\n\t\t\t\tvar grid_selected_row = $this.getRecordFromGridById( value );\n\t\t\t\tclient_ids.push( grid_selected_row.client_id );\n\t\t\t} );\n\t\t}\n\n\t\tfilter.filter_data.client_id = client_ids;\n\n\t\tswitch ( iconName ) {\n\t\t\tcase 'edit_client':\n\t\t\t\tif ( client_ids.length > 0 ) {\n\t\t\t\t\tIndexViewController.openEditView( this, 'Client', client_ids[0] );\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 'client_contact':\n\t\t\t\tGlobal.addViewTab( $this.viewId, $.i18n._( 'Transactions' ), window.location.href );\n\t\t\t\tIndexViewController.goToView( 'ClientContact', filter );\n\t\t\t\tbreak;\n\t\t\tcase 'invoice':\n\t\t\t\tGlobal.addViewTab( $this.viewId, $.i18n._( 'Transactions' ), window.location.href );\n\t\t\t\tIndexViewController.goToView( 'Invoice', filter );\n\t\t\t\tbreak;\n\t\t\tcase 'payment_method':\n\t\t\t\tGlobal.addViewTab( $this.viewId, $.i18n._( 'Transactions' ), window.location.href );\n\t\t\t\tIndexViewController.goToView( 'ClientPayment', filter );\n\t\t\t\tbreak;\n\t\t\tcase 'export_excel':\n\t\t\t\tthis.onExportClick( 'export' + this.api.key_name );\n\t\t\t\tbreak;\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_transaction': { 'label': $.i18n._( 'Transaction' ) },\n\t\t\t'tab_audit': true,\n\t\t};\n\t\tthis.setTabModel( tab_model );\n\n\t\tif ( !this.edit_only_mode ) {\n\t\t\tthis.navigation.AComboBox( {\n\t\t\t\tapi_class: TTAPI.APITransaction,\n\t\t\t\tid: this.script_name + '_navigation',\n\t\t\t\tallow_multiple_selection: false,\n\t\t\t\tlayout_name: 'global_transaction',\n\t\t\t\tnavigation_mode: true,\n\t\t\t\tshow_search_inputs: true\n\t\t\t} );\n\n\t\t\tthis.setNavigation();\n\n\t\t}\n\n\t\t//Tab 0 start\n\n\t\tvar tab_transaction = this.edit_view_tab.find( '#tab_transaction' );\n\n\t\tvar tab_transaction_column1 = tab_transaction.find( '.first-column' );\n\n\t\tthis.edit_view_tabs[0] = [];\n\n\t\tthis.edit_view_tabs[0].push( tab_transaction_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_transaction_column1, '' );\n\n\t\t//Currency\n\t\tform_item_input = Global.loadWidgetByName( FormItemType.COMBO_BOX );\n\t\tform_item_input.TComboBox( { field: 'currency_id' } );\n\t\tform_item_input.setSourceData( $this.currency_array );\n\t\tthis.addEditFieldToColumn( $.i18n._( 'Currency' ), form_item_input, tab_transaction_column1 );\n\n\t\t// Type\n\t\tform_item_input = Global.loadWidgetByName( FormItemType.COMBO_BOX );\n\t\tform_item_input.TComboBox( { field: 'type_id' } );\n\t\tform_item_input.setSourceData( $this.type_array );\n\t\tthis.addEditFieldToColumn( $.i18n._( 'Type' ), form_item_input, tab_transaction_column1 );\n\n\t\tif ( !this.edit_only_mode ) {\n\t\t\t//Product\n\t\t\tform_item_input = Global.loadWidgetByName( FormItemType.AWESOME_BOX );\n\n\t\t\tform_item_input.AComboBox( {\n\t\t\t\tapi_class: TTAPI.APIProduct,\n\t\t\t\tallow_multiple_selection: false,\n\t\t\t\tlayout_name: 'global_product',\n\t\t\t\tshow_search_inputs: true,\n\t\t\t\tset_empty: true,\n\t\t\t\tfield: 'product_id'\n\t\t\t} );\n\t\t\tthis.addEditFieldToColumn( $.i18n._( 'Product' ), form_item_input, tab_transaction_column1, '', null, true );\n\n\t\t\t//Description\n\t\t\tform_item_input = Global.loadWidgetByName( FormItemType.TEXT_INPUT );\n\n\t\t\tform_item_input.TTextInput( { field: 'description', width: '100%' } );\n\t\t\tthis.addEditFieldToColumn( $.i18n._( 'Description' ), form_item_input, tab_transaction_column1, '', null, true );\n\n\t\t\tform_item_input.parent().width( '45%' );\n\n\t\t\t//Quantity\n\t\t\tform_item_input = Global.loadWidgetByName( FormItemType.TEXT_INPUT );\n\n\t\t\tform_item_input.TTextInput( { field: 'quantity', width: 80 } );\n\t\t\tthis.addEditFieldToColumn( $.i18n._( 'Quantity' ), form_item_input, tab_transaction_column1, '', null, true );\n\n\t\t\t//Unit Cost\n\t\t\tform_item_input = Global.loadWidgetByName( FormItemType.TEXT_INPUT );\n\n\t\t\tform_item_input.TTextInput( { field: 'unit_cost', width: 80 } );\n\t\t\tthis.addEditFieldToColumn( $.i18n._( 'Unit Cost' ), form_item_input, tab_transaction_column1, '', null, true );\n\n\t\t}\n\n\t\t// Payment Type\n\t\tform_item_input = Global.loadWidgetByName( FormItemType.COMBO_BOX );\n\t\tform_item_input.TComboBox( { field: 'payment_type_id' } );\n\t\tform_item_input.setSourceData( $this.payment_type_array );\n\t\tthis.addEditFieldToColumn( $.i18n._( 'Payment Type' ), form_item_input, tab_transaction_column1, '', null, true );\n\n\t\t// Payment Method\n\t\tvar filter = {};\n\t\tfilter.filter_data = {};\n\t\tfilter.filter_data.client_id = -1;\n\t\tfilter.filter_data.type_id = [];\n\n\t\tform_item_input = Global.loadWidgetByName( FormItemType.AWESOME_BOX );\n\n\t\tform_item_input.AComboBox( {\n\t\t\tapi_class: TTAPI.APIClientPayment,\n\t\t\tallow_multiple_selection: false,\n\t\t\tlayout_name: 'global_client_payment',\n\t\t\tshow_search_inputs: true,\n\t\t\tset_empty: true,\n\t\t\tfield: 'client_payment_id'\n\t\t} );\n\t\tform_item_input.setDefaultArgs( filter );\n\t\tthis.addEditFieldToColumn( $.i18n._( 'Payment Method' ), form_item_input, tab_transaction_column1, '', null, true );\n\n\t\tif ( !this.edit_only_mode ) {\n\t\t\t//Unit Price\n\t\t\tform_item_input = Global.loadWidgetByName( FormItemType.TEXT_INPUT );\n\n\t\t\tform_item_input.TTextInput( { field: 'unit_price', width: 80 } );\n\t\t\tthis.addEditFieldToColumn( $.i18n._( 'Unit Price' ), form_item_input, tab_transaction_column1, '', null, true );\n\t\t}\n\n\t\t//Amount\n\t\tform_item_input = Global.loadWidgetByName( FormItemType.TEXT_INPUT );\n\n\t\tform_item_input.TTextInput( { field: 'amount', width: 80 } );\n\t\tthis.addEditFieldToColumn( $.i18n._( 'Amount' ), form_item_input, tab_transaction_column1 );\n\n\t\t//Effective Date\n\t\tform_item_input = Global.loadWidgetByName( FormItemType.DATE_PICKER );\n\n\t\tform_item_input.TDatePicker( { field: 'effective_date' } );\n\t\tthis.addEditFieldToColumn( $.i18n._( 'Effective Date' ), form_item_input, tab_transaction_column1 );\n\n\t\t// Confirmation Number\n\t\tform_item_input = Global.loadWidgetByName( FormItemType.TEXT_INPUT );\n\n\t\tform_item_input.TTextInput( { field: 'confirm_number', width: 120 } );\n\t\tthis.addEditFieldToColumn( $.i18n._( 'Confirmation Number' ), form_item_input, tab_transaction_column1, '', null, true );\n\n\t\t//Note\n\t\tform_item_input = Global.loadWidgetByName( FormItemType.TEXT_AREA );\n\n\t\tform_item_input.TTextArea( { field: 'note', width: '100%' } );\n\n\t\tthis.addEditFieldToColumn( $.i18n._( 'Note' ), form_item_input, tab_transaction_column1, '', null, null, true );\n\n\t\tform_item_input.parent().width( '45%' );\n\n\t\t//Process Invoice\n\t\tform_item_input = Global.loadWidgetByName( FormItemType.TEXT );\n\n\t\tform_item_input.TText( { field: 'payment_process_message' } );\n\n\t\tthis.addEditFieldToColumn( $.i18n._( 'Payment Process Message' ), form_item_input, tab_transaction_column1, '', null, true );\n\t}\n\n\tgetTransactionDefaultData( args, callBack ) {\n\t\tthis.api['get' + this.api.key_name + 'DefaultData']( args.type_id, args.invoice_id, {\n\t\t\tonResult: function( res ) {\n\t\t\t\tvar result_data = res.getResult();\n\n\t\t\t\tif ( !result_data ) {\n\t\t\t\t\tresult_data = {};\n\t\t\t\t}\n\n\t\t\t\tresult_data.invoice_id = args.invoice_id;\n\t\t\t\tresult_data.client_id = args.client_id;\n\t\t\t\tresult_data.type_id = args.type_id;\n\t\t\t\tresult_data.currency_id = args.currency_id;\n\t\t\t\tresult_data.amount = args.owing_amount;\n\t\t\t\tresult_data.effective_date = new Date().format();\n\n\t\t\t\tcallBack( result_data );\n\n\t\t\t}\n\t\t} );\n\t}\n\n\topenEditView( args ) {\n\n\t\tvar $this = this;\n\n\t\t//#Issue 2963 - Audit tab was incorrectly showing when adding a new transaction after clicking \"Payment\" when editing an invoice.\n\t\tif ( args && args.is_add ) {\n\t\t\tthis.is_add = true;\n\t\t}\n\n\t\tif ( $this.edit_only_mode ) {\n\n\t\t\t$this.initOptions(\n\t\t\t\tfunction( result ) {\n\n\t\t\t\t\tif ( !$this.edit_view ) {\n\t\t\t\t\t\t$this.initEditViewUI( $this.viewId, $this.edit_view_tpl );\n\t\t\t\t\t}\n\n\t\t\t\t\t$this.getTransactionDefaultData( args, function( result ) {\n\n\t\t\t\t\t\t$this.current_edit_record = result;\n\n\t\t\t\t\t\t$this.initEditView();\n\n\t\t\t\t\t} );\n\n\t\t\t\t}\n\t\t\t);\n\n\t\t} else {\n\n\t\t\tif ( !this.edit_view ) {\n\t\t\t\tthis.initEditViewUI( this.viewId, this.edit_view_tpl );\n\t\t\t}\n\n\t\t}\n\t}\n\n\tgetFilterColumnsFromDisplayColumns() {\n\n\t\tvar column_filter = {};\n\t\tcolumn_filter.is_owner = true;\n\t\tcolumn_filter.id = true;\n\t\tcolumn_filter.is_child = true;\n\t\tcolumn_filter.in_use = true;\n\t\tcolumn_filter.first_name = true;\n\t\tcolumn_filter.last_name = true;\n\t\tcolumn_filter.client_id = true;\n\n\t\t// Error: Unable to get property 'getGridParam' of undefined or null reference\n\t\tvar display_columns = [];\n\t\tif ( this.grid ) {\n\t\t\tdisplay_columns = this.grid.getGridParam( 'colModel' );\n\t\t}\n\n\t\tif ( display_columns ) {\n\t\t\tvar len = display_columns.length;\n\n\t\t\tfor ( var i = 0; i < len; i++ ) {\n\t\t\t\tvar column_info = display_columns[i];\n\t\t\t\tcolumn_filter[column_info.name] = true;\n\t\t\t}\n\t\t}\n\n\t\treturn column_filter;\n\t}\n\n\tbuildSearchFields() {\n\n\t\tsuper.buildSearchFields();\n\t\tthis.search_fields = [\n\n\t\t\tnew SearchField( {\n\t\t\t\tlabel: $.i18n._( 'Status' ),\n\t\t\t\tin_column: 1,\n\t\t\t\tfield: 'status_id',\n\t\t\t\tmultiple: true,\n\t\t\t\tbasic_search: true,\n\t\t\t\tadv_search: false,\n\t\t\t\tlayout_name: 'global_option_column',\n\t\t\t\tform_item_type: FormItemType.AWESOME_BOX\n\t\t\t} ),\n\n\t\t\tnew SearchField( {\n\t\t\t\tlabel: $.i18n._( 'Type' ),\n\t\t\t\tin_column: 1,\n\t\t\t\tfield: 'type_id',\n\t\t\t\tmultiple: true,\n\t\t\t\tbasic_search: true,\n\t\t\t\tadv_search: false,\n\t\t\t\tlayout_name: 'global_option_column',\n\t\t\t\tform_item_type: FormItemType.AWESOME_BOX\n\t\t\t} ),\n\n\t\t\tnew SearchField( {\n\t\t\t\tlabel: $.i18n._( 'Product' ),\n\t\t\t\tin_column: 1,\n\t\t\t\tfield: 'product_id',\n\t\t\t\tlayout_name: 'global_product',\n\t\t\t\tapi_class: TTAPI.APIProduct,\n\t\t\t\tmultiple: true,\n\t\t\t\tbasic_search: true,\n\t\t\t\tadv_search: false,\n\t\t\t\tform_item_type: FormItemType.AWESOME_BOX\n\t\t\t} ),\n\n\t\t\tnew SearchField( {\n\t\t\t\tlabel: $.i18n._( 'Invoice Number' ),\n\t\t\t\tin_column: 2,\n\t\t\t\tfield: 'invoice_number',\n\t\t\t\tmultiple: true,\n\t\t\t\tbasic_search: true,\n\t\t\t\tadv_search: false,\n\t\t\t\tform_item_type: FormItemType.TEXT_INPUT\n\t\t\t} ),\n\n\t\t\tnew SearchField( {\n\t\t\t\tlabel: $.i18n._( 'Client' ),\n\t\t\t\tin_column: 2,\n\t\t\t\tfield: 'client_id',\n\t\t\t\tlayout_name: 'global_client',\n\t\t\t\tapi_class: TTAPI.APIClient,\n\t\t\t\tmultiple: true,\n\t\t\t\tbasic_search: true,\n\t\t\t\tadv_search: false,\n\t\t\t\tform_item_type: FormItemType.AWESOME_BOX\n\t\t\t} )\n\t\t];\n\t}\n\n\tsetSelectLayout() {\n\t\tif ( this.sub_view_mode ) {\n\t\t\tsuper.setSelectLayout( ['client'] );\n\t\t} else {\n\t\t\tsuper.setSelectLayout();\n\t\t}\n\t}\n\n\tonFormItemChange( target, doNotValidate ) {\n\n\t\tvar key = target.getField();\n\t\tvar c_value = target.getValue();\n\n\t\tthis.current_edit_record[key] = c_value;\n\n\t\t//#2121 added to trigger confirmation dialog on changed and navigation arrow click\n\t\tthis.is_changed = true;\n\n\t\tif ( key === 'type_id' ) {\n\t\t\tthis.onTypeChange();\n\t\t}\n\n\t\tif ( key === 'payment_type_id' ) {\n\t\t\tthis.onPaymentTypeChange( true );\n\t\t}\n\n\t\tif ( !doNotValidate ) {\n\t\t\tthis.validate();\n\t\t}\n\t}\n\n\tsetCurrentEditRecordData() {\n\n\t\tif ( this.current_edit_record.hasOwnProperty( 'payment_process_message' ) && this.current_edit_record.payment_process_message ) {\n\t\t\tthis.attachElement( 'payment_process_message' );\n\t\t} else {\n\t\t\tthis.detachElement( 'payment_process_message' );\n\t\t}\n\n\t\t//Set current edit record data to all widgets\n\t\tfor ( var key in this.current_edit_record ) {\n\n\t\t\tif ( !this.current_edit_record.hasOwnProperty( key ) ) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tvar widget = this.edit_view_ui_dic[key];\n\t\t\tif ( Global.isSet( widget ) ) {\n\t\t\t\tswitch ( key ) {\n\t\t\t\t\tcase 'type_id':\n\t\t\t\t\t\twidget.setValue( this.current_edit_record[key] );\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\twidget.setValue( this.current_edit_record[key] );\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t}\n\t\t}\n\n\t\tthis.collectUIDataToCurrentEditRecord();\n\t\tthis.setEditViewDataDone();\n\t}\n\n\tsetEditViewDataDone() {\n\n\t\tsuper.setEditViewDataDone();\n\t\tthis.onTypeChange();\n\t\tthis.onPaymentTypeChange();\n\t\tthis.isEditChange();\n\t}\n\n\tonTypeChange() {\n\t\tif ( this.current_edit_record.type_id == 10 ) { //Debit\n\t\t\tthis.detachElement( 'product_id' );\n\t\t\tthis.detachElement( 'description' );\n\t\t\tthis.detachElement( 'quantity' );\n\t\t\tthis.detachElement( 'unit_cost' );\n\t\t\tthis.detachElement( 'payment_type_id' );\n\t\t\tthis.detachElement( 'client_payment_id' );\n\t\t\tthis.detachElement( 'unit_price' );\n\t\t\tthis.detachElement( 'confirm_number' );\n\n\t\t} else {\n\t\t\tif ( !this.edit_only_mode ) {\n\t\t\t\tthis.detachElement( 'product_id' );\n\t\t\t\tthis.detachElement( 'description' );\n\t\t\t\tthis.detachElement( 'quantity' );\n\t\t\t\tthis.detachElement( 'unit_cost' );\n\t\t\t\tthis.detachElement( 'unit_price' );\n\t\t\t}\n\n\t\t\tthis.attachElement( 'payment_type_id' );\n\t\t\tthis.detachElement( 'client_payment_id' );\n\t\t\tthis.detachElement( 'confirm_number' );\n\t\t}\n\n\t\tthis.editFieldResize();\n\t}\n\n\tonPaymentTypeChange( cleanValue ) {\n\t\tif ( cleanValue ) {\n\t\t\tthis.edit_view_ui_dic['client_payment_id'].setValue( false );\n\t\t\tthis.current_edit_record.client_payment_id = false;\n\t\t}\n\t\tif ( this.current_edit_record.payment_type_id == 10 ) {\n\t\t\tthis.detachElement( 'client_payment_id' );\n\t\t\tthis.detachElement( 'confirm_number' );\n\n\t\t} else if ( this.current_edit_record.payment_type_id == 30 || this.current_edit_record.payment_type_id == 35 || this.current_edit_record.payment_type_id == 40 ) {\n\t\t\tthis.edit_view_ui_dic['client_payment_id'].setSourceData( null );\n\t\t\tif ( this.current_edit_record.payment_type_id == 40 ) {\n\t\t\t\tthis.edit_view_ui_dic['client_payment_id'].default_args.filter_data.client_id = this.current_edit_record['client_id'];\n\t\t\t\tthis.edit_view_ui_dic['client_payment_id'].default_args.filter_data.type_id = [40];\n\t\t\t} else {\n\t\t\t\tthis.edit_view_ui_dic['client_payment_id'].default_args.filter_data.client_id = this.current_edit_record['client_id'];\n\t\t\t\tthis.edit_view_ui_dic['client_payment_id'].default_args.filter_data.type_id = [30];\n\t\t\t}\n\t\t\tthis.attachElement( 'client_payment_id' );\n\t\t\tthis.detachElement( 'confirm_number' );\n\n\t\t} else {\n\t\t\tthis.attachElement( 'confirm_number' );\n\t\t\tthis.detachElement( 'client_payment_id' );\n\t\t}\n\n\t\tthis.editFieldResize();\n\t}\n\n\tisEditChange() {\n\n\t\tif ( this.current_edit_record.id ) {\n\t\t\tthis.edit_view_ui_dic['status_id'].setEnabled( false );\n\t\t\tthis.edit_view_ui_dic['type_id'].setEnabled( false );\n\t\t\tthis.edit_view_ui_dic['product_id'].setEnabled( false );\n\t\t\tthis.edit_view_ui_dic['quantity'].setEnabled( false );\n\t\t\tthis.edit_view_ui_dic['unit_cost'].setEnabled( false );\n\t\t\tthis.edit_view_ui_dic['unit_price'].setEnabled( false );\n\t\t} else {\n\n\t\t\tif ( this.edit_only_mode ) {\n\t\t\t\tthis.edit_view_ui_dic['status_id'].setEnabled( false );\n\t\t\t\tthis.edit_view_ui_dic['currency_id'].setEnabled( false );\n\t\t\t\tthis.edit_view_ui_dic['type_id'].setEnabled( false );\n\t\t\t} else {\n\t\t\t\tthis.edit_view_ui_dic['status_id'].setEnabled( true );\n\t\t\t\tthis.edit_view_ui_dic['type_id'].setEnabled( true );\n\t\t\t\tthis.edit_view_ui_dic['product_id'].setEnabled( true );\n\t\t\t\tthis.edit_view_ui_dic['quantity'].setEnabled( true );\n\t\t\t\tthis.edit_view_ui_dic['unit_cost'].setEnabled( true );\n\t\t\t\tthis.edit_view_ui_dic['unit_price'].setEnabled( true );\n\t\t\t}\n\n\t\t}\n\t}\n\n\tonSaveResult( result ) {\n\t\tvar $this = this;\n\t\tif ( result.isValid() ) {\n\t\t\tvar result_data = result.getResult();\n\t\t\tif ( !this.edit_only_mode ) {\n\t\t\t\tif ( result_data === true ) {\n\t\t\t\t\t$this.refresh_id = $this.current_edit_record.id;\n\t\t\t\t} else if ( TTUUID.isUUID( result_data ) && result_data != TTUUID.zero_id && result_data != TTUUID.not_exist_id ) {\n\t\t\t\t\t$this.refresh_id = result_data;\n\t\t\t\t}\n\n\t\t\t\t$this.search();\n\t\t\t}\n\n\t\t\t$this.onSaveDone( result );\n\n\t\t\t$this.removeEditView();\n\n\t\t\tif ( this.edit_only_mode ) {\n\t\t\t\t$this.parent_view_controller.initInsideEditorData( true );\n\t\t\t}\n\n\t\t} else {\n\t\t\t$this.setErrorMenu();\n\t\t\t$this.setErrorTips( result );\n\n\t\t}\n\t}\n\n}\n\nInvoiceTransactionViewController.loadSubView = function( container, beforeViewLoadedFun, afterViewLoadedFun ) {\n\n\tGlobal.loadViewSource( 'InvoiceTransaction', 'SubInvoiceTransactionView.html', function( result ) {\n\t\tvar args = {};\n\t\tvar template = _.template( result );\n\n\t\tif ( Global.isSet( beforeViewLoadedFun ) ) {\n\t\t\tbeforeViewLoadedFun();\n\t\t}\n\n\t\tif ( Global.isSet( container ) ) {\n\t\t\tcontainer.html( template( args ) );\n\t\t\tif ( Global.isSet( afterViewLoadedFun ) ) {\n\t\t\t\tafterViewLoadedFun( sub_invoice_transaction_view_controller );\n\t\t\t}\n\t\t}\n\t} );\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64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