0
0
Fork 0

refs #6993 fix conflicts

This commit is contained in:
Jon Elias 2024-03-15 12:57:16 +01:00
parent 4c63e2f5c1
commit 6ff8b7be34
1 changed files with 152 additions and 117 deletions

View File

@ -2,8 +2,9 @@
import VnPaginate from 'components/ui/VnPaginate.vue'; import VnPaginate from 'components/ui/VnPaginate.vue';
import { useStateStore } from 'stores/useStateStore'; import { useStateStore } from 'stores/useStateStore';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useQuasar } from 'quasar';
import { computed, onMounted, onUnmounted, ref } from 'vue'; import { computed, onMounted, onUnmounted, ref } from 'vue';
import { dashIfEmpty, toHour } from 'src/filters'; import { dashIfEmpty, toDate, toHour } from 'src/filters';
import VnSelectFilter from 'components/common/VnSelectFilter.vue'; import VnSelectFilter from 'components/common/VnSelectFilter.vue';
import FetchData from 'components/FetchData.vue'; import FetchData from 'components/FetchData.vue';
import { useValidator } from 'composables/useValidator'; import { useValidator } from 'composables/useValidator';
@ -17,13 +18,10 @@ import RouteSummary from 'pages/Route/Card/RouteSummary.vue';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue'; import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
import { useSession } from 'composables/useSession'; import { useSession } from 'composables/useSession';
import { useSummaryDialog } from 'src/composables/useSummaryDialog'; import { useSummaryDialog } from 'src/composables/useSummaryDialog';
import RouteListTicketsDialog from 'pages/Route/Card/RouteListTicketsDialog.vue';
import { useQuasar } from 'quasar';
const stateStore = useStateStore(); const stateStore = useStateStore();
const { t } = useI18n(); const { t } = useI18n();
const { validate } = useValidator(); const { validate } = useValidator();
const quasar = useQuasar();
const session = useSession(); const session = useSession();
const { viewSummary } = useSummaryDialog(); const { viewSummary } = useSummaryDialog();
@ -37,7 +35,7 @@ const columns = computed(() => [
label: t('ID'), label: t('ID'),
field: (row) => row.id, field: (row) => row.id,
sortable: true, sortable: true,
align: 'center', align: 'left',
}, },
{ {
name: 'worker', name: 'worker',
@ -72,7 +70,7 @@ const columns = computed(() => [
label: 'm³', label: 'm³',
field: (row) => dashIfEmpty(row.m3), field: (row) => dashIfEmpty(row.m3),
sortable: true, sortable: true,
align: 'center', align: 'left',
}, },
{ {
name: 'description', name: 'description',
@ -115,6 +113,24 @@ const updateRoute = async (route) => {
} }
}; };
const updateVehicle = (row, vehicle) => {
row.vehicleFk = vehicle.id;
row.vehiclePlateNumber = vehicle.numberPlate;
updateRoute(row);
};
const updateAgency = (row, agency) => {
row.agencyModeFk = agency.id;
row.agencyName = agency.name;
updateRoute(row);
};
const updateWorker = (row, worker) => {
row.workerFk = worker.id;
row.workerUserName = worker.name;
updateRoute(row);
};
const confirmationDialog = ref(false); const confirmationDialog = ref(false);
const startingDate = ref(null); const startingDate = ref(null);
@ -133,7 +149,7 @@ const showRouteReport = () => {
let url; let url;
if (selectedRows.value.length <= 1) { if (selectedRows.value.length <= 1) {
url = `api/Routes/${idString}/driver-route-pdf?access_token=${session.getTokenMultimedia()}`; url = `api/Routes/${idString}/driver-route-pdf?access_token=${session.getToken()}`;
} else { } else {
const params = new URLSearchParams({ const params = new URLSearchParams({
access_token: session.getToken(), access_token: session.getToken(),
@ -153,20 +169,6 @@ const markAsServed = () => {
refreshKey.value++; refreshKey.value++;
startingDate.value = null; startingDate.value = null;
}; };
const openTicketsDialog = (id) => {
if (!id) {
return;
}
quasar
.dialog({
component: RouteListTicketsDialog,
componentProps: {
id,
},
})
.onOk(() => refreshKey.value++);
};
</script> </script>
<template> <template>
@ -317,101 +319,154 @@ const openTicketsDialog = (id) => {
</QPopupEdit> </QPopupEdit>
</QTd> </QTd>
</template> </template>
<template #body-cell-agency="{ row }"> <template #body-cell-agency="props">
<QTd> <QTd :props="props">
<VnSelectFilter {{ props.row?.agencyName }}
:label="t('Agency')" <QPopupEdit
v-model="row.agencyModeFk" :model-value="props.row.agencyModeFk"
:options="agencyList" v-slot="scope"
option-value="id" buttons
option-label="name" @update:model-value="
hide-selected (agency) => updateAgency(props.row, agency)
dense "
:emit-value="false" >
:rules="validate('route.agencyFk')" <VnSelectFilter
:is-clearable="false" :label="t('Agency')"
@update:model-value="updateRoute(row)" v-model="scope.value"
/> :options="agencyList"
option-value="id"
option-label="name"
hide-selected
autofocus
:emit-value="false"
:rules="validate('route.agencyFk')"
:is-clearable="false"
@keyup.enter="scope.set"
@focus="($event) => $event.target.select()"
/>
</QPopupEdit>
</QTd> </QTd>
</template> </template>
<template #body-cell-vehicle="{ row }"> <template #body-cell-vehicle="props">
<QTd> <QTd :props="props">
<VnSelectFilter {{ props.row?.vehiclePlateNumber }}
:label="t('Vehicle')" <QPopupEdit
v-model="row.vehicleFk" :model-value="props.row.vehicleFk"
:options="vehicleList" v-slot="scope"
option-value="id" buttons
option-label="numberPlate" @update:model-value="
hide-selected (vehicle) => updateVehicle(props.row, vehicle)
dense "
:emit-value="false" >
:rules="validate('route.vehicleFk')" <VnSelectFilter
:is-clearable="false" :label="t('Vehicle')"
@update:model-value="updateRoute(row)" v-model="scope.value"
/> :options="vehicleList"
option-value="id"
option-label="numberPlate"
hide-selected
autofocus
:emit-value="false"
:rules="validate('route.vehicleFk')"
:is-clearable="false"
@keyup.enter="scope.set"
@focus="($event) => $event.target.select()"
/>
</QPopupEdit>
</QTd> </QTd>
</template> </template>
<template #body-cell-date="{ row }"> <template #body-cell-date="props">
<QTd class="table-input-cell"> <QTd :props="props">
<VnInputDate {{ toDate(props.row?.created) }}
v-model="row.created" <QPopupEdit
hide-bottom-space v-model="props.row.created"
dense v-slot="scope"
:label="t('Date')" @update:model-value="updateRoute(props.row)"
:rules="validate('route.created')" buttons
:is-clearable="false" >
@update:model-value="updateRoute(row)" <VnInputDate
/> v-model="scope.value"
autofocus
:label="t('Date')"
:rules="validate('route.created')"
:is-clearable="false"
@keyup.enter="scope.set"
@focus="($event) => $event.target.select()"
/>
</QPopupEdit>
</QTd> </QTd>
</template> </template>
<template #body-cell-description="{ row }"> <template #body-cell-description="props">
<QTd class="table-input-cell"> <QTd :props="props">
<VnInput {{ props.row?.description }}
v-model="row.description" <QPopupEdit
:label="t('Description')" v-model="props.row.description"
:rules="validate('route.description')" v-slot="scope"
:is-clearable="false" @update:model-value="updateRoute(props.row)"
dense buttons
@update:model-value="updateRoute(row)" >
/> <VnInput
v-model="scope.value"
autofocus
:label="t('Description')"
:rules="validate('route.description')"
:is-clearable="false"
@keyup.enter="scope.set"
@focus="($event) => $event.target.select()"
/>
</QPopupEdit>
</QTd> </QTd>
</template> </template>
<template #body-cell-started="{ row }"> <template #body-cell-started="props">
<QTd class="table-input-cell"> <QTd :props="props">
<VnInputTime {{ toHour(props.row.started) }}
v-model="row.started" <QPopupEdit
:label="t('Hour started')" v-model="props.row.started"
:rules="validate('route.started')" v-slot="scope"
:is-clearable="false" buttons
hide-bottom-space @update:model-value="updateRoute(props.row)"
dense >
@update:model-value="updateRoute(row)" <VnInputTime
/> v-model="scope.value"
autofocus
:label="t('Hour started')"
:rules="validate('route.started')"
:is-clearable="false"
@keyup.enter="scope.set"
@focus="($event) => $event.target.select()"
/>
</QPopupEdit>
</QTd> </QTd>
</template> </template>
<template #body-cell-finished="{ row }"> <template #body-cell-finished="props">
<QTd class="table-input-cell"> <QTd :props="props">
<VnInputTime {{ toHour(props.row.finished) }}
v-model="row.finished" <QPopupEdit
autofocus v-model="props.row.finished"
:label="t('Hour finished')" v-slot="scope"
:rules="validate('route.finished')" buttons
:is-clearable="false" @update:model-value="updateRoute(props.row)"
hide-bottom-space >
dense <VnInputTime
@update:model-value="updateRoute(row)" v-model="scope.value"
/> autofocus
:label="t('Hour finished')"
:rules="validate('route.finished')"
:is-clearable="false"
@keyup.enter="scope.set"
@focus="($event) => $event.target.select()"
/>
</QPopupEdit>
</QTd> </QTd>
</template> </template>
<template #body-cell-actions="props"> <template #body-cell-actions="props">
<QTd :props="props"> <QTd :props="props">
<div class="flex items-center no-wrap table-actions"> <div class="flex items-center table-actions">
<QIcon <QIcon
name="vn:ticketAdd" name="vn:ticketAdd"
size="xs" size="xs"
color="primary" color="primary"
class="cursor-pointer" class="cursor-pointer"
@click="openTicketsDialog(props?.row?.id)"
> >
<QTooltip>{{ t('Add ticket') }}</QTooltip> <QTooltip>{{ t('Add ticket') }}</QTooltip>
</QIcon> </QIcon>
@ -426,20 +481,6 @@ const openTicketsDialog = (id) => {
> >
<QTooltip>{{ t('Preview') }}</QTooltip> <QTooltip>{{ t('Preview') }}</QTooltip>
</QIcon> </QIcon>
<RouterLink
:to="{
name: 'RouteSummary',
params: { id: props?.row?.id },
}"
>
<QIcon
name="vn:eye"
size="xs"
color="primary"
>
<QTooltip>{{ t('Summary') }}</QTooltip>
</QIcon>
</RouterLink>
</div> </div>
</QTd> </QTd>
</template> </template>
@ -460,13 +501,8 @@ const openTicketsDialog = (id) => {
</template> </template>
<style lang="scss" scoped> <style lang="scss" scoped>
.table-input-cell {
min-width: 150px;
}
.route-list { .route-list {
width: 100%; width: 100%;
max-height: 100%;
} }
.table-actions { .table-actions {
@ -495,5 +531,4 @@ es:
Download selected routes as PDF: Descargar rutas seleccionadas como PDF Download selected routes as PDF: Descargar rutas seleccionadas como PDF
Add ticket: Añadir tickets Add ticket: Añadir tickets
Preview: Vista previa Preview: Vista previa
Summary: Resumen
</i18n> </i18n>