diff --git a/src/api/ADempiere/reportManagement/index.ts b/src/api/ADempiere/reportManagement/index.ts index 09a5aada4a..69f9c1d7b9 100644 --- a/src/api/ADempiere/reportManagement/index.ts +++ b/src/api/ADempiere/reportManagement/index.ts @@ -180,3 +180,39 @@ export function runExport({ method: 'post' }) } + +export function ListNotificationsTypes() { + return request({ + url: '/send_notifications/notifications_types', + method: 'get' + }) +} + +export function ListUsers() { + return request({ + url: '/send_notifications/user', + method: 'get' + }) +} + +export function SendNotification({ + user_id, + title, + recipients, + subject, + notification_type, + attachments +}) { + return request({ + url: '/send_notifications/notification', + method: 'post', + params: { + user_id, + title, + recipients, + subject, + notification_type, + attachments + } + }) +} diff --git a/src/lang/ADempiere/en/report.js b/src/lang/ADempiere/en/report.js index 5e74806992..1fbe8ca084 100644 --- a/src/lang/ADempiere/en/report.js +++ b/src/lang/ADempiere/en/report.js @@ -105,7 +105,10 @@ const report = { viewReport: 'Report View', Detail: 'View Detailed', summary: 'View Summary', - exportFormat: 'Export Format' + exportFormat: 'Export Format', + download: 'Generated Download Link', + sharedReport: 'Shared Report', + mesajeDownload: 'Click on the Following lLnk to go to Download ' } } diff --git a/src/lang/ADempiere/es/report.js b/src/lang/ADempiere/es/report.js index d37d68f5f2..2b0e0c5931 100644 --- a/src/lang/ADempiere/es/report.js +++ b/src/lang/ADempiere/es/report.js @@ -105,7 +105,10 @@ const report = { viewReport: 'Vista del Informe', Detail: 'Ver Detallado', summary: 'Ver Resumido', - exportFormat: 'Formato de Exportación' + exportFormat: 'Formato de Exportación', + download: 'Link de Descarga Generado', + sharedReport: 'Reporte Compartido', + mesajeDownload: 'Haga clic en el Siguiente Enlace para ir a la Descarga ' } } diff --git a/src/store/modules/ADempiere/reportManager.js b/src/store/modules/ADempiere/reportManager.js index 5ff36636cc..07ab93f6e4 100644 --- a/src/store/modules/ADempiere/reportManager.js +++ b/src/store/modules/ADempiere/reportManager.js @@ -27,7 +27,10 @@ import { runExport, generateReport, generateReportRequest, - getReportOutputRequest + getReportOutputRequest, + ListNotificationsTypes, + ListUsers, + SendNotification } from '@/api/ADempiere/reportManagement/index.ts' import { listPrintFormatsRequest } from '@/api/ADempiere/reportManagement/printFormat.ts' import { listReportViewsRequest } from '@/api/ADempiere/reportManagement/reportView.ts' @@ -63,12 +66,24 @@ const initState = { pageSize: 15, isLoading: false, showDialog: false, - expandedAll: true + expandedAll: true, + exportReport: {}, + contactSend: '', + typeNotify: '' } const reportManager = { state: initState, mutations: { + setContactSend(state, contactSend) { + state.contactSend = contactSend + }, + setTypeNotify(state, typeNotify) { + state.typeNotify = typeNotify + }, + setExportReport(state, exportReport) { + state.exportReport = exportReport + }, setShowDialog(state, showDialog) { state.showDialog = showDialog }, @@ -676,7 +691,7 @@ const reportManager = { * @returns {files} */ exportReport({ - getters + commit }, { reportId, reportName @@ -689,8 +704,69 @@ const reportManager = { const { file_name } = response const file = document.createElement('a') file.href = `${config.adempiere.resource.url}${file_name}` - file.download = `${reportName}` // name of the file to be downloaded - file.click() + file.download = `${reportName}` + commit('setExportReport', response) + resolve(response) + }) + .catch(error => { + showNotification({ + title: language.t('notifications.error'), + message: error.message, + type: 'error' + }) + console.warn(`Error exporting report: ${error.message}. Code: ${error.code}.`) + }) + }) + }, + ListNotifications() { + return new Promise(resolve => { + ListNotificationsTypes() + .then(response => { + resolve(response) + }) + .catch(error => { + showNotification({ + title: language.t('notifications.error'), + message: error.message, + type: 'error' + }) + console.warn(`Error exporting report: ${error.message}. Code: ${error.code}.`) + }) + }) + }, + ListUser() { + return new Promise(resolve => { + ListUsers() + .then(response => { + resolve(response) + }) + .catch(error => { + showNotification({ + title: language.t('notifications.error'), + message: error.message, + type: 'error' + }) + console.warn(`Error exporting report: ${error.message}. Code: ${error.code}.`) + }) + }) + }, + getSendNotification({ commit }, { + user_id, + title, + recipients, + notification_type, + attachments + }) { + return new Promise(resolve => { + SendNotification({ + user_id, + title, + recipients, + notification_type, + attachments + }) + .then(response => { + commit('setSendNotification', response) resolve(response) }) .catch(error => { @@ -706,6 +782,15 @@ const reportManager = { }, getters: { + getContactSend: (state) => { + return state.contactSend + }, + getTypeNotify: (state) => { + return state.typeNotify + }, + getExportReport: (state) => { + return state.exportReport + }, getExpandedAll: (state) => { return state.expandedAll }, diff --git a/src/utils/ADempiere/notification.js b/src/utils/ADempiere/notification.js index 9489aa58b5..6c58ccd212 100644 --- a/src/utils/ADempiere/notification.js +++ b/src/utils/ADempiere/notification.js @@ -81,22 +81,22 @@ export function showNotification({ type = 'success', title, message = '', summar }) } export function showNotificationReport({ type = 'success', title, message, link }) { + title = hasTranslation(title) + if (message) { + message = hasTranslation(message) + } return Notification({ title, message: `
`, type, position: 'bottom-right', - dangerouslyUseHTMLString: true, - onClick() { - router.push({ - name: title, - path: link - }, () => {}) - } + dangerouslyUseHTMLString: true }) } /** diff --git a/src/views/ADempiere/ReportViewerEngine/dialog/contactSend.vue b/src/views/ADempiere/ReportViewerEngine/dialog/contactSend.vue new file mode 100644 index 0000000000..5329d14e70 --- /dev/null +++ b/src/views/ADempiere/ReportViewerEngine/dialog/contactSend.vue @@ -0,0 +1,56 @@ + ++ {{ $t('component.attachment.share.description') }} +
++ + {{ $t('component.attachment.share.timeText') }} + +
+- {{ $t('component.attachment.share.description') }} -
-- - {{ $t('component.attachment.share.timeText') }} - -
-