fix: ticketList columnfilter
gitea/salix-front/pipeline/pr-test This commit looks good Details

This commit is contained in:
Javier Segarra 2025-02-16 03:18:10 +01:00
parent 1972e921df
commit 2ec5c2b49f
1 changed files with 45 additions and 23 deletions

View File

@ -121,12 +121,16 @@ const columns = computed(() => [
{ {
align: 'left', align: 'left',
name: 'shipped', name: 'shipped',
component: 'time',
columnFilter: false,
label: t('ticketList.hour'), label: t('ticketList.hour'),
format: (row) => toTimeFormat(row.shipped), format: (row) => toTimeFormat(row.shipped),
}, },
{ {
align: 'left', align: 'left',
name: 'zoneLanding', name: 'zoneLanding',
component: 'time',
columnFilter: false,
label: t('ticketList.closure'), label: t('ticketList.closure'),
format: (row, dashIfEmpty) => dashIfEmpty(toTimeFormat(row.zoneLanding)), format: (row, dashIfEmpty) => dashIfEmpty(toTimeFormat(row.zoneLanding)),
}, },
@ -146,9 +150,16 @@ const columns = computed(() => [
}, },
{ {
align: 'left', align: 'left',
name: 'province', name: 'provinceFk',
label: t('ticketList.province'), label: t('ticketList.province'),
columnClass: 'expand', component: 'select',
attrs: {
url: 'Provinces',
},
columnField: {
component: null,
},
format: (row, dashIfEmpty) => dashIfEmpty(row.province),
}, },
{ {
align: 'left', align: 'left',
@ -182,9 +193,21 @@ const columns = computed(() => [
}, },
{ {
align: 'left', align: 'left',
name: 'warehouse', name: 'warehouseFk',
label: t('ticketList.warehouse'), label: t('globals.warehouse'),
columnClass: 'expand', 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', align: 'left',
@ -216,6 +239,7 @@ const columns = computed(() => [
{ {
title: t('components.smartCard.viewSummary'), title: t('components.smartCard.viewSummary'),
icon: 'preview', icon: 'preview',
isPrimary: true,
action: (row, evt) => { action: (row, evt) => {
if (evt && evt.ctrlKey) { if (evt && evt.ctrlKey) {
const url = router.resolve({ const url = router.resolve({
@ -232,7 +256,7 @@ const columns = computed(() => [
function resetAgenciesSelector(formData) { function resetAgenciesSelector(formData) {
agenciesOptions.value = []; agenciesOptions.value = [];
if(formData) formData.agencyModeId = null; if (formData) formData.agencyModeId = null;
} }
function redirectToLines(id) { function redirectToLines(id) {
@ -240,7 +264,7 @@ function redirectToLines(id) {
window.open(url, '_blank'); window.open(url, '_blank');
} }
const onClientSelected = async (formData) => { const onClientSelected = async (formData) => {
resetAgenciesSelector(formData); resetAgenciesSelector(formData);
await fetchClient(formData); await fetchClient(formData);
await fetchAddresses(formData); await fetchAddresses(formData);
@ -248,14 +272,12 @@ const onClientSelected = async (formData) => {
const fetchAvailableAgencies = async (formData) => { const fetchAvailableAgencies = async (formData) => {
resetAgenciesSelector(formData); resetAgenciesSelector(formData);
const response= await getAgencies(formData, selectedClient.value); const response = await getAgencies(formData, selectedClient.value);
if (!response) return; if (!response) return;
const { options, agency } = response const { options, agency } = response;
if(options) if (options) agenciesOptions.value = options;
agenciesOptions.value = options; if (agency) formData.agencyModeId = agency;
if(agency)
formData.agencyModeId = agency;
}; };
const fetchClient = async (formData) => { const fetchClient = async (formData) => {
@ -330,7 +352,7 @@ function openBalanceDialog(ticket) {
const description = ref([]); const description = ref([]);
const firstTicketClientId = checkedTickets[0].clientFk; const firstTicketClientId = checkedTickets[0].clientFk;
const isSameClient = checkedTickets.every( const isSameClient = checkedTickets.every(
(ticket) => ticket.clientFk === firstTicketClientId (ticket) => ticket.clientFk === firstTicketClientId,
); );
if (!isSameClient) { if (!isSameClient) {
@ -369,7 +391,7 @@ async function onSubmit() {
description: dialogData.value.value.description, description: dialogData.value.value.description,
clientFk: dialogData.value.value.clientFk, clientFk: dialogData.value.value.clientFk,
email: email[0].email, email: email[0].email,
} },
); );
if (data) notify('globals.dataSaved', 'positive'); if (data) notify('globals.dataSaved', 'positive');
@ -388,32 +410,32 @@ function setReference(data) {
switch (data) { switch (data) {
case 1: case 1:
newDescription = `${t( newDescription = `${t(
'ticketList.creditCard' 'ticketList.creditCard',
)}, ${dialogData.value.value.description.replace( )}, ${dialogData.value.value.description.replace(
/^(Credit Card, |Cash, |Transfers, )/, /^(Credit Card, |Cash, |Transfers, )/,
'' '',
)}`; )}`;
break; break;
case 2: case 2:
newDescription = `${t( newDescription = `${t(
'ticketList.cash' 'ticketList.cash',
)}, ${dialogData.value.value.description.replace( )}, ${dialogData.value.value.description.replace(
/^(Credit Card, |Cash, |Transfers, )/, /^(Credit Card, |Cash, |Transfers, )/,
'' '',
)}`; )}`;
break; break;
case 3: case 3:
newDescription = `${newDescription.replace( newDescription = `${newDescription.replace(
/^(Credit Card, |Cash, |Transfers, )/, /^(Credit Card, |Cash, |Transfers, )/,
'' '',
)}`; )}`;
break; break;
case 4: case 4:
newDescription = `${t( newDescription = `${t(
'ticketList.transfers' 'ticketList.transfers',
)}, ${dialogData.value.value.description.replace( )}, ${dialogData.value.value.description.replace(
/^(Credit Card, |Cash, |Transfers, )/, /^(Credit Card, |Cash, |Transfers, )/,
'' '',
)}`; )}`;
break; break;
case 3317: case 3317: