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';
break;
case 'date':
case 'time':
case 'checkbox':
align = 'center';
break;

View File

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

View File

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

View File

@ -25,7 +25,7 @@ const emit = defineEmits(['search']);
>
<template #tags="{ tag, formatFn }">
<div class="q-gutter-x-xs">
<strong>{{ t(`params.${tag.label}`) }}: </strong>
<strong>{{ t(`route.params.${tag.label}`) }}: </strong>
<span>{{ formatFn(tag.value) }}</span>
</div>
</template>
@ -33,6 +33,7 @@ const emit = defineEmits(['search']);
<QItem class="q-my-sm">
<QItemSection>
<VnSelectWorker
:label="t('globals.worker')"
v-model="params.workerFk"
dense
outlined
@ -44,7 +45,7 @@ const emit = defineEmits(['search']);
<QItem class="q-my-sm">
<QItemSection>
<VnSelect
:label="t('Agency')"
:label="t('globals.agency')"
v-model="params.agencyModeFk"
url="AgencyModes/isActive"
sort-by="name ASC"
@ -61,7 +62,7 @@ const emit = defineEmits(['search']);
<QItemSection>
<VnInputDate
v-model="params.from"
:label="t('From')"
:label="t('globals.from')"
is-outlined
:disable="Boolean(params.scopeDays)"
@update:model-value="params.scopeDays = null"
@ -72,7 +73,7 @@ const emit = defineEmits(['search']);
<QItemSection>
<VnInputDate
v-model="params.to"
:label="t('To')"
:label="t('globals.to')"
is-outlined
:disable="Boolean(params.scopeDays)"
@update:model-value="params.scopeDays = null"
@ -84,7 +85,7 @@ const emit = defineEmits(['search']);
<VnInput
v-model="params.scopeDays"
type="number"
:label="t('Days Onward')"
:label="t('globals.daysOnward')"
is-outlined
clearable
:disable="Boolean(params.from || params.to)"
@ -98,7 +99,7 @@ const emit = defineEmits(['search']);
<QItem class="q-my-sm">
<QItemSection>
<VnSelect
:label="t('Vehicle')"
:label="t('globals.vehicle')"
v-model="params.vehicleFk"
url="Vehicles/active"
sort-by="numberPlate ASC"
@ -120,7 +121,7 @@ const emit = defineEmits(['search']);
<QItem class="q-my-sm">
<QItemSection>
<VnSelect
:label="t('Warehouse')"
:label="t('globals.warehouse')"
v-model="params.warehouseFk"
url="Warehouses"
option-value="id"
@ -136,7 +137,7 @@ const emit = defineEmits(['search']);
<QItemSection>
<VnInput
v-model="params.description"
:label="t('Description')"
:label="t('globals.description')"
is-outlined
clearable
/>
@ -146,7 +147,7 @@ const emit = defineEmits(['search']);
<QItemSection>
<QCheckbox
v-model="params.isOk"
:label="t('Served')"
:label="t('route.filter.Served')"
toggle-indeterminate
/>
</QItemSection>
@ -154,38 +155,3 @@ const emit = defineEmits(['search']);
</template>
</VnFilterPanel>
</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(() => [
{
align: 'center',
align: 'right',
name: 'id',
label: 'Id',
chip: {
@ -46,11 +46,11 @@ const columns = computed(() => [
},
isId: true,
columnFilter: false,
width: '25px',
},
{
align: 'center',
name: 'workerFk',
label: t('route.Worker'),
label: t('globals.worker'),
create: true,
component: 'select',
attrs: {
@ -71,9 +71,8 @@ const columns = computed(() => [
format: (row, dashIfEmpty) => dashIfEmpty(row.workerUserName),
},
{
align: 'center',
name: 'agencyModeFk',
label: t('route.Agency'),
label: t('globals.agency'),
isTitle: true,
cardVisible: true,
create: true,
@ -90,9 +89,8 @@ const columns = computed(() => [
format: (row, dashIfEmpty) => dashIfEmpty(row.agencyName),
},
{
align: 'center',
name: 'vehicleFk',
label: t('route.Vehicle'),
label: t('globals.vehicle'),
cardVisible: true,
create: true,
component: 'select',
@ -111,9 +109,8 @@ const columns = computed(() => [
format: (row, dashIfEmpty) => dashIfEmpty(row.vehiclePlateNumber),
},
{
align: 'center',
name: 'dated',
label: t('route.Date'),
label: t('globals.date'),
columnFilter: false,
cardVisible: true,
create: true,
@ -122,9 +119,8 @@ const columns = computed(() => [
dated === '0000-00-00' ? dashIfEmpty(null) : toDate(dated),
},
{
align: 'center',
name: 'from',
label: t('route.From'),
label: t('globals.from'),
visible: false,
cardVisible: true,
create: true,
@ -132,9 +128,8 @@ const columns = computed(() => [
format: ({ from }) => toDate(from),
},
{
align: 'center',
name: 'to',
label: t('route.To'),
label: t('globals.to'),
visible: false,
cardVisible: true,
create: true,
@ -142,30 +137,31 @@ const columns = computed(() => [
format: ({ date }) => toDate(date),
},
{
align: 'center',
align: 'right',
name: 'm3',
label: 'm3',
cardVisible: true,
columnClass: 'shrink',
width: '50px',
},
{
align: 'center',
name: 'started',
label: t('route.hourStarted'),
component: 'time',
columnFilter: false,
format: ({ started }) => toHour(started),
width: '50px',
},
{
align: 'center',
name: 'finished',
label: t('route.hourFinished'),
component: 'time',
columnFilter: false,
format: ({ finished }) => toHour(finished),
width: '50px',
},
{
align: 'center',
align: 'right',
name: 'kmStart',
label: t('route.KmStart'),
columnClass: 'shrink',
@ -173,7 +169,7 @@ const columns = computed(() => [
visible: false,
},
{
align: 'center',
align: 'right',
name: 'kmEnd',
label: t('route.KmEnd'),
columnClass: 'shrink',
@ -181,16 +177,15 @@ const columns = computed(() => [
visible: false,
},
{
align: 'center',
align: 'left',
name: 'description',
label: t('route.Description'),
label: t('globals.description'),
isTitle: true,
create: true,
component: 'input',
field: 'description',
},
{
align: 'center',
name: 'isOk',
label: t('route.Served'),
component: 'checkbox',
@ -202,7 +197,7 @@ const columns = computed(() => [
name: 'tableActions',
actions: [
{
title: t('route.Add tickets'),
title: t('route.addTicket'),
icon: 'vn:ticketAdd',
action: (row) => openTicketsDialog(row?.id),
isPrimary: true,
@ -214,7 +209,7 @@ const columns = computed(() => [
isPrimary: true,
},
{
title: t('route.Route summary'),
title: t('route.routeSummary'),
icon: 'arrow_forward',
action: (row) => navigate(row?.id),
isPrimary: true,
@ -276,11 +271,13 @@ const openTicketsDialog = (id) => {
<QDialog v-model="confirmationDialog">
<QCard style="min-width: 350px">
<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 class="q-pt-none">
<VnInputDate
:label="t('route.Stating date')"
:label="t('route.extendedList.StatingDate')"
v-model="startingDate"
autofocus
/>
@ -288,7 +285,7 @@ const openTicketsDialog = (id) => {
<QCardActions align="right">
<QBtn
flat
:label="t('route.Cancel')"
:label="t('globals.cancel')"
v-close-popup
class="text-primary"
/>
@ -339,7 +336,7 @@ const openTicketsDialog = (id) => {
:disable="!selectedRows?.length"
@click="confirmationDialog = true"
>
<QTooltip>{{ t('route.Clone Selected Routes') }}</QTooltip>
<QTooltip>{{ t('route.extendedList.cloneSelectedRoutes') }}</QTooltip>
</QBtn>
<QBtn
icon="cloud_download"
@ -348,7 +345,9 @@ const openTicketsDialog = (id) => {
:disable="!selectedRows?.length"
@click="showRouteReport"
>
<QTooltip>{{ t('route.Download selected routes as PDF') }}</QTooltip>
<QTooltip>{{
t('route.extendedList.downloadSelectedRoutes')
}}</QTooltip>
</QBtn>
<QBtn
icon="check"
@ -357,7 +356,7 @@ const openTicketsDialog = (id) => {
:disable="!selectedRows?.length"
@click="markAsServed()"
>
<QTooltip>{{ t('route.Mark as served') }}</QTooltip>
<QTooltip>{{ t('route.extendedList.markServed') }}</QTooltip>
</QBtn>
</template>
</VnTable>

View File

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

View File

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

View File

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