Implement routes report
This commit is contained in:
parent
c146f77563
commit
d0d57f71e0
|
@ -15,11 +15,13 @@ import RouteSearchbar from 'pages/Route/Card/RouteSearchbar.vue';
|
||||||
import RouteFilter from 'pages/Route/Card/RouteFilter.vue';
|
import RouteFilter from 'pages/Route/Card/RouteFilter.vue';
|
||||||
import { useQuasar } from 'quasar';
|
import { useQuasar } from 'quasar';
|
||||||
import RouteSummaryDialog from 'pages/Route/Card/RouteSummaryDialog.vue';
|
import RouteSummaryDialog from 'pages/Route/Card/RouteSummaryDialog.vue';
|
||||||
|
import {useSession} from "composables/useSession";
|
||||||
|
|
||||||
const stateStore = useStateStore();
|
const stateStore = useStateStore();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const { validate } = useValidator();
|
const { validate } = useValidator();
|
||||||
const quasar = useQuasar();
|
const quasar = useQuasar();
|
||||||
|
const session = useSession();
|
||||||
|
|
||||||
const to = Date.vnNew();
|
const to = Date.vnNew();
|
||||||
to.setDate(to.getDate() + 1);
|
to.setDate(to.getDate() + 1);
|
||||||
|
@ -149,6 +151,23 @@ const cloneRoutes = () => {
|
||||||
startingDate.value = null;
|
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 = () => {
|
const markAsServed = () => {
|
||||||
selectedRows.value.forEach((row) => {
|
selectedRows.value.forEach((row) => {
|
||||||
if (row?.id) {
|
if (row?.id) {
|
||||||
|
@ -206,7 +225,6 @@ function previewRoute(id) {
|
||||||
autofocus
|
autofocus
|
||||||
/>
|
/>
|
||||||
</QCardSection>
|
</QCardSection>
|
||||||
<!-- TODO: Add report -->
|
|
||||||
<QCardActions align="right">
|
<QCardActions align="right">
|
||||||
<QBtn flat :label="t('Cancel')" v-close-popup class="text-primary" />
|
<QBtn flat :label="t('Cancel')" v-close-popup class="text-primary" />
|
||||||
<QBtn color="primary" v-close-popup @click="cloneRoutes">
|
<QBtn color="primary" v-close-popup @click="cloneRoutes">
|
||||||
|
@ -239,7 +257,15 @@ function previewRoute(id) {
|
||||||
>
|
>
|
||||||
<QTooltip>{{ t('Clone Selected Routes') }}</QTooltip>
|
<QTooltip>{{ t('Clone Selected Routes') }}</QTooltip>
|
||||||
</QBtn>
|
</QBtn>
|
||||||
|
<QBtn
|
||||||
|
icon="cloud_download"
|
||||||
|
color="primary"
|
||||||
|
class="q-mr-sm"
|
||||||
|
:disable="!selectedRows?.length"
|
||||||
|
@click="showRouteReport"
|
||||||
|
>
|
||||||
|
<QTooltip>{{ t('Download selected routes as PDF') }}</QTooltip>
|
||||||
|
</QBtn>
|
||||||
<QBtn
|
<QBtn
|
||||||
icon="check"
|
icon="check"
|
||||||
color="primary"
|
color="primary"
|
||||||
|
@ -527,4 +553,5 @@ es:
|
||||||
Cancel: Cancelar
|
Cancel: Cancelar
|
||||||
Clone: Clonar
|
Clone: Clonar
|
||||||
Mark as served: Marcar como servidas
|
Mark as served: Marcar como servidas
|
||||||
|
Download selected routes as PDF: Descargar rutas seleccionadas como PDF
|
||||||
</i18n>
|
</i18n>
|
||||||
|
|
Loading…
Reference in New Issue