0
0
Fork 0

Merge branch 'dev' into 6896-EndOrderMigration

This commit is contained in:
Jon Elias 2024-06-20 10:12:24 +00:00
commit 304c7677bc
11 changed files with 122 additions and 86 deletions

View File

@ -992,6 +992,18 @@ route:
shipped: Preparation date shipped: Preparation date
viewCmr: View CMR viewCmr: View CMR
downloadCmrs: Download CMRs downloadCmrs: Download CMRs
columnLabels:
Id: Id
vehicle: Vehicle
description: Description
isServed: Served
worker: Worker
date: Date
started: Started
actions: Actions
agency: Agency
volume: Volume
finished: Finished
supplier: supplier:
pageTitles: pageTitles:
suppliers: Suppliers suppliers: Suppliers

View File

@ -107,6 +107,7 @@ globals:
aliasUsers: Usuarios aliasUsers: Usuarios
subRoles: Subroles subRoles: Subroles
inheritedRoles: Roles heredados inheritedRoles: Roles heredados
workers: Trabajadores
created: Fecha creación created: Fecha creación
worker: Trabajador worker: Trabajador
now: Ahora now: Ahora
@ -977,6 +978,18 @@ route:
shipped: Fecha preparación shipped: Fecha preparación
viewCmr: Ver CMR viewCmr: Ver CMR
downloadCmrs: Descargar CMRs downloadCmrs: Descargar CMRs
columnLabels:
Id: Id
vehicle: Vehículo
description: Descripción
isServed: Servida
worker: Trabajador
date: Fecha
started: Iniciada
actions: Acciones
agency: Agencia
volume: Volumen
finished: Finalizada
supplier: supplier:
pageTitles: pageTitles:
suppliers: Proveedores suppliers: Proveedores

View File

