refactor: refs #8630 add vehicle translations and enhance route list columns
gitea/salix-front/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Jose Antonio Tubau 2025-02-18 14:47:55 +01:00
parent 20cb9f91e8
commit a36d83547b
8 changed files with 123 additions and 122 deletions

View File

@ -8,6 +8,7 @@ export function getColAlign(col) {
align = 'right'; align = 'right';
break; break;
case 'date': case 'date':
case 'time':
case 'checkbox': case 'checkbox':
align = 'center'; align = 'center';
break; break;

View File

@ -157,6 +157,7 @@ globals:
raid: 'Raid {daysInForward} days' raid: 'Raid {daysInForward} days'
isVies: Vies isVies: Vies
noData: No data available noData: No data available
vehicle: Vehicle
pageTitles: pageTitles:
logIn: Login logIn: Login
addressEdit: Update address addressEdit: Update address

View File

@ -161,6 +161,7 @@ globals:
raid: 'Redada {daysInForward} días' raid: 'Redada {daysInForward} días'
isVies: Vies isVies: Vies
noData: Datos no disponibles noData: Datos no disponibles
vehicle: Vehículo
pageTitles: pageTitles:
logIn: Inicio de sesión logIn: Inicio de sesión
addressEdit: Modificar consignatario addressEdit: Modificar consignatario

View File

@ -25,7 +25,7 @@ const emit = defineEmits(['search']);
> >
<template #tags="{ tag, formatFn }"> <template #tags="{ tag, formatFn }">
<div class="q-gutter-x-xs"> <div class="q-gutter-x-xs">
<strong>{{ t(`params.${tag.label}`) }}: </strong> <strong>{{ t(`route.params.${tag.label}`) }}: </strong>
<span>{{ formatFn(tag.value) }}</span> <span>{{ formatFn(tag.value) }}</span>
</div> </div>
</template> </template>
@ -33,6 +33,7 @@ const emit = defineEmits(['search']);
<QItem class="q-my-sm"> <QItem class="q-my-sm">
<QItemSection> <QItemSection>
<VnSelectWorker <VnSelectWorker
:label="t('globals.worker')"
v-model="params.workerFk" v-model="params.workerFk"
dense dense
outlined outlined
@ -44,7 +45,7 @@ const emit = defineEmits(['search']);
<QItem class="q-my-sm"> <QItem class="q-my-sm">
<QItemSection> <QItemSection>
<VnSelect <VnSelect
:label="t('Agency')" :label="t('globals.agency')"
v-model="params.agencyModeFk" v-model="params.agencyModeFk"
url="AgencyModes/isActive" url="AgencyModes/isActive"
sort-by="name ASC" sort-by="name ASC"
@ -61,7 +62,7 @@ const emit = defineEmits(['search']);
<QItemSection> <QItemSection>
<VnInputDate <VnInputDate
v-model="params.from" v-model="params.from"
:label="t('From')" :label="t('globals.from')"
is-outlined is-outlined
:disable="Boolean(params.scopeDays)" :disable="Boolean(params.scopeDays)"
@update:model-value="params.scopeDays = null" @update:model-value="params.scopeDays = null"
@ -72,7 +73,7 @@ const emit = defineEmits(['search']);
<QItemSection> <QItemSection>
<VnInputDate <VnInputDate
v-model="params.to" v-model="params.to"
:label="t('To')" :label="t('globals.to')"
is-outlined is-outlined
:disable="Boolean(params.scopeDays)" :disable="Boolean(params.scopeDays)"
@update:model-value="params.scopeDays = null" @update:model-value="params.scopeDays = null"
@ -84,7 +85,7 @@ const emit = defineEmits(['search']);
<VnInput <VnInput
v-model="params.scopeDays" v-model="params.scopeDays"
type="number" type="number"
:label="t('Days Onward')" :label="t('globals.daysOnward')"
is-outlined is-outlined
clearable clearable
:disable="Boolean(params.from || params.to)" :disable="Boolean(params.from || params.to)"
@ -98,7 +99,7 @@ const emit = defineEmits(['search']);
<QItem class="q-my-sm"> <QItem class="q-my-sm">
<QItemSection> <QItemSection>
<VnSelect <VnSelect
:label="t('Vehicle')" :label="t('globals.vehicle')"
v-model="params.vehicleFk" v-model="params.vehicleFk"
url="Vehicles/active" url="Vehicles/active"
sort-by="numberPlate ASC" sort-by="numberPlate ASC"
@ -120,7 +121,7 @@ const emit = defineEmits(['search']);
<QItem class="q-my-sm"> <QItem class="q-my-sm">
<QItemSection> <QItemSection>
<VnSelect <VnSelect
:label="t('Warehouse')" :label="t('globals.warehouse')"
v-model="params.warehouseFk" v-model="params.warehouseFk"
url="Warehouses" url="Warehouses"
option-value="id" option-value="id"
@ -136,7 +137,7 @@ const emit = defineEmits(['search']);
<QItemSection> <QItemSection>
<VnInput <VnInput
v-model="params.description" v-model="params.description"
:label="t('Description')" :label="t('globals.description')"
is-outlined is-outlined
clearable clearable
/> />
@ -146,7 +147,7 @@ const emit = defineEmits(['search']);
<QItemSection> <QItemSection>
<QCheckbox <QCheckbox
v-model="params.isOk" v-model="params.isOk"
:label="t('Served')" :label="t('route.filter.Served')"
toggle-indeterminate toggle-indeterminate
/> />
</QItemSection> </QItemSection>
@ -154,38 +155,3 @@ const emit = defineEmits(['search']);
</template> </template>
</VnFilterPanel> </VnFilterPanel>
</template> </template>
<i18n>
en:
params:
warehouseFk: Warehouse
description: Description
m3:
scopeDays: Days Onward
vehicleFk: Vehicle
agencyModeFk: Agency
workerFk: Worker
from: From
to: To
Served: Served
es:
params:
warehouseFk: Almacén
description: Descripción
m3:
scopeDays: Días en adelante
vehicleFk: Vehículo
agencyModeFk: Agencia
workerFk: Trabajador
from: Desde
to: Hasta
Warehouse: Almacén
Description: Descripción
Vehicle: Vehículo
Agency: Agencia
Worker: Trabajador
From: Desde
To: Hasta
Served: Servida
Days Onward: Días en adelante
</i18n>

View File

@ -38,7 +38,7 @@ const routeFilter = {
}; };
const columns = computed(() => [ const columns = computed(() => [
{ {
align: 'center', align: 'right',
name: 'id', name: 'id',
label: 'Id', label: 'Id',
chip: { chip: {
@ -46,11 +46,11 @@ const columns = computed(() => [
}, },
isId: true, isId: true,
columnFilter: false, columnFilter: false,
width: '25px',
}, },
{ {
align: 'center',
name: 'workerFk', name: 'workerFk',
label: t('route.Worker'), label: t('globals.worker'),
create: true, create: true,
component: 'select', component: 'select',
attrs: { attrs: {
@ -71,9 +71,8 @@ const columns = computed(() => [
format: (row, dashIfEmpty) => dashIfEmpty(row.workerUserName), format: (row, dashIfEmpty) => dashIfEmpty(row.workerUserName),
}, },
{ {
align: 'center',
name: 'agencyModeFk', name: 'agencyModeFk',
label: t('route.Agency'), label: t('globals.agency'),
isTitle: true, isTitle: true,
cardVisible: true, cardVisible: true,
create: true, create: true,
@ -90,9 +89,8 @@ const columns = computed(() => [
format: (row, dashIfEmpty) => dashIfEmpty(row.agencyName), format: (row, dashIfEmpty) => dashIfEmpty(row.agencyName),
}, },
{ {
align: 'center',
name: 'vehicleFk', name: 'vehicleFk',
label: t('route.Vehicle'), label: t('globals.vehicle'),
cardVisible: true, cardVisible: true,
create: true, create: true,
component: 'select', component: 'select',
@ -111,9 +109,8 @@ const columns = computed(() => [
format: (row, dashIfEmpty) => dashIfEmpty(row.vehiclePlateNumber), format: (row, dashIfEmpty) => dashIfEmpty(row.vehiclePlateNumber),
}, },
{ {
align: 'center',
name: 'dated', name: 'dated',
label: t('route.Date'), label: t('globals.date'),
columnFilter: false, columnFilter: false,
cardVisible: true, cardVisible: true,
create: true, create: true,
@ -122,9 +119,8 @@ const columns = computed(() => [
dated === '0000-00-00' ? dashIfEmpty(null) : toDate(dated), dated === '0000-00-00' ? dashIfEmpty(null) : toDate(dated),
}, },
{ {
align: 'center',
name: 'from', name: 'from',
label: t('route.From'), label: t('globals.from'),
visible: false, visible: false,
cardVisible: true, cardVisible: true,
create: true, create: true,
@ -132,9 +128,8 @@ const columns = computed(() => [
format: ({ from }) => toDate(from), format: ({ from }) => toDate(from),
}, },
{ {
align: 'center',
name: 'to', name: 'to',
label: t('route.To'), label: t('globals.to'),
visible: false, visible: false,
cardVisible: true, cardVisible: true,
create: true, create: true,
@ -142,30 +137,31 @@ const columns = computed(() => [
format: ({ date }) => toDate(date), format: ({ date }) => toDate(date),
}, },
{ {
align: 'center', align: 'right',
name: 'm3', name: 'm3',
label: 'm3', label: 'm3',
cardVisible: true, cardVisible: true,
columnClass: 'shrink', columnClass: 'shrink',
width: '50px',
}, },
{ {
align: 'center',
name: 'started', name: 'started',
label: t('route.hourStarted'), label: t('route.hourStarted'),
component: 'time', component: 'time',
columnFilter: false, columnFilter: false,
format: ({ started }) => toHour(started), format: ({ started }) => toHour(started),
width: '50px',
}, },
{ {
align: 'center',
name: 'finished', name: 'finished',
label: t('route.hourFinished'), label: t('route.hourFinished'),
component: 'time', component: 'time',
columnFilter: false, columnFilter: false,
format: ({ finished }) => toHour(finished), format: ({ finished }) => toHour(finished),
width: '50px',
}, },
{ {
align: 'center', align: 'right',
name: 'kmStart', name: 'kmStart',
label: t('route.KmStart'), label: t('route.KmStart'),
columnClass: 'shrink', columnClass: 'shrink',
@ -173,7 +169,7 @@ const columns = computed(() => [
visible: false, visible: false,
}, },
{ {
align: 'center', align: 'right',
name: 'kmEnd', name: 'kmEnd',
label: t('route.KmEnd'), label: t('route.KmEnd'),
columnClass: 'shrink', columnClass: 'shrink',
@ -181,16 +177,15 @@ const columns = computed(() => [
visible: false, visible: false,
}, },
{ {
align: 'center', align: 'left',
name: 'description', name: 'description',
label: t('route.Description'), label: t('globals.description'),
isTitle: true, isTitle: true,
create: true, create: true,
component: 'input', component: 'input',
field: 'description', field: 'description',
}, },
{ {
align: 'center',
name: 'isOk', name: 'isOk',
label: t('route.Served'), label: t('route.Served'),
component: 'checkbox', component: 'checkbox',
@ -202,7 +197,7 @@ const columns = computed(() => [
name: 'tableActions', name: 'tableActions',
actions: [ actions: [
{ {
title: t('route.Add tickets'), title: t('route.addTicket'),
icon: 'vn:ticketAdd', icon: 'vn:ticketAdd',
action: (row) => openTicketsDialog(row?.id), action: (row) => openTicketsDialog(row?.id),
isPrimary: true, isPrimary: true,
@ -214,7 +209,7 @@ const columns = computed(() => [
isPrimary: true, isPrimary: true,
}, },
{ {
title: t('route.Route summary'), title: t('route.routeSummary'),
icon: 'arrow_forward', icon: 'arrow_forward',
action: (row) => navigate(row?.id), action: (row) => navigate(row?.id),
isPrimary: true, isPrimary: true,
@ -276,11 +271,13 @@ const openTicketsDialog = (id) => {
<QDialog v-model="confirmationDialog"> <QDialog v-model="confirmationDialog">
<QCard style="min-width: 350px"> <QCard style="min-width: 350px">
<QCardSection> <QCardSection>
<p class="text-h6 q-ma-none">{{ t('route.Select the starting date') }}</p> <p class="text-h6 q-ma-none">
{{ t('route.extendedList.selectStartingDate') }}
</p>
</QCardSection> </QCardSection>
<QCardSection class="q-pt-none"> <QCardSection class="q-pt-none">
<VnInputDate <VnInputDate
:label="t('route.Stating date')" :label="t('route.extendedList.StatingDate')"
v-model="startingDate" v-model="startingDate"
autofocus autofocus
/> />
@ -288,7 +285,7 @@ const openTicketsDialog = (id) => {
<QCardActions align="right"> <QCardActions align="right">
<QBtn <QBtn
flat flat
:label="t('route.Cancel')" :label="t('globals.cancel')"
v-close-popup v-close-popup
class="text-primary" class="text-primary"
/> />
@ -339,7 +336,7 @@ const openTicketsDialog = (id) => {
:disable="!selectedRows?.length" :disable="!selectedRows?.length"
@click="confirmationDialog = true" @click="confirmationDialog = true"
> >
<QTooltip>{{ t('route.Clone Selected Routes') }}</QTooltip> <QTooltip>{{ t('route.extendedList.cloneSelectedRoutes') }}</QTooltip>
</QBtn> </QBtn>
<QBtn <QBtn
icon="cloud_download" icon="cloud_download"
@ -348,7 +345,9 @@ const openTicketsDialog = (id) => {
:disable="!selectedRows?.length" :disable="!selectedRows?.length"
@click="showRouteReport" @click="showRouteReport"
> >
<QTooltip>{{ t('route.Download selected routes as PDF') }}</QTooltip> <QTooltip>{{
t('route.extendedList.downloadSelectedRoutes')
}}</QTooltip>
</QBtn> </QBtn>
<QBtn <QBtn
icon="check" icon="check"
@ -357,7 +356,7 @@ const openTicketsDialog = (id) => {
:disable="!selectedRows?.length" :disable="!selectedRows?.length"
@click="markAsServed()" @click="markAsServed()"
> >
<QTooltip>{{ t('route.Mark as served') }}</QTooltip> <QTooltip>{{ t('route.extendedList.markServed') }}</QTooltip>
</QBtn> </QBtn>
</template> </template>
</VnTable> </VnTable>

View File

@ -33,11 +33,11 @@ const columns = computed(() => [
condition: () => true, condition: () => true,
}, },
columnFilter: false, columnFilter: false,
width: '25px',
}, },
{ {
align: 'left',
name: 'workerFk', name: 'workerFk',
label: t('route.Worker'), label: t('gloabls.worker'),
component: 'select', component: 'select',
attrs: { attrs: {
url: 'Workers/activeWithInheritedRole', url: 'Workers/activeWithInheritedRole',
@ -50,15 +50,19 @@ const columns = computed(() => [
}, },
}, },
create: true, create: true,
cardVisible: true,
format: (row, dashIfEmpty) => dashIfEmpty(row.travelRef), format: (row, dashIfEmpty) => dashIfEmpty(row.travelRef),
columnFilter: false, columnFilter: false,
width: '100px',
}, },
{ {
align: 'left', name: 'workerFk',
name: 'agencyName', label: t('globals.worker'),
label: t('route.Agency'), visible: false,
cardVisible: true, cardVisible: true,
},
{
name: 'agencyName',
label: t('globals.agency'),
component: 'select', component: 'select',
attrs: { attrs: {
url: 'agencyModes', url: 'agencyModes',
@ -71,12 +75,17 @@ const columns = computed(() => [
create: true, create: true,
columnClass: 'expand', columnClass: 'expand',
columnFilter: false, columnFilter: false,
width: '150px',
}, },
{ {
align: 'left', name: 'agencyName',
name: 'vehiclePlateNumber', label: t('globals.agency'),
label: t('route.Vehicle'), visible: false,
cardVisible: true, cardVisible: true,
},
{
name: 'vehiclePlateNumber',
label: t('globals.vehicle'),
component: 'select', component: 'select',
attrs: { attrs: {
url: 'vehicles', url: 'vehicles',
@ -90,27 +99,36 @@ const columns = computed(() => [
}, },
create: true, create: true,
columnFilter: false, columnFilter: false,
width: '75px',
}, },
{ {
align: 'left', name: 'vehiclePlateNumber',
label: t('globals.vehicle'),
visible: false,
cardVisible: true,
},
{
align: 'center',
name: 'started', name: 'started',
label: t('route.hourStarted'), label: t('route.hourStarted'),
cardVisible: true, cardVisible: true,
columnFilter: false, columnFilter: false,
format: (row) => toHour(row.started), format: (row) => toHour(row.started),
width: '50px',
}, },
{ {
align: 'left', align: 'center',
name: 'finished', name: 'finished',
label: t('route.hourFinished'), label: t('route.hourFinished'),
cardVisible: true, cardVisible: true,
columnFilter: false, columnFilter: false,
format: (row) => toHour(row.started), format: (row) => toHour(row.started),
width: '50px',
}, },
{ {
align: 'left', align: 'left',
name: 'description', name: 'description',
label: t('route.Description'), label: t('globals.description'),
cardVisible: true, cardVisible: true,
isTitle: true, isTitle: true,
create: true, create: true,
@ -118,7 +136,6 @@ const columns = computed(() => [
columnFilter: false, columnFilter: false,
}, },
{ {
align: 'left',
name: 'isOk', name: 'isOk',
label: t('route.Served'), label: t('route.Served'),
component: 'checkbox', component: 'checkbox',
@ -154,6 +171,7 @@ const columns = computed(() => [
</template> </template>
<template #body> <template #body>
<VnTable <VnTable
:with-filters="false"
:data-key :data-key
:columns="columns" :columns="columns"
:right-search="false" :right-search="false"

View File

@ -1,8 +1,26 @@
route: route:
filter:
Served: Served
extendedList:
selectStartingDate: Select the starting date
startingDate: Starting date
cloneSelectedRoutes: Clone selected routes
downloadSelectedRoutes: Download selected routes as PDF
markServed: Mark as served
roadmap: roadmap:
search: Search roadmap search: Search roadmap
searchInfo: You can search by roadmap reference searchInfo: You can search by roadmap reference
params: params:
warehouseFk: Warehouse
description: Description
m3:
scopeDays: Days Onward
vehicleFk: Vehicle
agencyModeFk: Agency
workerFk: Worker
from: From
to: To
isOk: Served
etd: ETD etd: ETD
tractorPlate: Plate tractorPlate: Plate
price: Price price: Price
@ -16,31 +34,21 @@ route:
shipped: Shipped shipped: Shipped
agencyAgreement: Agency agreement agencyAgreement: Agency agreement
agencyModeName: Agency route agencyModeName: Agency route
Worker: Worker
Agency: Agency
Vehicle: Vehicle
Description: Description
hourStarted: H.Start hourStarted: H.Start
hourFinished: H.End hourFinished: H.End
dated: Dated createRoute: Create route
From: From
To: To
Date: Date Date: Date
KmStart: Km start KmStart: Km start
KmEnd: Km end KmEnd: Km end
Served: Served Served: Served
Clone Selected Routes: Clone selected routes addTicket: Add ticket
Select the starting date: Select the starting date routeSummary: Go to summary
Stating date: Starting date
Cancel: Cancel
Mark as served: Mark as served
Download selected routes as PDF: Download selected routes as PDF
Add ticket: Add ticket
Summary: Summary
Route is closed: Route is closed Route is closed: Route is closed
Route is not served: Route is not served Route is not served: Route is not served
search: Search route search: Search route
searchInfo: You can search by route reference searchInfo: You can search by route reference
dated: Dated
preview: Preview
cmr: cmr:
list: list:
results: results results: results
@ -54,4 +62,4 @@ route:
clientFk: Client id clientFk: Client id
shipped: Preparation date shipped: Preparation date
viewCmr: View CMR viewCmr: View CMR
downloadCmrs: Download CMRs downloadCmrs: Download CMRs

View File

@ -1,47 +1,54 @@
route: route:
filter:
Served: Servida
extendedList:
selectStartingDate: Seleccione la fecha de inicio
statingDate: Fecha de inicio
cloneSelectedRoutes: Clonar rutas seleccionadas
downloadSelectedRoutes: Descargar rutas seleccionadas como PDF
markServed: Marcar como servidas
roadmap: roadmap:
search: Buscar troncales search: Buscar troncales
searchInfo: Puedes buscar por referencia del troncal searchInfo: Puedes buscar por referencia del troncal
params: params:
agencyModeName: Agencia Ruta warehouseFk: Almacén
agencyAgreement: Agencia Acuerdo description: Descripción
id: Id m3:
name: Troncal scopeDays: Días adelante
vehicleFk: Vehículo
agencyModeFk: Agencia
workerFk: Trabajador
from: Desde
to: Hasta
isOk: Servida
etd: ETD etd: ETD
tractorPlate: Matrícula tractorPlate: Matrícula
price: Precio price: Precio
observations: Observaciones observations: Observaciones
id: Id
name: Troncal
cmrFk: Id CMR cmrFk: Id CMR
hasCmrDms: Gestdoc hasCmrDms: Gestdoc
ticketFk: Id ticket ticketFk: Id ticket
routeFK: Id ruta routeFK: Id ruta
shipped: Fecha preparación shipped: Fecha preparación
Worker: Trabajador agencyAgreement: Agencia Acuerdo
Agency: Agencia agencyModeName: Agencia Ruta
Vehicle: Vehículo
Description: Descripción
hourStarted: H.Inicio hourStarted: H.Inicio
hourFinished: H.Fin hourFinished: H.Fin
createRoute: Crear ruta createRoute: Crear ruta
From: Desde
To: Hasta
Date: Fecha Date: Fecha
KmStart: Km inicio KmStart: Km inicio
KmEnd: Km fin KmEnd: Km fin
Served: Servida Served: Servida
Clone Selected Routes: Clonar rutas seleccionadas addTicket: Añadir tickets
Select the starting date: Seleccione la fecha de inicio routeSummary: Ir a vista previa
Stating date: Fecha de inicio
Cancel: Cancelar
Mark as served: Marcar como servidas
Download selected routes as PDF: Descargar rutas seleccionadas como PDF
Add ticket: Añadir tickets
preview: Vista previa
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
search: Buscar rutas search: Buscar rutas
searchInfo: Puedes buscar por referencia de la ruta searchInfo: Puedes buscar por referencia de la ruta
dated: Fecha
preview: Vista previa
cmr: cmr:
list: list:
results: resultados results: resultados
@ -55,4 +62,4 @@ route:
clientFk: Id cliente clientFk: Id cliente
shipped: Fecha preparación shipped: Fecha preparación
viewCmr: Ver CMR viewCmr: Ver CMR
downloadCmrs: Descargar CMRs downloadCmrs: Descargar CMRs