From 6786ac97e41b36abf19a706b124b3f9dd4cfa09e Mon Sep 17 00:00:00 2001 From: guillermo Date: Wed, 30 Aug 2023 12:53:18 +0200 Subject: [PATCH 1/2] refs #5995 Improved external CMR --- src/i18n/en/index.js | 4 ++- src/i18n/es/index.js | 4 ++- src/pages/Route/Cmr/CmrList.vue | 58 +++++++++++++++++++++++++++------ 3 files changed, 54 insertions(+), 12 deletions(-) diff --git a/src/i18n/en/index.js b/src/i18n/en/index.js index 4cafee136..fc091862e 100644 --- a/src/i18n/en/index.js +++ b/src/i18n/en/index.js @@ -482,7 +482,7 @@ export default { cmr: { list: { total: 'Total records', - cmrFk: 'Cmr id', + cmrFk: 'CMR id', hasCmrDms: `Attached in gestdoc`, true: 'Yes', false: 'No', @@ -490,6 +490,8 @@ export default { country: 'Country', clientFk: 'Client id', shipped: 'Preparation date', + viewCmr: 'View CMR', + downloadCmr: 'Download CMR', }, }, }, diff --git a/src/i18n/es/index.js b/src/i18n/es/index.js index 13e3fd626..6ed9d1b24 100644 --- a/src/i18n/es/index.js +++ b/src/i18n/es/index.js @@ -482,7 +482,7 @@ export default { cmr: { list: { total: 'Total registros', - cmrFk: 'Id cmr', + cmrFk: 'Id CMR', hasCmrDms: 'Adjuntado en gestdoc', true: 'Sí', false: 'No', @@ -490,6 +490,8 @@ export default { country: 'País', clientFk: 'Id cliente', shipped: 'Fecha preparación', + viewCmr: 'Ver CMR', + downloadCmr: 'Descargar CMR', }, }, }, diff --git a/src/pages/Route/Cmr/CmrList.vue b/src/pages/Route/Cmr/CmrList.vue index 497d20914..fc966bc47 100644 --- a/src/pages/Route/Cmr/CmrList.vue +++ b/src/pages/Route/Cmr/CmrList.vue @@ -6,6 +6,8 @@ import VnPaginate from 'components/ui/VnPaginate.vue'; import { useSession } from 'src/composables/useSession'; import { toDate } from 'filters/index'; import CmrFilter from './CmrFilter.vue'; +import TicketDescriptorProxy from 'pages/Ticket/Card/TicketDescriptorProxy.vue'; +import CustomerDescriptorProxy from 'pages/Customer/Card/CustomerDescriptorProxy.vue'; const stateStore = useStateStore(); const { t } = useI18n(); @@ -54,10 +56,18 @@ const columns = computed(() => [ sortable: true, headerStyle: 'padding-left: 33px', }, + { + name: 'icons', + align: 'center', + field: (row) => row.cmrFk, + }, ]); function getProjectUrl() { return new URL(window.location).origin; } +function getCmrLink(cmrFk) { + return `${getProjectUrl()}/api/Routes/${cmrFk}/cmr?access_token=${token}`; +} From 71c6b865b61e574e66de9152a0a8b0d0d3de279b Mon Sep 17 00:00:00 2001 From: guillermo Date: Fri, 1 Sep 2023 12:11:56 +0200 Subject: [PATCH 2/2] 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 {