diff --git a/src/components/ADempiere/ContextMenu/contextMenuMobile.vue b/src/components/ADempiere/ContextMenu/contextMenuMobile.vue index f6a0ca99..639c3ed2 100644 --- a/src/components/ADempiere/ContextMenu/contextMenuMobile.vue +++ b/src/components/ADempiere/ContextMenu/contextMenuMobile.vue @@ -130,7 +130,6 @@ export default { mixins: [contextMixin], computed: { isPanelTypeMobile() { - console.log(this.panelType, this.$route.meta.type) if (this.$route.meta.type === 'process' || this.$route.meta.type === 'report') { return true } diff --git a/src/lang/ADempiere/es.js b/src/lang/ADempiere/es.js index 39adfc98..344e4546 100644 --- a/src/lang/ADempiere/es.js +++ b/src/lang/ADempiere/es.js @@ -170,8 +170,8 @@ export default { }, report: { ExportXlsx: '(xlsx) Extencion de Archivo Excel', - ExportXls: '(xls) Archivo Excel ', - ExporXml: '(xml) Archivo Lenguaje de marcas Extensible', + ExportXls: '(xls) Archivo Excel', + ExporXml: '(xml) Archivo Lenguaje de marcas Extensible', ExporCsv: '(csv) Archivo Separado por Coma', ExportTxt: '(txt) Archivo de Texto Delimitado por Tabuladores', ExportHtml: '(html) Lenguaje de Marcas de Hipertexto' diff --git a/src/store/modules/ADempiere/browser.js b/src/store/modules/ADempiere/browser.js index 4e4c7c38..df5b1e13 100644 --- a/src/store/modules/ADempiere/browser.js +++ b/src/store/modules/ADempiere/browser.js @@ -116,6 +116,24 @@ const browser = { } }) + // Panel for save on store + const newBrowser = { + ...browserResponse, + containerUuid, + fieldList: fieldsList, + panelType, + // app attributes + awaitForValues, // control to values + awaitForValuesToQuery: awaitForValues, // get values from request search + isShowedCriteria, + isShowedTotals: true + } + + commit('addBrowser', newBrowser) + dispatch('addPanel', newBrowser) + + resolve(newBrowser) + // Convert from gRPC process list const actions = [] if (process) { @@ -140,28 +158,8 @@ const browser = { // Add process menu dispatch('setContextMenu', { containerUuid, - relations: [], - actions, - references: [] + actions }) - - // Panel for save on store - const newBrowser = { - ...browserResponse, - containerUuid, - fieldList: fieldsList, - panelType, - // app attributes - awaitForValues, // control to values - awaitForValuesToQuery: awaitForValues, // get values from request search - isShowedCriteria, - isShowedTotals: true - } - - commit('addBrowser', newBrowser) - dispatch('addPanel', newBrowser) - - resolve(newBrowser) }) .catch(error => { router.push({ path: '/dashboard' }) diff --git a/src/store/modules/ADempiere/contextMenu.js b/src/store/modules/ADempiere/contextMenu.js index 86e3d31b..99dded6b 100644 --- a/src/store/modules/ADempiere/contextMenu.js +++ b/src/store/modules/ADempiere/contextMenu.js @@ -10,8 +10,6 @@ import { requestListDocumentActions, requestListDocumentStatuses } from '@/api/A // relations: [], // actions: [], // references: [] -// defaultAction: {}, -// lastAction: {} // } // ] const initStateContextMenu = { @@ -50,8 +48,25 @@ const contextMenu = { } }, actions: { - setContextMenu({ commit }, payload) { - commit('setContextMenu', payload) + /** + * Sub menu associated with panel + * @param {string} containerUuid + * @param {array} relations + * @param {array} actions + * @param {array} references + */ + setContextMenu({ commit }, { + containerUuid, + relations = [], + actions = [], + references = [] + }) { + commit('setContextMenu', { + containerUuid, + relations, + actions, + references + }) }, /** * TODO: Verify tableName params to change in constant diff --git a/src/store/modules/ADempiere/process.js b/src/store/modules/ADempiere/process.js index 60ffbd63..85daa97c 100644 --- a/src/store/modules/ADempiere/process.js +++ b/src/store/modules/ADempiere/process.js @@ -18,7 +18,7 @@ const process = { }, actions: { /** - * + * Get process metadata from server * @param {string} containerUuid * @param {object} routeToDelete, route to close in tagView when fail */ @@ -26,31 +26,32 @@ const process = { containerUuid, routeToDelete }) { - let printFormatsAvailable - dispatch('requestPrintFormats', { - processUuid: containerUuid - }) - .then(response => { - printFormatsAvailable = response - }) return new Promise(resolve => { getProcessMetadata(containerUuid) - .then(responseProcess => { - responseProcess.printFormatsAvailable = printFormatsAvailable + .then(async responseProcess => { + let printFormatsAvailable = [] + if (responseProcess.isReport) { + printFormatsAvailable = await dispatch('requestPrintFormats', { + processUuid: containerUuid + }) + } + const { processDefinition, actions } = generateProcess({ - processToGenerate: responseProcess + processToGenerate: { + ...responseProcess, + printFormatsAvailable + } }) + dispatch('addPanel', processDefinition) commit('addProcess', processDefinition) + resolve(processDefinition) // Add process menu dispatch('setContextMenu', { containerUuid, - relations: [], - actions, - references: [] + actions }) - resolve(processDefinition) }) .catch(error => { router.push({ @@ -79,16 +80,13 @@ const process = { dispatch('addPanel', processDefinition) commit('addProcess', processDefinition) + resolve(processDefinition) // Add process menu dispatch('setContextMenu', { containerUuid: processDefinition.uuid, - relations: [], - actions, - references: [] + actions }) - - resolve(processDefinition) }) } }, diff --git a/src/store/modules/ADempiere/reportControl.js b/src/store/modules/ADempiere/reportControl.js index 3475b9de..b35eeb45 100644 --- a/src/store/modules/ADempiere/reportControl.js +++ b/src/store/modules/ADempiere/reportControl.js @@ -38,27 +38,30 @@ const reportControl = { processUuid, instanceUuid }) { - return requestPrintFormats({ processUuid }) - .then(printFormatResponse => { - const printFormatList = printFormatResponse.printFormatsList.map(printFormatItem => { - return { - ...printFormatItem, - type: 'updateReport', - option: 'printFormat', - instanceUuid, - processUuid, - processId - } + return new Promise(resolve => { + requestPrintFormats({ processUuid }) + .then(printFormatResponse => { + const printFormatList = printFormatResponse.printFormatsList.map(printFormatItem => { + return { + ...printFormatItem, + type: 'updateReport', + option: 'printFormat', + instanceUuid, + processUuid, + processId + } + }) + commit('setReportFormatsList', { + containerUuid: processUuid, + printFormatList + }) + + resolve(printFormatList) }) - commit('setReportFormatsList', { - containerUuid: processUuid, - printFormatList + .catch(error => { + console.warn(`Error getting print formats: ${error.message}. Code: ${error.code}.`) }) - return printFormatList - }) - .catch(error => { - console.warn(`Error getting print formats: ${error.message}. Code: ${error.code}.`) - }) + }) }, requestReportViews({ commit }, { processId, @@ -66,28 +69,31 @@ const reportControl = { instanceUuid, printFormatUuid }) { - return requestReportViews({ processUuid }) - .then(reportViewResponse => { - const reportViewList = reportViewResponse.reportViewsList.map(reportViewItem => { - return { - ...reportViewItem, - type: 'updateReport', - option: 'reportView', - instanceUuid, - printFormatUuid, - processUuid, - processId - } + return new Promise(resolve => { + requestReportViews({ processUuid }) + .then(reportViewResponse => { + const reportViewList = reportViewResponse.reportViewsList.map(reportViewItem => { + return { + ...reportViewItem, + type: 'updateReport', + option: 'reportView', + instanceUuid, + printFormatUuid, + processUuid, + processId + } + }) + commit('setReportViewsList', { + containerUuid: processUuid, + viewList: reportViewList + }) + + resolve(reportViewList) }) - commit('setReportViewsList', { - containerUuid: processUuid, - viewList: reportViewList + .catch(error => { + console.warn(`Error getting report views: ${error.message}. Code: ${error.code}.`) }) - return reportViewList - }) - .catch(error => { - console.warn(`Error getting report views: ${error.message}. Code: ${error.code}.`) - }) + }) }, requestDrillTables({ commit }, { processId, @@ -97,97 +103,79 @@ const reportControl = { tableName, reportViewUuid }) { - return requestDrillTables({ tableName }) - .then(responseDrillTables => { - const drillTablesList = responseDrillTables.drillTablesList.map(drillTableItem => { - return { - ...drillTableItem, - name: drillTableItem.printName, - type: 'updateReport', - option: 'drillTable', - instanceUuid, - printFormatUuid, - reportViewUuid, - processUuid, - processId - } + return new Promise(resolve => { + requestDrillTables({ tableName }) + .then(responseDrillTables => { + const drillTablesList = responseDrillTables.drillTablesList.map(drillTableItem => { + return { + ...drillTableItem, + name: drillTableItem.printName, + type: 'updateReport', + option: 'drillTable', + instanceUuid, + printFormatUuid, + reportViewUuid, + processUuid, + processId + } + }) + commit('setDrillTablesList', { + containerUuid: processUuid, + drillTablesList + }) + + resolve(drillTablesList) }) - commit('setDrillTablesList', { - containerUuid: processUuid, - drillTablesList + .catch(error => { + console.warn(`Error getting drill tables: ${error.message}. Code: ${error.code}.`) }) - return drillTablesList - }) - .catch(error => { - console.warn(`Error getting drill tables: ${error.message}. Code: ${error.code}.`) - }) - }, - getReportOutputFromServer({ commit, getters, rootGetters }, parameters) { - if (isEmptyValue(parameters.printFormatUuid)) { - parameters.printFormatUuid = getters.getDefaultPrintFormat(parameters.processUuid).printFormatUuid - } - const { - tableName, - printFormatUuid, - reportViewUuid, - isSummary, - reportName, - reportType, - processUuid, - processId, - instanceUuid, - option - } = parameters - const parametersList = rootGetters.getParametersToServer({ containerUuid: processUuid }) - return getReportOutput({ - parametersList, - printFormatUuid, - reportViewUuid, - isSummary, - reportName, - reportType, - tableName }) - .then(response => { - const reportOutput = { - ...response, - processId: processId, - processUuid: processUuid, - isError: false, - instanceUuid: instanceUuid, - isReport: true, - option: option - } - commit('setNewReportOutput', reportOutput) - return reportOutput - }) - .catch(error => { - const reportOutput = { - uuid: '', - processName: '', - description: '', - fileName: '', - output: '', - mimeType: '', - dataCols: null, - dataRows: null, - headerName: '', - footerName: '', - printFormatUuid: '', - reportViewUuid: '', - tableName: '', - outputStream: [], - reportType: '', - processId: null, - processUuid: '', - isError: true, - instanceUuid: '', - isReport: true, - option: '' - } - console.warn(`Error getting report output: ${error.message}. Code: ${error.code}.`) - return reportOutput + }, + getReportOutputFromServer({ commit, getters, rootGetters }, { + tableName, + printFormatUuid, + reportViewUuid, + isSummary, + reportName, + reportType, + processUuid, + processId, + instanceUuid, + option + }) { + if (isEmptyValue(printFormatUuid)) { + printFormatUuid = getters.getDefaultPrintFormat(processUuid).printFormatUuid + } + + const parametersList = rootGetters.getParametersToServer({ containerUuid: processUuid }) + return new Promise(resolve => { + getReportOutput({ + parametersList, + printFormatUuid, + reportViewUuid, + isSummary, + reportName, + reportType, + tableName }) + .then(response => { + const reportOutput = { + ...response, + processId, + processUuid, + isError: false, + instanceUuid, + isReport: true, + option: option + } + commit('setNewReportOutput', reportOutput) + + resolve(reportOutput) + }) + .catch(error => { + console.warn(`Error getting report output: ${error.message}. Code: ${error.code}.`) + }) + }) } }, getters: { diff --git a/src/store/modules/ADempiere/window.js b/src/store/modules/ADempiere/window.js index 19717232..e8f368cc 100644 --- a/src/store/modules/ADempiere/window.js +++ b/src/store/modules/ADempiere/window.js @@ -189,9 +189,7 @@ const window = { // Add process menu dispatch('setContextMenu', { containerUuid: tab.uuid, - relations: [], - actions: actions, - references: [] + actions: actions }) if (tab.isParentTab) {