diff --git a/src/components/ADempiere/ContextMenu/contextMenuMixin.js b/src/components/ADempiere/ContextMenu/contextMenuMixin.js index 02c767e0..3a3b5867 100644 --- a/src/components/ADempiere/ContextMenu/contextMenuMixin.js +++ b/src/components/ADempiere/ContextMenu/contextMenuMixin.js @@ -345,12 +345,12 @@ export const contextMixin = { } this.actions = this.metadataMenu.actions if (this.panelType === 'window') { - var processAction = this.actions.find(item => { + const processAction = this.actions.find(item => { if (item.name === 'Procesar Orden' || (item.name === 'Process Order')) { return item } }) - this.$store.dispatch('setOrden', processAction) + this.$store.dispatch('setOrder', processAction) } if (this.actions && this.actions.length) { diff --git a/src/components/ADempiere/Field/fieldPopovers/fieldContextInfo.vue b/src/components/ADempiere/Field/fieldPopovers/fieldContextInfo.vue index 53c3995e..6121e92b 100644 --- a/src/components/ADempiere/Field/fieldPopovers/fieldContextInfo.vue +++ b/src/components/ADempiere/Field/fieldPopovers/fieldContextInfo.vue @@ -1,7 +1,6 @@ - + {{ fieldAttributes.name }} - - : {{ fieldAttributes.help }} - + {{ fieldAttributes.help }} + + + + + + {{ field.displayColumn }} + + + {{ labelDocumentActions }} + + {{ field.description }} + {{ descriptionDocumentActions }} + + + + + diff --git a/src/components/ADempiere/Field/index.vue b/src/components/ADempiere/Field/index.vue index 92606b5d..1b6cea42 100644 --- a/src/components/ADempiere/Field/index.vue +++ b/src/components/ADempiere/Field/index.vue @@ -25,7 +25,7 @@ :field-value="field.value" /> {{ isFieldOnly() }} - - - - - - {{ field.displayColumn }} - - - {{ labelDocumentActions }} - - {{ field.description }} - {{ descriptionDocumentActions }} - - + + + import FieldContextInfo from '@/components/ADempiere/Field/fieldPopovers/fieldContextInfo' +import FieldDocumentStatus from '@/components/ADempiere/Field/fieldPopovers/fieldDocumentStatus' import FieldOperatorComparison from '@/components/ADempiere/Field/fieldPopovers/fieldOperatorComparison' import FieldTranslated from '@/components/ADempiere/Field/fieldPopovers/fieldTranslated' import { FIELD_ONLY } from '@/components/ADempiere/Field/references' import { DEFAULT_SIZE } from '@/components/ADempiere/Field/fieldSize' import { fieldIsDisplayed } from '@/utils/ADempiere' -import { showMessage } from '@/utils/ADempiere/notification' -import { recursiveTreeSearch } from '@/utils/ADempiere/valueUtils' /** * This is the base component for linking the components according to the @@ -108,6 +80,7 @@ export default { name: 'FieldDefinition', components: { FieldContextInfo, + FieldDocumentStatus, FieldOperatorComparison, FieldTranslated }, @@ -148,8 +121,7 @@ export default { }, data() { return { - field: {}, - valueActionDocument: '' + field: {} } }, computed: { @@ -267,36 +239,22 @@ export default { } return false }, - listDocumentActions() { - return this.$store.getters.getListDocumentActions.documentActionsList + processOrderUuid() { + return this.$store.getters.getOrders }, - defaultDocumentActions() { - return this.$store.getters.getListDocumentActions.defaultDocumentAction - }, - labelDocumentActions() { - const found = this.listDocumentActions.find(element => { - if (element.value === this.valueActionDocument) { - return element + isDocuemntStatus() { + if (this.panelType === 'window') { + if (this.field.columnName === 'DocStatus' && !this.isEmptyValue(this.processOrderUuid)) { + return true } - }) - if (this.isEmptyValue(found)) { - return this.valueActionDocument } - return found.name + return false }, - descriptionDocumentActions() { - const found = this.listDocumentActions.find(element => { - if (element.value === this.valueActionDocument) { - return element - } - }) - if (this.isEmptyValue(found)) { - return this.valueActionDocument + isContextInfo() { + if (!this.isAdvancedQuery) { + return (this.field.contextInfo && this.field.contextInfo.isActive) || this.field.reference.zoomWindowList.length } - return found.description - }, - processOrdenUuid() { - return this.$store.getters.getOrden + return false } }, watch: { @@ -309,42 +267,6 @@ export default { this.field = this.metadataField }, methods: { - showMessage, - listActionDocument() { - this.$store.dispatch('listDocumentActionStatus', { - tableName: 'C_Order', - recordUuid: this.$route.query.action - }) - }, - documentActionChange(value) { - var actionProcess = this.$store.getters.getOrden - this.$store.dispatch('notifyFieldChange', { - parentUuid: this.parentUuid, - containerUuid: this.containerUuid, - columnName: 'DocAction', - isSendToServer: true, - newValue: value - }) - this.$store.dispatch('startProcess', { - action: { - uuid: actionProcess.uuid, - id: actionProcess.id, - name: actionProcess.name - }, // process metadata - tableName: this.$route.params.tableName, - recordId: this.$route.params.recordId, - recordUuid: this.$route.query.action, - parametersList: [{ - columnName: 'DocStatus', - value: this.valueActionDocument - }], - isActionDocument: true, - parentUuid: this.parentUuid, - panelType: this.panelType, - containerUuid: this.containerUuid// determinate if get table name and record id (window) or selection (browser) - }) - this.valueActionDocument = '' - }, isDisplayed() { if (this.isAdvancedQuery) { return this.field.isShowedFromUser @@ -424,30 +346,6 @@ export default { if (this.isDisplayed() && this.isMandatory() && !this.isReadOnly()) { this.$refs[this.field.columnName].activeFocus() } - }, - redirect({ window, columnName, value }) { - const viewSearch = recursiveTreeSearch({ - treeData: this.permissionRoutes, - attributeValue: window.uuid, - attributeName: 'meta', - secondAttribute: 'uuid', - attributeChilds: 'children' - }) - if (viewSearch) { - this.$router.push({ - name: viewSearch.name, - query: { - action: 'advancedQuery', - tabParent: 0, - [columnName]: value - } - }) - } else { - this.showMessage({ - type: 'error', - message: this.$t('notifications.noRoleAccess') - }) - } } } } diff --git a/src/store/modules/ADempiere/contextMenu.js b/src/store/modules/ADempiere/contextMenu.js index 0300063d..6c535b33 100644 --- a/src/store/modules/ADempiere/contextMenu.js +++ b/src/store/modules/ADempiere/contextMenu.js @@ -17,7 +17,12 @@ import { requestListDocumentActions } from '@/api/ADempiere/data' const contextMenu = { state: { contextMenu: [], - listDocumentAction: [] + listDocumentAction: { + defaultDocumentAction: undefined, + documentActionsList: [], + recordId: undefined, + recordUuid: undefined + } }, mutations: { setContextMenu(state, payload) { @@ -34,21 +39,37 @@ const contextMenu = { setContextMenu({ commit }, payload) { commit('setContextMenu', payload) }, - listDocumentActionStatus({ commit }, params) { - const tableName = params.tableName - const recordId = params.recordId - const recordUuid = params.recordUuid - const documentStatus = params.DocStatus - const documentAction = params.DocAction - const pageSize = 0 - const pageToken = '' - requestListDocumentActions({ tableName, recordId, recordUuid, documentStatus, documentAction, pageSize, pageToken }) - .then(response => { - var documentAction = { - defaultDocumentAction: response.defaultDocumentAction, - documentActionsList: response.documentActionsList + /** + * TODO: Verify tableName params to change in constant + * @param {number} recordId + * @param {string} recordUuid + */ + listDocumentActionStatus({ commit }, { + tableName = 'C_Order', + recordId, + recordUuid, + documentAction, + documentStatus + }) { + requestListDocumentActions({ + tableName, + recordId, + recordUuid, + documentAction, + documentStatus, + pageSize: 0, + pageToken: '' + }) + .then(responseDocumentActios => { + const documentAction = { + defaultDocumentAction: responseDocumentActios.defaultDocumentAction, + documentActionsList: responseDocumentActios.documentActionsList, + recordId, + recordUuid } + commit('listDocumentAction', documentAction) + return documentAction }) .catch(error => { console.warn(error) @@ -79,6 +100,9 @@ const contextMenu = { }, getListDocumentActions: (state) => { return state.listDocumentAction + }, + getListDocumentActionByUuid: (state) => (recordUuid) => { + return state.listDocumentAction.find(itemDocumentAction => itemDocumentAction.recordUuid === recordUuid) } } } diff --git a/src/store/modules/ADempiere/utils.js b/src/store/modules/ADempiere/utils.js index 39ce09b2..61455325 100644 --- a/src/store/modules/ADempiere/utils.js +++ b/src/store/modules/ADempiere/utils.js @@ -58,7 +58,7 @@ const utils = { setProcessTable(state, recordTable) { state.recordTable = recordTable }, - setOrden(state, payload) { + setOrder(state, payload) { state.documentAction = payload }, setChatText(state, payload) { @@ -146,8 +146,8 @@ const utils = { setReportTypeToShareLink({ commit }, value) { commit('setReportTypeToShareLink', value) }, - setOrden({ commit }, params) { - commit('setOrden', params) + setOrder({ commit }, params) { + commit('setOrder', params) } }, getters: { @@ -209,7 +209,7 @@ const utils = { getIsReadedOpenRoute: (state) => { return state.openRoute.isReaded }, - getOrden: (state) => { + getOrders: (state) => { return state.documentAction }, getChatTextLong: (state) => { diff --git a/src/views/ADempiere/Window/index.vue b/src/views/ADempiere/Window/index.vue index 4386c702..670e5b05 100644 --- a/src/views/ADempiere/Window/index.vue +++ b/src/views/ADempiere/Window/index.vue @@ -22,7 +22,7 @@ circle style="margin-left: 10px;" class="el-button-window" - @click="handleChangeShowedRecordNavigation(isShowedRecordNavigation)" + @click="handleChangeShowedRecordNavigation(false)" /> - - + @@ -255,10 +249,6 @@ export default { isPanel: false, activeInfo: 'listChatEntries', show: false, - chatNote: '', - typeAction: 0, - isLoadingFromServer: false, - currentKey: 100, // TODO: Manage attribute with store isShowedRecordPanel: false } @@ -386,45 +376,26 @@ export default { return true }, getIsWorkflowLog() { - if (this.isEmptyValue(this.gettersListWorkflow)) { + if (this.isEmptyValue(this.$store.getters.getWorkflow)) { return false } return true }, - getIsChat() { - return this.$store.getters.getIsNote - }, - isNote() { - return this.$store.getters.getIsNote - }, - gettersListWorkflow() { - return this.$store.getters.getWorkflow - }, getterShowContainerInfo() { return this.$store.getters.getShowContainerInfo } }, watch: { $route(value) { - if (value.query.action === 'create-new') { - this.$store.dispatch(this.activeInfo, { - tableName: this.$route.params.tableName, - recordId: this.$route.params.recordId - }) - .then((response) => { + this.$store.dispatch(this.activeInfo, { + tableName: this.$route.params.tableName, + recordId: this.$route.params.recordId + }) + .then(response => { + if (value.query.action === 'create-new') { this.$store.dispatch('isNote', false) - }) - } else { - this.$store.dispatch(this.activeInfo, { - tableName: this.$route.params.tableName, - recordId: this.$route.params.recordId + } }) - } - }, - 'this.$route.params'(newValue, oldValue) { - if (!this.isEmptyValue(newValue)) { - this.getIsRecordLocked() - } } }, created() { @@ -449,12 +420,6 @@ export default { recordId: this.$route.params.recordId }) }, - refres(tabInfo) { - this.$store.dispatch(tabInfo, { - tableName: this.$route.params.tableName, - recordId: this.$route.params.recordId - }) - }, // callback new size onDrag(size) { this.$store.dispatch('setSplitHeightTop', { @@ -468,7 +433,6 @@ export default { getWindow() { if (this.getterWindow) { this.generateWindow() - this.isLoadingFromServer = true return } this.$store.dispatch('getWindowFromServer', { @@ -477,7 +441,6 @@ export default { }) .then(response => { this.generateWindow() - this.isLoadingFromServer = true }) }, generateWindow() { @@ -485,23 +448,22 @@ export default { let isShowRecords = this.isShowedRecordNavigation if (isShowRecords === undefined) { - if (['M', 'Q'].includes(this.windowMetadata.windowType) && this.getterRecordList >= 10) { + if ((['M', 'Q'].includes(this.windowMetadata.windowType) && this.getterRecordList >= 10) || + this.$route.query.action === 'advancedQuery') { isShowRecords = true } else if (this.windowMetadata.windowType === 'T') { isShowRecords = false - } else if (this.$route.query.action === 'advancedQuery') { - isShowRecords = true } + this.handleChangeShowedRecordNavigation(!isShowRecords) } - this.handleChangeShowedRecordNavigation(!isShowRecords) this.isLoaded = true }, - handleChangeShowedRecordNavigation(value) { + handleChangeShowedRecordNavigation(valueToChange) { this.$store.dispatch('changeWindowAttribute', { parentUuid: this.windowUuid, // act as parentUuid attributeName: 'isShowedRecordNavigation', - attributeValue: !value + attributeValue: valueToChange }) }, handleChangeShowedPanel(value) { @@ -514,12 +476,6 @@ export default { attributeName: 'isShowedTabsChildren', attributeValue: !this.isShowedTabsChildren }) - }, - getIsRecordLocked() { - if (this.$store.getters.getRecordPrivateAccess(this.$route.params.tableName, this.$route.params.recordId)) { - return true - } - return false } } }
{{ field.description }}
{{ descriptionDocumentActions }}