From ee1fcf75fbf630bcade551f739215d8931071955 Mon Sep 17 00:00:00 2001 From: jtubau Date: Wed, 26 Mar 2025 12:57:02 +0100 Subject: [PATCH] refactor: refs #7638 enhance CmrList component with additional fields and improved formatting --- src/pages/Route/Cmr/CmrList.vue | 265 +++++++++++++++++++++++++++----- 1 file changed, 230 insertions(+), 35 deletions(-) diff --git a/src/pages/Route/Cmr/CmrList.vue b/src/pages/Route/Cmr/CmrList.vue index 170f73bc0..3c331ec46 100644 --- a/src/pages/Route/Cmr/CmrList.vue +++ b/src/pages/Route/Cmr/CmrList.vue @@ -6,13 +6,18 @@ import { useRoute } from 'vue-router'; import { useSession } from 'src/composables/useSession'; import { toDateHourMin } from 'filters/index'; import { useStateStore } from 'src/stores/useStateStore'; +import { dashIfEmpty } from 'src/filters'; +import AgencyDescriptorProxy from '../Agency/Card/AgencyDescriptorProxy.vue'; +import CustomerDescriptorProxy from 'src/pages/Customer/Card/CustomerDescriptorProxy.vue'; +import RouteDescriptorProxy from '../Card/RouteDescriptorProxy.vue'; +import SupplierDescriptorProxy from 'src/pages/Supplier/Card/SupplierDescriptorProxy.vue'; import TicketDescriptorProxy from 'pages/Ticket/Card/TicketDescriptorProxy.vue'; -import CustomerDescriptorProxy from 'pages/Customer/Card/CustomerDescriptorProxy.vue'; import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue'; import VnTable from 'components/VnTable/VnTable.vue'; import VnSearchbar from 'src/components/ui/VnSearchbar.vue'; +import VnInput from 'src/components/common/VnInput.vue'; const route = useRoute(); const { t } = useI18n(); @@ -30,39 +35,117 @@ const userParams = { const columns = computed(() => [ { - align: 'left', + align: 'right', name: 'cmrFk', - label: t('route.cmr.params.cmrFk'), + label: t('cmr.params.cmrFk'), chip: { condition: () => true, }, isId: true, }, { - align: 'center', - name: 'hasCmrDms', - label: t('route.cmr.params.hasCmrDms'), - component: 'checkbox', - cardVisible: true, - }, - { - align: 'left', - label: t('route.cmr.params.ticketFk'), + align: 'right', + label: t('cmr.params.ticketFk'), name: 'ticketFk', }, { - align: 'left', - label: t('route.cmr.params.routeFk'), + align: 'right', + label: t('cmr.params.routeFk'), name: 'routeFk', }, { - align: 'left', - label: t('route.cmr.params.clientFk'), + label: t('cmr.params.client'), name: 'clientFk', + component: 'select', + attrs: { + url: 'Clients', + fields: ['id', 'name'], + }, + columnFilter: { + name: 'clientFk', + attrs: { + url: 'Clients', + fields: ['id', 'name'], + }, + }, }, { - align: 'right', - label: t('route.cmr.params.countryFk'), + label: t('cmr.params.agency'), + name: 'agencyModeFk', + component: 'select', + attrs: { + url: 'Agencies', + fields: ['id', 'name'], + }, + columnFilter: { + name: 'agencyModeFk', + attrs: { + url: 'Agencies', + fields: ['id', 'name'], + }, + }, + format: ({ agencyName }) => agencyName, + }, + { + label: t('cmr.params.supplier'), + name: 'supplierFk', + component: 'select', + attrs: { + url: 'suppliers', + fields: ['id', 'name'], + }, + columnFilter: { + name: 'supplierFk', + attrs: { + url: 'suppliers', + fields: ['id', 'name'], + }, + }, + }, + { + label: t('cmr.params.sender'), + name: 'addressFromFk', + component: 'select', + attrs: { + url: 'Addresses', + fields: ['id', 'nickname'], + optionValue: 'id', + optionLabel: 'nickname', + }, + columnFilter: { + name: 'addressFromFk', + attrs: { + url: 'Addresses', + fields: ['id', 'nickname'], + optionValue: 'id', + optionLabel: 'nickname', + }, + }, + format: ({ origin }) => origin, + }, + { + label: t('cmr.params.destination'), + name: 'addressToFk', + component: 'select', + attrs: { + url: 'addresses', + fields: ['id', 'nickname'], + optionValue: 'id', + optionLabel: 'nickname', + }, + columnFilter: { + name: 'addressToFk', + attrs: { + url: 'addresses', + fields: ['id', 'nickname'], + optionValue: 'id', + optionLabel: 'nickname', + }, + }, + format: ({ destination }) => destination, + }, + { + label: t('cmr.params.country'), name: 'countryFk', component: 'select', attrs: { @@ -79,16 +162,61 @@ const columns = computed(() => [ format: ({ countryName }) => countryName, }, { - align: 'right', - label: t('route.cmr.params.shipped'), - name: 'shipped', - cardVisible: true, + label: t('cmr.params.created'), + name: 'created', component: 'date', - format: ({ shipped }) => toDateHourMin(shipped), + format: ({ created }) => dashIfEmpty(toDateHourMin(created)), }, { - align: 'right', - label: t('route.cmr.params.warehouseFk'), + label: t('cmr.params.shipped'), + name: 'shipped', + component: 'date', + format: ({ shipped }) => dashIfEmpty(toDateHourMin(shipped)), + }, + { + label: t('cmr.params.etd'), + name: 'ead', + component: 'date', + format: ({ ead }) => dashIfEmpty(toDateHourMin(ead)), + toolTip: t('cmr.params.etdTooltip'), + }, + { + label: t('globals.landed'), + name: 'landed', + component: 'date', + format: ({ landed }) => dashIfEmpty(toDateHourMin(landed)), + }, + { + align: 'left', + label: t('cmr.params.packageList'), + name: 'packagesList', + columnFilter: false, + }, + { + align: 'left', + label: t('cmr.params.observation'), + name: 'observation', + columnFilter: false, + }, + { + align: 'left', + label: t('cmr.params.senderInstructions'), + name: 'senderInstruccions', + columnFilter: false, + }, + { + align: 'left', + label: t('cmr.params.paymentInstructions'), + name: 'paymentInstruccions', + columnFilter: false, + }, + { + align: 'left', + label: t('cmr.params.vehiclePlate'), + name: 'truckPlate', + }, + { + label: t('cmr.params.warehouse'), name: 'warehouseFk', component: 'select', attrs: { @@ -96,7 +224,6 @@ const columns = computed(() => [ fields: ['id', 'name'], }, columnFilter: { - inWhere: true, name: 'warehouseFk', attrs: { url: 'warehouses', @@ -105,12 +232,23 @@ const columns = computed(() => [ }, format: ({ warehouseName }) => warehouseName, }, + { + align: 'left', + name: 'specialAgreements', + label: t('cmr.params.specialAgreements'), + columnFilter: false, + }, + { + name: 'hasCmrDms', + label: t('cmr.params.hasCmrDms'), + component: 'checkbox', + }, { align: 'center', name: 'tableActions', actions: [ { - title: t('route.cmr.params.viewCmr'), + title: t('cmr.params.viewCmr'), icon: 'visibility', isPrimary: true, action: (row) => window.open(getCmrUrl(row?.cmrFk), '_blank'), @@ -151,11 +289,7 @@ function downloadPdfs() { } + + + + + + + +