From eae2144e1de1053373cc2dff98c62e03cee0bd3f Mon Sep 17 00:00:00 2001 From: pablone Date: Fri, 26 Jul 2024 09:41:47 +0200 Subject: [PATCH 1/3] feat: refs #7401 add menu options --- src/pages/Route/Card/RouteDescriptorMenu.vue | 62 +++++++++++++++++--- src/pages/Route/Card/RouteForm.vue | 8 +-- src/pages/Route/Cmr/CmrList.vue | 2 +- 3 files changed, 60 insertions(+), 12 deletions(-) diff --git a/src/pages/Route/Card/RouteDescriptorMenu.vue b/src/pages/Route/Card/RouteDescriptorMenu.vue index b661d1cd7..7150eb027 100644 --- a/src/pages/Route/Card/RouteDescriptorMenu.vue +++ b/src/pages/Route/Card/RouteDescriptorMenu.vue @@ -3,6 +3,7 @@ import axios from 'axios'; import { useQuasar } from 'quasar'; import { useI18n } from 'vue-i18n'; import { useRouter } from 'vue-router'; +import { useSession } from 'src/composables/useSession'; import VnConfirm from 'components/ui/VnConfirm.vue'; const props = defineProps({ @@ -11,10 +12,20 @@ const props = defineProps({ required: true, }, }); - const router = useRouter(); const quasar = useQuasar(); const { t } = useI18n(); +const routeId = props.route.id; + +async function openRouteReport() { + const url = new URL(window.location).origin; + const { getTokenMultimedia } = useSession(); + const token = getTokenMultimedia(); + window.open( + `${url}/api/Routes/${routeId}/driver-route-pdf?access_token=${token}`, + '_blank' + ); +} function confirmRemove() { quasar @@ -29,20 +40,51 @@ function confirmRemove() { .onOk(async () => await router.push({ name: 'RouteList' })); } +async function sendMail() { + const params = { + id: routeId, + recipient: props?.route?.worker?.user?.emailUser?.email, + }; + console.log('params: ', params); + await axios.post(`Routes/${routeId}/driver-route-email`, params); +} + +async function actualizeVolume() { + const params = { isOk: true }; + await axios.post(`Routes/${routeId}/updateVolume`, params); + quasar.notify({ + message: t('globals.dataUpdated'), + type: 'positive', + }); +} + async function remove() { - if (!props.route.id) { - return; - } - await axios.delete(`Routes/${props.route.id}`); + await axios.delete(`Routes/${routeId}`); quasar.notify({ message: t('globals.dataDeleted'), type: 'positive', }); } - -// TODO: Add reports