@ -33,7 +33,6 @@ function exprBuilder(param, value) {
url="Agencies" url="Agencies"
order="name" order="name"
:expr-builder="exprBuilder" :expr-builder="exprBuilder"
auto-load
> >
<template #body="{ rows }"> <template #body="{ rows }">
<CardList <CardList

View File

@ -240,4 +240,5 @@ es:
From: Desde From: Desde
To: Hasta To: Hasta
Served: Servida Served: Servida
Days Onward: Días en adelante
</i18n> </i18n>

View File

@ -3,14 +3,15 @@ import { computed, onMounted, onUnmounted, ref } from 'vue';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useStateStore } from 'stores/useStateStore'; import { useStateStore } from 'stores/useStateStore';
import CardSummary from 'components/ui/CardSummary.vue';
import VnLv from 'components/ui/VnLv.vue';
import { QIcon } from 'quasar'; import { QIcon } from 'quasar';
import { dashIfEmpty, toCurrency, toDate, toHour } from 'src/filters'; import { dashIfEmpty, toCurrency, toDate, toHour } from 'src/filters';
import { openBuscaman } from 'src/utils/buscaman';
import CardSummary from 'components/ui/CardSummary.vue';
import WorkerDescriptorProxy from 'pages/Worker/Card/WorkerDescriptorProxy.vue'; import WorkerDescriptorProxy from 'pages/Worker/Card/WorkerDescriptorProxy.vue';
import CustomerDescriptorProxy from 'pages/Customer/Card/CustomerDescriptorProxy.vue'; import CustomerDescriptorProxy from 'pages/Customer/Card/CustomerDescriptorProxy.vue';
import TicketDescriptorProxy from 'pages/Ticket/Card/TicketDescriptorProxy.vue'; import TicketDescriptorProxy from 'pages/Ticket/Card/TicketDescriptorProxy.vue';
import { openBuscaman } from 'src/utils/buscaman'; import VnLv from 'components/ui/VnLv.vue';
import VnTitle from 'src/components/common/VnTitle.vue';
const $props = defineProps({ const $props = defineProps({
id: { id: {
@ -127,8 +128,14 @@ const ticketColumns = ref([
<span>{{ `${entity?.route.id} - ${entity?.route?.description}` }}</span> <span>{{ `${entity?.route.id} - ${entity?.route?.description}` }}</span>
</template> </template>
<template #body="{ entity }"> <template #body="{ entity }">
<QCard class="vn-max">
<VnTitle
:url="`#/route/${entityId}/basic-data`"
:text="t('globals.pageTitles.basicData')"
/>
</QCard>
<QCard class="vn-one"> <QCard class="vn-one">
<VnLv :label="t('ID')" :value="entity?.route.id" />
<VnLv <VnLv
:label="t('route.summary.date')" :label="t('route.summary.date')"
:value="toDate(entity?.route.created)" :value="toDate(entity?.route.created)"
@ -153,24 +160,6 @@ const ticketColumns = ref([
:label="t('route.summary.cost')" :label="t('route.summary.cost')"
:value="toCurrency(entity.route?.cost)" :value="toCurrency(entity.route?.cost)"
/> />
</QCard>
<QCard class="vn-one">
<VnLv
:label="t('route.summary.started')"
:value="toHour(entity?.route.started)"
/>
<VnLv
:label="t('route.summary.finished')"
:value="toHour(entity?.route.finished)"
/>
<VnLv
:label="t('route.summary.kmStart')"
:value="dashIfEmpty(entity?.route?.kmStart)"
/>
<VnLv
:label="t('route.summary.kmEnd')"
:value="dashIfEmpty(entity?.route?.kmEnd)"
/>
<VnLv <VnLv
:label="t('route.summary.volume')" :label="t('route.summary.volume')"
:value="`${dashIfEmpty(entity?.route?.m3)} / ${dashIfEmpty( :value="`${dashIfEmpty(entity?.route?.m3)} / ${dashIfEmpty(
@ -192,19 +181,32 @@ const ticketColumns = ref([
/> />
</QCard> </QCard>
<QCard class="vn-one"> <QCard class="vn-one">
<div class="header"> <VnLv
{{ t('globals.description') }} :label="t('route.summary.started')"
</div> :value="toHour(entity?.route.started)"
<p> />
{{ dashIfEmpty(entity?.route?.description) }} <VnLv
</p> :label="t('route.summary.finished')"
:value="toHour(entity?.route.finished)"
/>
<VnLv
:label="t('route.summary.kmStart')"
:value="dashIfEmpty(entity?.route?.kmStart)"
/>
<VnLv
:label="t('route.summary.kmEnd')"
:value="dashIfEmpty(entity?.route?.kmEnd)"
/>
<VnLv
:label="t('globals.description')"
:value="dashIfEmpty(entity?.route?.description)"
/>
</QCard> </QCard>
<QCard class="vn-max"> <QCard class="vn-max">
<a class="header" :href="`#/route/${entityId}/tickets`"> <VnTitle
{{ t('route.summary.tickets') }} :url="`#/route/${entityId}/tickets`"
<QIcon name="open_in_new" color="primary" /> :text="t('route.summary.tickets')"
</a> />
<QTable <QTable
:columns="ticketColumns" :columns="ticketColumns"
:rows="entity?.tickets" :rows="entity?.tickets"

View File

@ -109,13 +109,7 @@ function downloadPdfs() {
</RightMenu> </RightMenu>
<div class="column items-center"> <div class="column items-center">
<div class="list"> <div class="list">
<VnPaginate <VnPaginate data-key="CmrList" :url="`Routes/cmrs`" order="cmrFk DESC">
data-key="CmrList"
:url="`Routes/cmrs`"
order="cmrFk DESC"
limit="null"
auto-load
>
<template #body="{ rows }"> <template #body="{ rows }">
<QTable <QTable
:columns="columns" :columns="columns"

View File

@ -67,6 +67,7 @@ const filter = {
}, },
}, },
], ],
where: { id: entityId },
}; };
const openAddStopDialog = () => { const openAddStopDialog = () => {
@ -84,7 +85,7 @@ const openAddStopDialog = () => {
<CardSummary <CardSummary
data-key="RoadmapSummary" data-key="RoadmapSummary"
ref="summary" ref="summary"
:url="`Roadmaps/${entityId}`" :url="`Roadmaps`"
:filter="filter" :filter="filter"
> >
<template #header-left> <template #header-left>

View File

@ -39,7 +39,7 @@ const selectedRows = ref([]);
const columns = computed(() => [ const columns = computed(() => [
{ {
name: 'ID', name: 'ID',
label: t('ID'), label: 'Id',
field: (row) => row.routeFk, field: (row) => row.routeFk,
sortable: true, sortable: true,
align: 'left', align: 'left',
@ -117,7 +117,9 @@ const columns = computed(() => [
const refreshKey = ref(0); const refreshKey = ref(0);
const total = computed(() => selectedRows.value.reduce((item) => item?.price || 0, 0)); const total = computed(() => {
return selectedRows.value.reduce((sum, item) => sum + item.price, 0);
});
const openDmsUploadDialog = async () => { const openDmsUploadDialog = async () => {
dmsDialog.value.rowsToCreateInvoiceIn = selectedRows.value dmsDialog.value.rowsToCreateInvoiceIn = selectedRows.value
@ -212,7 +214,6 @@ function navigateToRouteSummary(event, row) {
data-key="RouteAutonomousList" data-key="RouteAutonomousList"
url="AgencyTerms/filter" url="AgencyTerms/filter"
:limit="20" :limit="20"
auto-load
> >
<template #body="{ rows }"> <template #body="{ rows }">
<div class="q-pa-md"> <div class="q-pa-md">
@ -306,6 +307,13 @@ function navigateToRouteSummary(event, row) {
cursor: pointer; cursor: pointer;
} }
} }
th:last-child,
td:last-child {
background-color: var(--vn-section-color);
position: sticky;
right: 0;
}
</style> </style>
<i18n> <i18n>
es: es:

View File

@ -1,40 +1,51 @@
<script setup> <script setup>
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 { computed, onMounted, onUnmounted, ref } from 'vue'; import { computed, onMounted, ref } from 'vue';
import { dashIfEmpty, toHour } from 'src/filters'; import { dashIfEmpty, toHour } from 'src/filters';
import VnSelect from 'components/common/VnSelect.vue';
import FetchData from 'components/FetchData.vue';
import { useValidator } from 'composables/useValidator'; import { useValidator } from 'composables/useValidator';
import { useSession } from 'composables/useSession';
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
import { useArrayData } from 'composables/useArrayData';
import { useQuasar } from 'quasar';
import axios from 'axios';
import RouteSearchbar from 'pages/Route/Card/RouteSearchbar.vue';
import FetchData from 'components/FetchData.vue';
import TableVisibleColumns from 'src/components/common/TableVisibleColumns.vue';
import RouteSummary from 'pages/Route/Card/RouteSummary.vue';
import RouteFilter from 'pages/Route/Card/RouteFilter.vue';
import RouteListTicketsDialog from 'pages/Route/Card/RouteListTicketsDialog.vue';
import RightMenu from 'src/components/common/RightMenu.vue';
import VnPaginate from 'components/ui/VnPaginate.vue';
import VnSelect from 'components/common/VnSelect.vue';
import VnInputDate from 'components/common/VnInputDate.vue'; import VnInputDate from 'components/common/VnInputDate.vue';
import VnInput from 'components/common/VnInput.vue'; import VnInput from 'components/common/VnInput.vue';
import VnInputTime from 'components/common/VnInputTime.vue'; import VnInputTime from 'components/common/VnInputTime.vue';
import axios from 'axios'; import VnLv from 'src/components/ui/VnLv.vue';
import RouteSearchbar from 'pages/Route/Card/RouteSearchbar.vue';
import TableVisibleColumns from 'src/components/common/TableVisibleColumns.vue';
import RouteFilter from 'pages/Route/Card/RouteFilter.vue';
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 { useSummaryDialog } from 'src/composables/useSummaryDialog';
import RouteListTicketsDialog from 'pages/Route/Card/RouteListTicketsDialog.vue';
import { useQuasar } from 'quasar';
import { useArrayData } from 'composables/useArrayData';
import RightMenu from 'src/components/common/RightMenu.vue';
const stateStore = useStateStore();
const { t } = useI18n(); const { t } = useI18n();
const { validate } = useValidator(); const { validate } = useValidator();
const { viewSummary } = useSummaryDialog();
const quasar = useQuasar(); const quasar = useQuasar();
const session = useSession(); const session = useSession();
const { viewSummary } = useSummaryDialog(); const paginate = ref();
const visibleColumns = ref([]); const visibleColumns = ref([]);
const selectedRows = ref([]); const selectedRows = ref([]);
const workers = ref([]);
const agencyList = ref([]);
const vehicleList = ref([]);
const allColumnNames = ref([]);
const confirmationDialog = ref(false);
const startingDate = ref(null);
const refreshKey = ref(0);
const columns = computed(() => [ const columns = computed(() => [
{ {
name: 'ID', name: 'Id',
label: t('ID'), label: t('Id'),
field: (row) => row.id, field: (row) => row.id,
sortable: true, sortable: true,
align: 'center', align: 'center',
@ -109,14 +120,12 @@ const columns = computed(() => [
align: 'right', align: 'right',
}, },
]); ]);
const arrayData = useArrayData('EntryLatestBuys', { const arrayData = useArrayData('EntryLatestBuys', {
url: 'Buys/latestBuysFilter', url: 'Buys/latestBuysFilter',
order: ['itemFk DESC'], order: ['itemFk DESC'],
}); });
const refreshKey = ref(0);
const workers = ref([]);
const agencyList = ref([]);
const vehicleList = ref([]);
const updateRoute = async (route) => { const updateRoute = async (route) => {
try { try {
return await axios.patch(`Routes/${route.id}`, route); return await axios.patch(`Routes/${route.id}`, route);
@ -124,9 +133,6 @@ const updateRoute = async (route) => {
return err; return err;
} }
}; };
const allColumnNames = ref([]);
const confirmationDialog = ref(false);
const startingDate = ref(null);
const cloneRoutes = () => { const cloneRoutes = () => {
axios.post('Routes/clone', { axios.post('Routes/clone', {
@ -135,6 +141,7 @@ const cloneRoutes = () => {
}); });
refreshKey.value++; refreshKey.value++;
startingDate.value = null; startingDate.value = null;
paginate.value.fetch();
}; };
const showRouteReport = () => { const showRouteReport = () => {
@ -154,15 +161,13 @@ const showRouteReport = () => {
window.open(url, '_blank'); window.open(url, '_blank');
}; };
const markAsServed = () => { function markAsServed() {
selectedRows.value.forEach((row) => { selectedRows.value.forEach(async (row) => {
if (row?.id) { if (row?.id) await axios.patch(`Routes/${row?.id}`, { isOk: true });
axios.patch(`Routes/${row?.id}`, { isOk: true });
}
}); });
refreshKey.value++; refreshKey.value++;
startingDate.value = null; startingDate.value = null;
}; }
const openTicketsDialog = (id) => { const openTicketsDialog = (id) => {
if (!id) { if (!id) {
@ -179,11 +184,9 @@ const openTicketsDialog = (id) => {
}; };
onMounted(async () => { onMounted(async () => {
stateStore.rightDrawer = true;
allColumnNames.value = columns.value.map((col) => col.name); allColumnNames.value = columns.value.map((col) => col.name);
await arrayData.fetch({ append: false }); await arrayData.fetch({ append: false });
}); });
onUnmounted(() => (stateStore.rightDrawer = false));
</script> </script>
<template> <template>
@ -210,6 +213,10 @@ onUnmounted(() => (stateStore.rightDrawer = false));
<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">
{{ t('globals.clone') }} {{ t('globals.clone') }}
<VnLv
:label="t('route.summary.packages')"
:value="getTotalPackages(entity.tickets)"
/>
</QBtn> </QBtn>
</QCardActions> </QCardActions>
</QCard> </QCard>
@ -228,7 +235,7 @@ onUnmounted(() => (stateStore.rightDrawer = false));
class="LeftIcon" class="LeftIcon"
:all-columns="allColumnNames" :all-columns="allColumnNames"
table-code="routesList" table-code="routesList"
labels-traductions-path="globals" labels-traductions-path="route.columnLabels"
@on-config-saved="visibleColumns = [...$event]" @on-config-saved="visibleColumns = [...$event]"
/> />
</template> </template>
@ -256,7 +263,7 @@ onUnmounted(() => (stateStore.rightDrawer = false));
color="primary" color="primary"
class="q-mr-sm" class="q-mr-sm"
:disable="!selectedRows?.length" :disable="!selectedRows?.length"
@click="markAsServed" @click="markAsServed()"
> >
<QTooltip>{{ t('Mark as served') }}</QTooltip> <QTooltip>{{ t('Mark as served') }}</QTooltip>
</QBtn> </QBtn>
@ -269,7 +276,6 @@ onUnmounted(() => (stateStore.rightDrawer = false));
url="Routes/filter" url="Routes/filter"
:order="['created ASC', 'started ASC', 'id ASC']" :order="['created ASC', 'started ASC', 'id ASC']"
:limit="20" :limit="20"
auto-load
> >
<template #body="{ rows }"> <template #body="{ rows }">
<div class="q-pa-md route-table"> <div class="q-pa-md route-table">
@ -500,7 +506,6 @@ en:
hourStarted: Started hour hourStarted: Started hour
hourFinished: Finished hour hourFinished: Finished hour
es: es:
ID: ID
Worker: Trabajador Worker: Trabajador
Agency: Agencia Agency: Agencia
Vehicle: Vehículo Vehicle: Vehículo
@ -521,4 +526,6 @@ es:
Summary: Resumen Summary: Resumen
Route is closed: La ruta está cerrada Route is closed: La ruta está cerrada
Route is not served: La ruta no está servida Route is not served: La ruta no está servida
hourStarted: Hora de inicio
hourFinished: Hora de fin
</i18n> </i18n>

View File

@ -129,7 +129,7 @@ function confirmRemove() {
} }
function navigateToRoadmapSummary(event, row) { function navigateToRoadmapSummary(event, row) {
router.push({ name: 'RoadmapSummary', params: { id: row.id } }); router.push({ name: 'RoadmapSummary', params: { id: 1 } });
} }
</script> </script>
@ -193,7 +193,6 @@ function navigateToRoadmapSummary(event, row) {
url="Roadmaps" url="Roadmaps"
:limit="20" :limit="20"
:filter="filter" :filter="filter"
auto-load
> >
<template #body="{ rows }"> <template #body="{ rows }">
<div class="q-pa-md"> <div class="q-pa-md">

View File

@ -141,7 +141,7 @@ const setOrderedPriority = async () => {
}; };
const sortRoutes = async () => { const sortRoutes = async () => {
await axios.get(`Routes/${route.params?.id}/guessPriority/`); await axios.patch(`Routes/${route.params?.id}/guessPriority/`);
refreshKey.value++; refreshKey.value++;
}; };