From 2e4610847db7cd5dd4d9949a1dd115d4dbcf13a8 Mon Sep 17 00:00:00 2001 From: jorgep Date: Fri, 24 Jan 2025 10:46:44 +0100 Subject: [PATCH] feat: refs #7119 add vehicle parameters and improve filter functionality --- src/components/ui/VnFilterPanel.vue | 13 ++++++++----- src/i18n/locale/en.yml | 2 ++ src/i18n/locale/es.yml | 2 ++ .../Route/Vehicle/Card/VehicleSummary.vue | 19 ++++++++++++++++++- src/pages/Route/Vehicle/VehicleFilter.js | 2 +- src/pages/Route/Vehicle/locale/en.yml | 3 +++ src/pages/Route/Vehicle/locale/es.yml | 3 +++ src/router/modules/route.js | 1 + 8 files changed, 38 insertions(+), 7 deletions(-) diff --git a/src/components/ui/VnFilterPanel.vue b/src/components/ui/VnFilterPanel.vue index 93f069cc6..80128018a 100644 --- a/src/components/ui/VnFilterPanel.vue +++ b/src/components/ui/VnFilterPanel.vue @@ -114,7 +114,7 @@ async function clearFilters() { arrayData.resetPagination(); // Filtrar los params no removibles const removableFilters = Object.keys(userParams.value).filter((param) => - $props.unremovableParams.includes(param) + $props.unremovableParams.includes(param), ); const newParams = {}; // Conservar solo los params que no son removibles @@ -162,13 +162,13 @@ const formatTags = (tags) => { const tags = computed(() => { const filteredTags = tagsList.value.filter( - (tag) => !($props.customTags || []).includes(tag.label) + (tag) => !($props.customTags || []).includes(tag.label), ); return formatTags(filteredTags); }); 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) { @@ -188,10 +188,13 @@ function formatValue(value) { const getLocale = (label) => { const param = label.split('.').at(-1); const globalLocale = `globals.params.${param}`; + const moduleName = route.meta.moduleName; + const moduleLocale = `${moduleName.toLowerCase()}.${param}`; if (te(globalLocale)) return t(globalLocale); - else if (te(t(`params.${param}`))); + else if (te(moduleLocale)) return t(moduleLocale); 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}`); } }; diff --git a/src/i18n/locale/en.yml b/src/i18n/locale/en.yml index 3d50337ef..e7118fa37 100644 --- a/src/i18n/locale/en.yml +++ b/src/i18n/locale/en.yml @@ -326,6 +326,7 @@ globals: maxTemperature: Max minTemperature: Min params: + description: Description clientFk: Client id salesPersonFk: Sales person warehouseFk: Warehouse @@ -348,6 +349,7 @@ globals: correctingFk: Rectificative daysOnward: Days onward countryFk: Country + countryCodeFk: Country companyFk: Company changePass: Change password setPass: Set password diff --git a/src/i18n/locale/es.yml b/src/i18n/locale/es.yml index 1eae05f51..bdcb9ac30 100644 --- a/src/i18n/locale/es.yml +++ b/src/i18n/locale/es.yml @@ -330,6 +330,7 @@ globals: maxTemperature: Máx minTemperature: Mín params: + description: Descripción clientFk: Id cliente salesPersonFk: Comercial warehouseFk: Almacén @@ -350,6 +351,7 @@ globals: daysOnward: Días adelante packing: ITP countryFk: País + countryCodeFk: País companyFk: Empresa changePass: Cambiar contraseña setPass: Establecer contraseña diff --git a/src/pages/Route/Vehicle/Card/VehicleSummary.vue b/src/pages/Route/Vehicle/Card/VehicleSummary.vue index a61a1cc49..fa814ae21 100644 --- a/src/pages/Route/Vehicle/Card/VehicleSummary.vue +++ b/src/pages/Route/Vehicle/Card/VehicleSummary.vue @@ -6,6 +6,8 @@ import VnLv from 'src/components/ui/VnLv.vue'; import VnTitle from 'src/components/common/VnTitle.vue'; import SupplierDescriptorProxy from 'src/pages/Supplier/Card/SupplierDescriptorProxy.vue'; 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 } }); @@ -74,7 +76,22 @@ const links = { + > + + diff --git a/src/pages/Route/Vehicle/VehicleFilter.js b/src/pages/Route/Vehicle/VehicleFilter.js index be933bc3d..cbf5cc621 100644 --- a/src/pages/Route/Vehicle/VehicleFilter.js +++ b/src/pages/Route/Vehicle/VehicleFilter.js @@ -57,7 +57,7 @@ export default { { relation: 'bankPolicy', scope: { - fields: ['id', 'ref'], + fields: ['id', 'ref', 'dmsFk'], }, }, { diff --git a/src/pages/Route/Vehicle/locale/en.yml b/src/pages/Route/Vehicle/locale/en.yml index a5b43fe9e..73b1dd5b5 100644 --- a/src/pages/Route/Vehicle/locale/en.yml +++ b/src/pages/Route/Vehicle/locale/en.yml @@ -15,3 +15,6 @@ vehicle: searchbar: label: Search Vehicle info: Search by id or number plate + params: + vehicleTypeFk: Type + vehicleStateFk: State diff --git a/src/pages/Route/Vehicle/locale/es.yml b/src/pages/Route/Vehicle/locale/es.yml index e3eebe62a..34615e252 100644 --- a/src/pages/Route/Vehicle/locale/es.yml +++ b/src/pages/Route/Vehicle/locale/es.yml @@ -15,3 +15,6 @@ vehicle: searchbar: label: Buscar Vehículo info: Buscar por id o matrícula + params: + vehicleTypeFk: Tipo + vehicleStateFk: Estado diff --git a/src/router/modules/route.js b/src/router/modules/route.js index 60f51e64c..f53a806f0 100644 --- a/src/router/modules/route.js +++ b/src/router/modules/route.js @@ -109,6 +109,7 @@ export default { meta: { title: 'vehicleList', icon: 'directions_car', + moduleName: 'Vehicle', }, component: () => import('src/pages/Route/Vehicle/VehicleList.vue'),