diff --git a/src/components/ADempiere/Field/index.vue b/src/components/ADempiere/Field/index.vue index 96005dab58..7c68aeee49 100644 --- a/src/components/ADempiere/Field/index.vue +++ b/src/components/ADempiere/Field/index.vue @@ -89,7 +89,7 @@ export default { required: true }, containerManager: { - type: String, + type: Object, required: true }, // receives the property that is an object with all the attributes diff --git a/src/components/ADempiere/Field/mixin/mixinField.js b/src/components/ADempiere/Field/mixin/mixinField.js index 7729e64836..a2b4a1810d 100644 --- a/src/components/ADempiere/Field/mixin/mixinField.js +++ b/src/components/ADempiere/Field/mixin/mixinField.js @@ -25,7 +25,7 @@ export default { required: true }, containerManager: { - type: String, + type: Object, required: true }, fieldMetadata: { @@ -173,8 +173,6 @@ export default { } }, actionKeyPerformed(value) { - // TODO: Delete for production - console.info('actionKeyPerformed ', this.containerManager, value) if (this.metadata.handleActionKeyPerformed) { this.$store.dispatch('notifyActionKeyPerformed', { containerUuid: this.metadata.containerUuid, @@ -223,15 +221,9 @@ export default { return } - if (this.metadata.inTable) { - this.$store.dispatch('notifyCellTableChange', { - parentUuid: this.metadata.parentUuid, - containerUuid: this.metadata.containerUuid, - field: this.metadata - }) - } this.$store.dispatch('notifyFieldChange', { containerUuid: this.metadata.containerUuid, + containerManager: this.containerManager, field: this.metadata, columnName: this.metadata.columnName }) diff --git a/src/components/ADempiere/PanelDefinition/StandardPanel.vue b/src/components/ADempiere/PanelDefinition/StandardPanel.vue index 3bdcb1bf90..0bab4e9ad0 100644 --- a/src/components/ADempiere/PanelDefinition/StandardPanel.vue +++ b/src/components/ADempiere/PanelDefinition/StandardPanel.vue @@ -75,7 +75,7 @@ export default defineComponent({ required: true }, containerManager: { - type: String, + type: Object, required: true }, panelMetadata: { diff --git a/src/components/ADempiere/PanelDefinition/index.vue b/src/components/ADempiere/PanelDefinition/index.vue index ddd27a3c84..689c6435bf 100644 --- a/src/components/ADempiere/PanelDefinition/index.vue +++ b/src/components/ADempiere/PanelDefinition/index.vue @@ -42,7 +42,7 @@ export default defineComponent({ required: true }, containerManager: { - type: String, + type: Object, required: true }, panelMetadata: { diff --git a/src/components/ADempiere/TabManager/index.vue b/src/components/ADempiere/TabManager/index.vue index ca578c5d4d..f961f3b91a 100644 --- a/src/components/ADempiere/TabManager/index.vue +++ b/src/components/ADempiere/TabManager/index.vue @@ -73,7 +73,7 @@ export default defineComponent({ required: true }, containerManager: { - type: String, + type: Object, required: true }, tabsList: { @@ -117,9 +117,7 @@ export default defineComponent({ tabUuid.value = tabuuid setCurrentTab() } - if (currentTab.value !== tabindex) { - setTabNumber(tabindex) - } + setTabNumber(tabindex) } const setTabNumber = (tabNumber = '0') => { @@ -139,9 +137,14 @@ export default defineComponent({ ...root.$route.params } }, () => {}) - - // TODO: Delete this to production - console.log('Click tab number ', tabNumber) + const containerManager = props.containerManager + if (containerManager !== undefined) { + console.log(containerManager) + // containerManager.seekTab({ + // tabNumber, + // currentTab + // }).then(() => {}) + } return tabNumber } diff --git a/src/store/modules/ADempiere/panel/actions.js b/src/store/modules/ADempiere/panel/actions.js index 15607deac2..6837b6a4a6 100644 --- a/src/store/modules/ADempiere/panel/actions.js +++ b/src/store/modules/ADempiere/panel/actions.js @@ -478,92 +478,6 @@ const actions = { } }) - // return new Promise(resolve => { - // if (isEmptyValue(fieldsList)) { - // fieldsList = getters.getFieldsListFromPanel(containerUuid) - // } - // let fieldsShowed = [] - // // const promisessList = [] - // fieldsList.map(async actionField => { - // if (actionField.isShowedFromUser) { - // fieldsShowed.push(actionField.columnName) - // } - // - // // Evaluate with hasOwnProperty if exits this value - // if (!Object.prototype.hasOwnProperty.call(newValues, actionField.columnName)) { - // if (!isChangedAllValues || withOutColumnNames.includes(actionField.columnName)) { - // // breaks if this value does not exist or ignore with out column names - // return - // } - // // set empty value and continue - // newValues[actionField.columnName] = undefined - // } - // - // if (isChangeFromCallout && - // actionField.componentPath === 'FieldSelect' && - // !Object.prototype.hasOwnProperty.call(newValues, actionField.displayColumnName)) { - // let lookup = rootGetters.getLookupItem({ - // parentUuid, - // containerUuid, - // directQuery: actionField.reference.directQuery, - // tableName: actionField.reference.tableName, - // value: newValues[actionField.columnName] - // }) - // - // if (isEmptyValue(lookup) && !isEmptyValue(newValues[actionField.columnName])) { - // lookup = await dispatch('getLookupItemFromServer', { - // parentUuid, - // containerUuid, - // tableName: actionField.reference.tableName, - // directQuery: actionField.reference.parsedDirectQuery, - // value: newValues[actionField.columnName] - // }) - // } - // if (!isEmptyValue(lookup)) { - // newValues[actionField.displayColumnName] = lookup.label - // } - // } - // // Update field - // commit('updateValueOfField', { - // parentUuid, - // containerUuid, - // columnName: actionField.columnName, - // value: newValues[actionField.columnName] - // }) - // }) - // // show fields in query - // if (isShowedField && !isEmptyValue(newValues)) { - // // join column names without duplicating it - // fieldsShowed = Array.from(new Set([ - // ...fieldsShowed, - // ...Object.keys(newValues) - // ])) - // - // dispatch('changeFieldAttributesBoolean', { - // containerUuid, - // attribute: 'isShowedFromUser', - // valueAttribute: true, - // fieldsIncludes: fieldsShowed - // }) - // } - // if (panelType === 'window') { - // dispatch('setIsloadContext', { - // containerUuid - // }) - // if (isPrivateAccess) { - // const tableName = rootGetters.getTableNameFromTab(parentUuid, containerUuid) - // // TODO: Add current id and new id to comparison - // if (!isEmptyValue(newValues[`${tableName}_ID`])) { - // dispatch('getPrivateAccessFromServer', { - // tableName, - // recordId: newValues[`${tableName}_ID`], - // userUuid: rootGetters['user/getUserUuid'] - // }) - // } - // } - // } - // }) - dispatch('setIsloadContext', { containerUuid }) @@ -577,6 +491,7 @@ const actions = { */ notifyFieldChange({ dispatch, getters }, { containerUuid, + containerManager, columnName, field, newValue @@ -598,34 +513,13 @@ const actions = { } else { value = newValue } - // if (!(panelType === 'table' || isAdvancedQuery)) { - // if (!['IN', 'NOT_IN'].includes(field.operator)) { - // value = parsedValueComponent({ - // componentPath: field.componentPath, - // columnName: field.columnName, - // displayType: field.displayType, - // value, - // isIdentifier: field.columnName.includes('_ID') - // }) - // if (field.isRange) { - // valueTo = parsedValueComponent({ - // componentPath: field.componentPath, - // columnName: field.columnName, - // displayType: field.displayType, - // value: valueTo, - // isIdentifier: field.columnName.includes('_ID') - // }) - // } - // } - // } resolve({ tableName: field.tableName, field, value }) - // Run specific action - dispatch(field.panelType + 'ActionPerformed', { + containerManager.actionPerformed({ containerUuid: field.containerUuid, field, value diff --git a/src/views/ADempiere/Test/MultiTabWindow/index.vue b/src/views/ADempiere/Test/MultiTabWindow/index.vue index cf9125fc5b..c5aed570da 100644 --- a/src/views/ADempiere/Test/MultiTabWindow/index.vue +++ b/src/views/ADempiere/Test/MultiTabWindow/index.vue @@ -21,6 +21,7 @@ :is="WindowView" :uuid="uuid" :metadata="metadata" + :container-manager="containerManager" /> @@ -37,11 +38,27 @@ export default defineComponent({ // Business Partner const uuid = 'a520de12-fb40-11e8-a479-7a0060f0aa01' const metadata = multiTabMetadata.result + const containerManager = { + actionPerformed: function(eventInfo) { + console.log('actionPerformed: ', eventInfo) + return new Promise() + }, + seekRecord: function(eventInfo) { + console.log('seekRecord: ', eventInfo) + return new Promise() + }, + + seekTab: function(eventInfo) { + console.log('seekTab: ', eventInfo) + return new Promise() + } + } return { WindowView, metadata, - uuid + uuid, + containerManager } } }) diff --git a/src/views/ADempiere/WindowView/StandardWindow.vue b/src/views/ADempiere/WindowView/StandardWindow.vue index ef9c1565cd..ef6424e0fc 100644 --- a/src/views/ADempiere/WindowView/StandardWindow.vue +++ b/src/views/ADempiere/WindowView/StandardWindow.vue @@ -39,7 +39,7 @@ export default defineComponent({ props: { containerManager: { - type: String, + type: Object, required: true }, windowMetadata: { diff --git a/src/views/ADempiere/WindowView/index.vue b/src/views/ADempiere/WindowView/index.vue index 51ce94e0e0..f08e0926e3 100644 --- a/src/views/ADempiere/WindowView/index.vue +++ b/src/views/ADempiere/WindowView/index.vue @@ -25,7 +25,7 @@ @@ -58,11 +58,15 @@ export default defineComponent({ metadata: { type: Object, default: () => {} + }, + containerManager: { + type: Object, + required: true } }, setup(props, { root }) { - const containerManager = 'window' + const containerManagerProp = props.containerManager const isLoaded = ref(false) const windowMetadata = ref({}) @@ -102,7 +106,7 @@ export default defineComponent({ return { windowUuid, - containerManager, + containerManagerProp, windowMetadata, // computed renderWindowComponent,