forked from verdnatura/salix-front
Add route list actions
This commit is contained in:
parent
a68f53d9f7
commit
ecea050b77
|
@ -129,6 +129,28 @@ const updateWorker = (row, worker) => {
|
||||||
row.workerUserName = worker.name;
|
row.workerUserName = worker.name;
|
||||||
updateRoute(row);
|
updateRoute(row);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const confirmationDialog = ref(false);
|
||||||
|
const startingDate = ref(null);
|
||||||
|
|
||||||
|
const cloneRoutes = () => {
|
||||||
|
axios.post('Routes/clone', {
|
||||||
|
created: startingDate.value,
|
||||||
|
ids: selectedRows.value.map((row) => row?.id),
|
||||||
|
});
|
||||||
|
refreshKey.value++;
|
||||||
|
startingDate.value = null;
|
||||||
|
};
|
||||||
|
|
||||||
|
const markAsServed = () => {
|
||||||
|
selectedRows.value.forEach((row) => {
|
||||||
|
if (row?.id) {
|
||||||
|
axios.patch(`Routes/${row?.id}`, { isOk: true });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
refreshKey.value++;
|
||||||
|
startingDate.value = null;
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -152,6 +174,28 @@ const updateWorker = (row, worker) => {
|
||||||
</div>
|
</div>
|
||||||
</Teleport>
|
</Teleport>
|
||||||
</template>
|
</template>
|
||||||
|
<QDialog v-model="confirmationDialog">
|
||||||
|
<QCard style="min-width: 350px">
|
||||||
|
<QCardSection>
|
||||||
|
<p class="text-h6 q-ma-none">{{ t('Select the starting date') }}</p>
|
||||||
|
</QCardSection>
|
||||||
|
|
||||||
|
<QCardSection class="q-pt-none">
|
||||||
|
<VnInputDate
|
||||||
|
:label="t('Stating date')"
|
||||||
|
v-model="startingDate"
|
||||||
|
autofocus
|
||||||
|
/>
|
||||||
|
</QCardSection>
|
||||||
|
|
||||||
|
<QCardActions align="right">
|
||||||
|
<QBtn flat :label="t('Cancel')" v-close-popup class="text-primary" />
|
||||||
|
<QBtn color="primary" v-close-popup @click="cloneRoutes">
|
||||||
|
{{ t('Clone') }}
|
||||||
|
</QBtn>
|
||||||
|
</QCardActions>
|
||||||
|
</QCard>
|
||||||
|
</QDialog>
|
||||||
<QDrawer v-model="stateStore.rightDrawer" side="right" :width="256" show-if-above>
|
<QDrawer v-model="stateStore.rightDrawer" side="right" :width="256" show-if-above>
|
||||||
<QScrollArea class="fit text-grey-8">
|
<QScrollArea class="fit text-grey-8">
|
||||||
<RouteFilter data-key="RouteList" />
|
<RouteFilter data-key="RouteList" />
|
||||||
|
@ -165,7 +209,26 @@ const updateWorker = (row, worker) => {
|
||||||
<FetchData url="AgencyModes" @on-fetch="(data) => (agencyList = data)" auto-load />
|
<FetchData url="AgencyModes" @on-fetch="(data) => (agencyList = data)" auto-load />
|
||||||
<FetchData url="Vehicles" @on-fetch="(data) => (vehicleList = data)" auto-load />
|
<FetchData url="Vehicles" @on-fetch="(data) => (vehicleList = data)" auto-load />
|
||||||
<QPage class="column items-center q-pa-md">
|
<QPage class="column items-center q-pa-md">
|
||||||
<QToolbar class="q-pa-none q-mb-sm justify-end">
|
<QToolbar
|
||||||
|
:class="[
|
||||||
|
'q-pa-none q-mb-sm',
|
||||||
|
selectedRows?.length ? 'justify-between' : 'justify-end',
|
||||||
|
]"
|
||||||
|
>
|
||||||
|
<div v-if="selectedRows?.length">
|
||||||
|
<QBtn
|
||||||
|
icon="vn:clone"
|
||||||
|
color="primary"
|
||||||
|
class="q-mr-sm"
|
||||||
|
@click="confirmationDialog = true"
|
||||||
|
>
|
||||||
|
<QTooltip>{{ t('Clone Selected Routes') }}</QTooltip>
|
||||||
|
</QBtn>
|
||||||
|
|
||||||
|
<QBtn icon="check" color="primary" class="q-mr-sm" @click="markAsServed">
|
||||||
|
<QTooltip>{{ t('Mark as served') }}</QTooltip>
|
||||||
|
</QBtn>
|
||||||
|
</div>
|
||||||
<QBtn icon="refresh" color="primary" class="q-mr-sm" @click="refreshKey++" />
|
<QBtn icon="refresh" color="primary" class="q-mr-sm" @click="refreshKey++" />
|
||||||
</QToolbar>
|
</QToolbar>
|
||||||
<VnPaginate
|
<VnPaginate
|
||||||
|
@ -183,8 +246,8 @@ const updateWorker = (row, worker) => {
|
||||||
:rows="rows"
|
:rows="rows"
|
||||||
flat
|
flat
|
||||||
row-key="id"
|
row-key="id"
|
||||||
hide-pagination
|
|
||||||
selection="multiple"
|
selection="multiple"
|
||||||
|
:rows-per-page-options="[0]"
|
||||||
>
|
>
|
||||||
<template #body-cell-worker="props">
|
<template #body-cell-worker="props">
|
||||||
<QTd :props="props">
|
<QTd :props="props">
|
||||||
|
@ -401,4 +464,10 @@ es:
|
||||||
Hour started: Hora inicio
|
Hour started: Hora inicio
|
||||||
Hour finished: Hora fin
|
Hour finished: Hora fin
|
||||||
newRoute: Nueva Ruta
|
newRoute: Nueva Ruta
|
||||||
|
Clone Selected Routes: Clonar rutas seleccionadas
|
||||||
|
Select the starting date: Seleccione la fecha de inicio
|
||||||
|
Stating date: Fecha de inicio
|
||||||
|
Cancel: Cancelar
|
||||||
|
Clone: Clonar
|
||||||
|
Mark as served: Marcar como servidas
|
||||||
</i18n>
|
</i18n>
|
||||||
|
|
Loading…
Reference in New Issue