diff --git a/src/api/ADempiere/data.js b/src/api/ADempiere/data.js index 6f695eb3..8bd6cead 100644 --- a/src/api/ADempiere/data.js +++ b/src/api/ADempiere/data.js @@ -319,6 +319,10 @@ export function getContextInfoValueFromServer({ uuid, query }) { return Instance.call(this).getContextInfoValue({ uuid: uuid, query: query }) } +export function requestReportViews({ tableName, processUuid }) { + return Instance.call(this).requestReportViews({ tableName: tableName, processUuid: processUuid }) +} + export function requestPrintFormats({ tableName, reportViewUuid, processUuid }) { return Instance.call(this).requestPrintFormats({ tableName: tableName, reportViewUuid: reportViewUuid, processUuid: processUuid }) } diff --git a/src/lang/ADempiere/en.js b/src/lang/ADempiere/en.js index 21ceee36..76d8fa91 100644 --- a/src/lang/ADempiere/en.js +++ b/src/lang/ADempiere/en.js @@ -155,8 +155,8 @@ export default { unsupportedHeadline: 'This view is currently unavailable', unsupportedInfo: 'Please check that the view is supported in this version, or click the button below to return to the homepage.', unsupportedButton: 'Back to dashboard', - printFormat: 'Print Format', - changePrintFormat: 'Change Print Format' + reportView: 'Report Views', + printFormat: 'Print Formats' }, table: { ProcessActivity: { diff --git a/src/lang/ADempiere/es.js b/src/lang/ADempiere/es.js index 0e908321..e7485e44 100644 --- a/src/lang/ADempiere/es.js +++ b/src/lang/ADempiere/es.js @@ -155,8 +155,8 @@ export default { unsupportedHeadline: 'Esta vista no está disponible actualmente', unsupportedInfo: 'Verifique que la vista sea compatible con esta versión, o haga clic en el botón a continuación para volver a la página de inicio.', unsupportedButton: 'Volver al Panel de control', - printFormat: 'Formato de Impresión', - changePrintFormat: 'Cambiar Formato de Impresión' + reportView: 'Vistas de Reporte', + printFormat: 'Formatos de Impresión' }, table: { ProcessActivity: { diff --git a/src/store/modules/ADempiere/processControl.js b/src/store/modules/ADempiere/processControl.js index 84742f5e..f6b07033 100644 --- a/src/store/modules/ADempiere/processControl.js +++ b/src/store/modules/ADempiere/processControl.js @@ -1,4 +1,4 @@ -import { runProcess, requestProcessActivity } from '@/api/ADempiere' +import { runProcess, requestProcessActivity, requestReportViews } from '@/api/ADempiere' import { showNotification } from '@/utils/ADempiere/notification' import { isEmptyValue, convertMapToArrayPairs } from '@/utils/ADempiere' import language from '@/lang' @@ -14,7 +14,8 @@ const processControl = { process: [], // process to run finish sessionProcess: [], notificationProcess: [], - inRequestMetadata: [] + inRequestMetadata: [], + reportViewList: [] }, mutations: { // Add process in execution @@ -73,6 +74,9 @@ const processControl = { state.sessionProcess = [] state.notificationProcess = [] state.inRequestMetadata = [] + }, + setReportViewsList(state, payload) { + state.reportViewList.push(payload) } }, actions: { @@ -239,6 +243,28 @@ const processControl = { if (reportType !== 'pdf' && reportType !== 'html') { link.click() } + + // Report views List to context menu + var reportViewList = { + name: language.t('views.reportView'), + type: 'summary', + action: '', + childs: [], + option: 'reportView' + } + reportViewList.childs = getters.getReportViewList(processResult.processUuid) + if (!reportViewList.childs.length) { + dispatch('requestReportViews', { + processUuid: processResult.processUuid + }) + .then(response => { + reportViewList.childs = response + // Get contextMenu metadata and concat print report views with contextMenu actions + var contextMenuMetadata = rootGetters.getContextMenu(processResult.processUuid) + contextMenuMetadata.actions.push(reportViewList) + }) + } + // Print formats to context menu var printFormatList = { name: language.t('views.printFormat'), @@ -443,6 +469,27 @@ const processControl = { }, clearProcessControl({ commit }) { commit('clearProcessControl') + }, + requestReportViews({ commit }, parameters) { + return requestReportViews({ processUuid: parameters.processUuid }) + .then(response => { + const reportViewList = response.getReportviewsList().map(reportView => { + return { + uuid: reportView.getUuid(), + name: reportView.getName(), + tableName: reportView.getTablename(), + description: reportView.getDescription() + } + }) + commit('setReportViewsList', { + containerUuid: parameters.processUuid, + viewList: reportViewList + }) + return reportViewList + }) + .catch(error => { + console.error(error) + }) } }, getters: { @@ -487,6 +534,13 @@ const processControl = { return state.reportList.find( item => item.instanceUuid === instanceUuid ) + }, + getReportViewList: (state) => (containerUuid) => { + var reportViewList = state.reportViewList.find(list => list.containerUuid === containerUuid) + if (reportViewList) { + return reportViewList.viewList + } + return [] } } } diff --git a/src/views/ADempiere/ReportViewer/index.vue b/src/views/ADempiere/ReportViewer/index.vue index 45697caa..dfc457d1 100644 --- a/src/views/ADempiere/ReportViewer/index.vue +++ b/src/views/ADempiere/ReportViewer/index.vue @@ -86,9 +86,7 @@ export default { reportContent: '', reportHeader: '', isLoading: false, - reportResult: {}, - printFormatList: [], - printFormat: null + reportResult: {} } }, computed: {