feat: refs #7119 add vehicle parameters and improve filter functionality
gitea/salix-front/pipeline/pr-dev There was a failure building this commit Details

This commit is contained in:
Jorge Penadés 2025-01-24 10:46:44 +01:00
parent 55ab885ef9
commit 2e4610847d
8 changed files with 38 additions and 7 deletions

View File

@ -114,7 +114,7 @@ async function clearFilters() {
arrayData.resetPagination(); arrayData.resetPagination();
// Filtrar los params no removibles // Filtrar los params no removibles
const removableFilters = Object.keys(userParams.value).filter((param) => const removableFilters = Object.keys(userParams.value).filter((param) =>
$props.unremovableParams.includes(param) $props.unremovableParams.includes(param),
); );
const newParams = {}; const newParams = {};
// Conservar solo los params que no son removibles // Conservar solo los params que no son removibles
@ -162,13 +162,13 @@ const formatTags = (tags) => {
const tags = computed(() => { const tags = computed(() => {
const filteredTags = tagsList.value.filter( const filteredTags = tagsList.value.filter(
(tag) => !($props.customTags || []).includes(tag.label) (tag) => !($props.customTags || []).includes(tag.label),
); );
return formatTags(filteredTags); return formatTags(filteredTags);
}); });
const customTags = computed(() => const customTags = computed(() =>
tagsList.value.filter((tag) => ($props.customTags || []).includes(tag.label)) tagsList.value.filter((tag) => ($props.customTags || []).includes(tag.label)),
); );
async function remove(key) { async function remove(key) {
@ -188,10 +188,13 @@ function formatValue(value) {
const getLocale = (label) => { const getLocale = (label) => {
const param = label.split('.').at(-1); const param = label.split('.').at(-1);
const globalLocale = `globals.params.${param}`; const globalLocale = `globals.params.${param}`;
const moduleName = route.meta.moduleName;
const moduleLocale = `${moduleName.toLowerCase()}.${param}`;
if (te(globalLocale)) return t(globalLocale); if (te(globalLocale)) return t(globalLocale);
else if (te(t(`params.${param}`))); else if (te(moduleLocale)) return t(moduleLocale);
else { else {
const camelCaseModuleName = route.meta.moduleName.charAt(0).toLowerCase() + route.meta.moduleName.slice(1); const camelCaseModuleName =
moduleName.charAt(0).toLowerCase() + moduleName.slice(1);
return t(`${camelCaseModuleName}.params.${param}`); return t(`${camelCaseModuleName}.params.${param}`);
} }
}; };

View File

@ -326,6 +326,7 @@ globals:
maxTemperature: Max maxTemperature: Max
minTemperature: Min minTemperature: Min
params: params:
description: Description
clientFk: Client id clientFk: Client id
salesPersonFk: Sales person salesPersonFk: Sales person
warehouseFk: Warehouse warehouseFk: Warehouse
@ -348,6 +349,7 @@ globals:
correctingFk: Rectificative correctingFk: Rectificative
daysOnward: Days onward daysOnward: Days onward
countryFk: Country countryFk: Country
countryCodeFk: Country
companyFk: Company companyFk: Company
changePass: Change password changePass: Change password
setPass: Set password setPass: Set password

View File

@ -330,6 +330,7 @@ globals:
maxTemperature: Máx maxTemperature: Máx
minTemperature: Mín minTemperature: Mín
params: params:
description: Descripción
clientFk: Id cliente clientFk: Id cliente
salesPersonFk: Comercial salesPersonFk: Comercial
warehouseFk: Almacén warehouseFk: Almacén
@ -350,6 +351,7 @@ globals:
daysOnward: Días adelante daysOnward: Días adelante
packing: ITP packing: ITP
countryFk: País countryFk: País
countryCodeFk: País
companyFk: Empresa companyFk: Empresa
changePass: Cambiar contraseña changePass: Cambiar contraseña
setPass: Establecer contraseña setPass: Establecer contraseña

View File

@ -6,6 +6,8 @@ import VnLv from 'src/components/ui/VnLv.vue';
import VnTitle from 'src/components/common/VnTitle.vue'; import VnTitle from 'src/components/common/VnTitle.vue';
import SupplierDescriptorProxy from 'src/pages/Supplier/Card/SupplierDescriptorProxy.vue'; import SupplierDescriptorProxy from 'src/pages/Supplier/Card/SupplierDescriptorProxy.vue';
import VehicleFilter from '../VehicleFilter.js'; import VehicleFilter from '../VehicleFilter.js';
import { downloadFile } from 'src/composables/downloadFile';
import { dashIfEmpty } from 'src/filters';
const props = defineProps({ id: { type: [Number, String], default: 0 } }); const props = defineProps({ id: { type: [Number, String], default: 0 } });
@ -74,7 +76,22 @@ const links = {
<VnLv <VnLv
:label="$t('vehicle.leasing')" :label="$t('vehicle.leasing')"
:value="entity.bankPolicy?.ref" :value="entity.bankPolicy?.ref"
/> >
<template #value>
<span v-text="dashIfEmpty(entity.bankPolicy?.name)" />
<QBtn
v-if="entity.bankPolicy?.dmsFk"
class="q-ml-xs"
color="primary"
flat
dense
icon="cloud_download"
@click="downloadFile(entity.bankPolicy?.dmsFk)"
>
<QTooltip>{{ $t('globals.download') }}</QTooltip>
</QBtn>
</template>
</VnLv>
<VnLv :label="$t('globals.amount')" :value="entity.import" /> <VnLv :label="$t('globals.amount')" :value="entity.import" />
</QList> </QList>
<QList dense> <QList dense>

View File

@ -57,7 +57,7 @@ export default {
{ {
relation: 'bankPolicy', relation: 'bankPolicy',
scope: { scope: {
fields: ['id', 'ref'], fields: ['id', 'ref', 'dmsFk'],
}, },
}, },
{ {

View File

@ -15,3 +15,6 @@ vehicle:
searchbar: searchbar:
label: Search Vehicle label: Search Vehicle
info: Search by id or number plate info: Search by id or number plate
params:
vehicleTypeFk: Type
vehicleStateFk: State

View File

@ -15,3 +15,6 @@ vehicle:
searchbar: searchbar:
label: Buscar Vehículo label: Buscar Vehículo
info: Buscar por id o matrícula info: Buscar por id o matrícula
params:
vehicleTypeFk: Tipo
vehicleStateFk: Estado

View File

@ -109,6 +109,7 @@ export default {
meta: { meta: {
title: 'vehicleList', title: 'vehicleList',
icon: 'directions_car', icon: 'directions_car',
moduleName: 'Vehicle',
}, },
component: () => component: () =>
import('src/pages/Route/Vehicle/VehicleList.vue'), import('src/pages/Route/Vehicle/VehicleList.vue'),