From 71c6b865b61e574e66de9152a0a8b0d0d3de279b Mon Sep 17 00:00:00 2001 From: guillermo Date: Fri, 1 Sep 2023 12:11:56 +0200 Subject: [PATCH] refs #5995 Improved external CMR --- src/i18n/en/index.js | 8 +++-- src/i18n/es/index.js | 6 ++-- src/pages/Route/Cmr/CmrFilter.vue | 41 ++++++++++++++++++---- src/pages/Route/Cmr/CmrList.vue | 57 ++++++++++++++++++++++--------- 4 files changed, 83 insertions(+), 29 deletions(-) diff --git a/src/i18n/en/index.js b/src/i18n/en/index.js index fc091862e..f37af64ff 100644 --- a/src/i18n/en/index.js +++ b/src/i18n/en/index.js @@ -32,10 +32,11 @@ export default { rowAdded: 'Row added', rowRemoved: 'Row removed', pleaseWait: 'Please wait...', - noPinnedModules: 'You have dont have any pinned modules', + noPinnedModules: `You don't have any pinned modules`, summary: { basicData: 'Basic data', }, + noSelectedRows: `You don't have any line selected`, }, errors: { statusUnauthorized: 'Access denied', @@ -481,17 +482,18 @@ export default { }, cmr: { list: { - total: 'Total records', + results: 'results', cmrFk: 'CMR id', hasCmrDms: `Attached in gestdoc`, true: 'Yes', false: 'No', ticketFk: 'Ticketd id', + routeFk: 'Route id', country: 'Country', clientFk: 'Client id', shipped: 'Preparation date', viewCmr: 'View CMR', - downloadCmr: 'Download CMR', + downloadCmrs: 'Download CMRs', }, }, }, diff --git a/src/i18n/es/index.js b/src/i18n/es/index.js index 6ed9d1b24..2d46bdd41 100644 --- a/src/i18n/es/index.js +++ b/src/i18n/es/index.js @@ -36,6 +36,7 @@ export default { summary: { basicData: 'Datos básicos', }, + noSelectedRows: `No tienes ninguna línea seleccionada`, }, errors: { statusUnauthorized: 'Acceso denegado', @@ -481,17 +482,18 @@ export default { }, cmr: { list: { - total: 'Total registros', + results: 'resultados', cmrFk: 'Id CMR', hasCmrDms: 'Adjuntado en gestdoc', true: 'Sí', false: 'No', ticketFk: 'Id ticket', + routeFk: 'Id ruta', country: 'País', clientFk: 'Id cliente', shipped: 'Fecha preparación', viewCmr: 'Ver CMR', - downloadCmr: 'Descargar CMR', + downloadCmrs: 'Descargar CMRs', }, }, }, diff --git a/src/pages/Route/Cmr/CmrFilter.vue b/src/pages/Route/Cmr/CmrFilter.vue index eeb111304..b8948652a 100644 --- a/src/pages/Route/Cmr/CmrFilter.vue +++ b/src/pages/Route/Cmr/CmrFilter.vue @@ -28,7 +28,11 @@ const countries = ref(); - + @@ -46,7 +50,11 @@ const countries = ref(); - + @@ -55,7 +63,24 @@ const countries = ref(); - + + + + + + + + @@ -78,9 +103,9 @@ const countries = ref(); emit-value map-options > - + @@ -99,7 +124,9 @@ const countries = ref(); transition-hide="rotate" > -
+
import { computed, ref } from 'vue'; import { useI18n } from 'vue-i18n'; +import { Notify } from 'quasar'; import { useStateStore } from 'stores/useStateStore'; import VnPaginate from 'components/ui/VnPaginate.vue'; import { useSession } from 'src/composables/useSession'; @@ -13,6 +14,7 @@ const stateStore = useStateStore(); const { t } = useI18n(); const session = useSession(); const token = session.getToken(); +const selected = ref([]); const columns = computed(() => [ { @@ -35,6 +37,12 @@ const columns = computed(() => [ field: (row) => row.ticketFk, sortable: true, }, + { + name: 'routeFkFk', + label: t('route.cmr.list.routeFk'), + field: (row) => row.routeFk, + sortable: true, + }, { name: 'clientFk', label: t('route.cmr.list.clientFk'), @@ -62,11 +70,24 @@ const columns = computed(() => [ field: (row) => row.cmrFk, }, ]); -function getProjectUrl() { +function getApiUrl() { return new URL(window.location).origin; } -function getCmrLink(cmrFk) { - return `${getProjectUrl()}/api/Routes/${cmrFk}/cmr?access_token=${token}`; +function getCmrUrl(value) { + return `${getApiUrl()}/api/Routes/${value}/cmr?access_token=${token}`; +} +function downloadPdfs() { + if (!selected.value.length) { + Notify.create({ + message: t('globals.noSelectedRows'), + type: 'warning', + }); + return; + } + let cmrs = []; + for (let value of selected.value) cmrs.push(value.cmrFk); + // prettier-ignore + return window.open(`${getApiUrl()}/api/Routes/downloadCmrsZip?ids=${cmrs.join(',')}&access_token=${token}`); }
+ + + + + {{ t('route.cmr.list.downloadCmrs') }} +
@@ -158,7 +181,7 @@ function getCmrLink(cmrFk) { .list { padding-top: 15px; padding-bottom: 15px; - max-width: 900px; + max-width: 1000px; width: 100%; } .grid-style-transition {