From 2ec5c2b49fe4ab6ae0da7dcbad82b2e0ff6bcfe5 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Sun, 16 Feb 2025 03:18:10 +0100 Subject: [PATCH] fix: ticketList columnfilter --- src/pages/Ticket/TicketList.vue | 68 ++++++++++++++++++++++----------- 1 file changed, 45 insertions(+), 23 deletions(-) diff --git a/src/pages/Ticket/TicketList.vue b/src/pages/Ticket/TicketList.vue index fa03b3f6d..cdc122004 100644 --- a/src/pages/Ticket/TicketList.vue +++ b/src/pages/Ticket/TicketList.vue @@ -121,12 +121,16 @@ const columns = computed(() => [ { align: 'left', name: 'shipped', + component: 'time', + columnFilter: false, label: t('ticketList.hour'), format: (row) => toTimeFormat(row.shipped), }, { align: 'left', name: 'zoneLanding', + component: 'time', + columnFilter: false, label: t('ticketList.closure'), format: (row, dashIfEmpty) => dashIfEmpty(toTimeFormat(row.zoneLanding)), }, @@ -146,9 +150,16 @@ const columns = computed(() => [ }, { align: 'left', - name: 'province', + name: 'provinceFk', label: t('ticketList.province'), - columnClass: 'expand', + component: 'select', + attrs: { + url: 'Provinces', + }, + columnField: { + component: null, + }, + format: (row, dashIfEmpty) => dashIfEmpty(row.province), }, { align: 'left', @@ -182,9 +193,21 @@ const columns = computed(() => [ }, { align: 'left', - name: 'warehouse', - label: t('ticketList.warehouse'), - columnClass: 'expand', + name: 'warehouseFk', + label: t('globals.warehouse'), + component: 'select', + attrs: { + url: 'warehouses', + fields: ['id', 'name'], + optionLabel: 'name', + optionValue: 'id', + }, + format: (row) => row.warehouse, + columnField: { + component: null, + }, + cardVisible: false, + create: false, }, { align: 'left', @@ -216,6 +239,7 @@ const columns = computed(() => [ { title: t('components.smartCard.viewSummary'), icon: 'preview', + isPrimary: true, action: (row, evt) => { if (evt && evt.ctrlKey) { const url = router.resolve({ @@ -232,7 +256,7 @@ const columns = computed(() => [ function resetAgenciesSelector(formData) { agenciesOptions.value = []; - if(formData) formData.agencyModeId = null; + if (formData) formData.agencyModeId = null; } function redirectToLines(id) { @@ -240,7 +264,7 @@ function redirectToLines(id) { window.open(url, '_blank'); } -const onClientSelected = async (formData) => { +const onClientSelected = async (formData) => { resetAgenciesSelector(formData); await fetchClient(formData); await fetchAddresses(formData); @@ -248,14 +272,12 @@ const onClientSelected = async (formData) => { const fetchAvailableAgencies = async (formData) => { resetAgenciesSelector(formData); - const response= await getAgencies(formData, selectedClient.value); + const response = await getAgencies(formData, selectedClient.value); if (!response) return; - - const { options, agency } = response - if(options) - agenciesOptions.value = options; - if(agency) - formData.agencyModeId = agency; + + const { options, agency } = response; + if (options) agenciesOptions.value = options; + if (agency) formData.agencyModeId = agency; }; const fetchClient = async (formData) => { @@ -330,7 +352,7 @@ function openBalanceDialog(ticket) { const description = ref([]); const firstTicketClientId = checkedTickets[0].clientFk; const isSameClient = checkedTickets.every( - (ticket) => ticket.clientFk === firstTicketClientId + (ticket) => ticket.clientFk === firstTicketClientId, ); if (!isSameClient) { @@ -369,7 +391,7 @@ async function onSubmit() { description: dialogData.value.value.description, clientFk: dialogData.value.value.clientFk, email: email[0].email, - } + }, ); if (data) notify('globals.dataSaved', 'positive'); @@ -388,32 +410,32 @@ function setReference(data) { switch (data) { case 1: newDescription = `${t( - 'ticketList.creditCard' + 'ticketList.creditCard', )}, ${dialogData.value.value.description.replace( /^(Credit Card, |Cash, |Transfers, )/, - '' + '', )}`; break; case 2: newDescription = `${t( - 'ticketList.cash' + 'ticketList.cash', )}, ${dialogData.value.value.description.replace( /^(Credit Card, |Cash, |Transfers, )/, - '' + '', )}`; break; case 3: newDescription = `${newDescription.replace( /^(Credit Card, |Cash, |Transfers, )/, - '' + '', )}`; break; case 4: newDescription = `${t( - 'ticketList.transfers' + 'ticketList.transfers', )}, ${dialogData.value.value.description.replace( /^(Credit Card, |Cash, |Transfers, )/, - '' + '', )}`; break; case 3317: