diff --git a/src/pages/Route/RouteList.vue b/src/pages/Route/RouteList.vue index 591f723e9..392d7f8cb 100644 --- a/src/pages/Route/RouteList.vue +++ b/src/pages/Route/RouteList.vue @@ -15,11 +15,13 @@ import RouteSearchbar from 'pages/Route/Card/RouteSearchbar.vue'; import RouteFilter from 'pages/Route/Card/RouteFilter.vue'; import { useQuasar } from 'quasar'; import RouteSummaryDialog from 'pages/Route/Card/RouteSummaryDialog.vue'; +import {useSession} from "composables/useSession"; const stateStore = useStateStore(); const { t } = useI18n(); const { validate } = useValidator(); const quasar = useQuasar(); +const session = useSession(); const to = Date.vnNew(); to.setDate(to.getDate() + 1); @@ -149,6 +151,23 @@ const cloneRoutes = () => { startingDate.value = null; }; +const showRouteReport = () => { + const ids = selectedRows.value.map(row => row?.id) + const idString = ids.join(',') + let url; + + if (selectedRows.value.length <= 1) { + url = `api/Routes/${idString}/driver-route-pdf?access_token=${session.getToken()}`; + } else { + const params = new URLSearchParams({ + access_token: session.getToken(), + id: idString + }) + url = `api/Routes/downloadZip?${params.toString()}`; + } + window.open(url, '_blank'); +} + const markAsServed = () => { selectedRows.value.forEach((row) => { if (row?.id) { @@ -206,7 +225,6 @@ function previewRoute(id) { autofocus /> - @@ -239,7 +257,15 @@ function previewRoute(id) { > {{ t('Clone Selected Routes') }} - + + {{ t('Download selected routes as PDF') }} +