fix: refs #8388 update format functions to handle empty values and adjust column widths
gitea/salix-front/pipeline/pr-dev There was a failure building this commit Details

This commit is contained in:
Jorge Penadés 2025-05-12 13:17:07 +02:00
parent 30539dfed7
commit 7dbe5c24ec
2 changed files with 16 additions and 12 deletions

View File

@ -28,9 +28,10 @@ const columns = computed(() => [
sortBy: 'id', sortBy: 'id',
fields: ['id', 'description'], fields: ['id', 'description'],
}, },
format: getCode, format: (row, dashIfEmpty) => dashIfEmpty(getCode(row)),
create: true, create: true,
isEditable: true, isEditable: true,
width: 'max-content',
}, },
{ {
name: 'amount', name: 'amount',
@ -39,7 +40,6 @@ const columns = computed(() => [
create: true, create: true,
isEditable: true, isEditable: true,
columnFilter: false, columnFilter: false,
width: '30px',
}, },
{ {
name: 'net', name: 'net',
@ -48,7 +48,6 @@ const columns = computed(() => [
create: true, create: true,
isEditable: true, isEditable: true,
columnFilter: false, columnFilter: false,
width: '30px',
}, },
{ {
name: 'stems', name: 'stems',
@ -57,7 +56,6 @@ const columns = computed(() => [
create: true, create: true,
isEditable: true, isEditable: true,
columnFilter: false, columnFilter: false,
width: '30px',
}, },
{ {
name: 'countryFk', name: 'countryFk',
@ -70,7 +68,6 @@ const columns = computed(() => [
create: true, create: true,
isEditable: true, isEditable: true,
columnFilter: false, columnFilter: false,
width: '30px',
}, },
]); ]);
@ -79,8 +76,8 @@ const tableRows = computed(
); );
function getCode(row) { function getCode(row) {
const { id, description } = intrastats.value.find(({ id }) => id === row.intrastatFk); const code = intrastats.value.find(({ id }) => id === row.intrastatFk);
return `${id}: ${description}`; return code ? `${code.id}: ${code.description}` : null;
} }
</script> </script>
<template> <template>

View File

@ -41,15 +41,15 @@ const columns = computed(() => [
name: 'expenseFk', name: 'expenseFk',
label: t('Expense'), label: t('Expense'),
component: markRaw(VnSelectExpense), component: markRaw(VnSelectExpense),
format: (row) => { format: (row, dashIfEmpty) => {
const expense = expenses.value.find((e) => e.id === row.expenseFk); const expense = expenses.value.find((e) => e.id === row.expenseFk);
return expense ? `${expense.id}: ${expense.name}` : row.expenseFk; return expense ? `${expense.id}: ${expense.name}` : dashIfEmpty(null);
}, },
sortable: true, sortable: true,
align: 'left', align: 'left',
isEditable: true, isEditable: true,
create: true, create: true,
width: '250px', width: 'max-content',
cellEvent: { cellEvent: {
keydown: async (evt, row) => { keydown: async (evt, row) => {
if (evt.key !== 'Tab') return; if (evt.key !== 'Tab') return;
@ -90,7 +90,6 @@ const columns = computed(() => [
createAttrs: { createAttrs: {
defaultValue: true, defaultValue: true,
}, },
width: '100px',
}, },
{ {
name: 'taxTypeSageFk', name: 'taxTypeSageFk',
@ -111,6 +110,7 @@ const columns = computed(() => [
align: 'left', align: 'left',
isEditable: true, isEditable: true,
create: true, create: true,
width: 'max-content',
}, },
{ {
name: 'transactionTypeSageFk', name: 'transactionTypeSageFk',
@ -134,6 +134,7 @@ const columns = computed(() => [
align: 'left', align: 'left',
isEditable: true, isEditable: true,
create: true, create: true,
width: 'max-content',
}, },
{ {
name: 'rate', name: 'rate',
@ -211,6 +212,12 @@ async function handleForeignValueUpdate(val, row) {
auto-load auto-load
@on-fetch="(data) => (sageTransactionTypes = data)" @on-fetch="(data) => (sageTransactionTypes = data)"
/> />
<QBtn
:to="`/invoice-in/${$route.params.id}/due-day`"
label="mock"
dense
size="md"
></QBtn>
<VnTable <VnTable
v-if="invoiceIn" v-if="invoiceIn"
ref="invoiceInVatTableRef" ref="invoiceInVatTableRef"
@ -236,7 +243,7 @@ async function handleForeignValueUpdate(val, row) {
formInitialData: { invoiceInFk: $route.params.id, isDeductible: true }, formInitialData: { invoiceInFk: $route.params.id, isDeductible: true },
onDataSaved: () => invoiceInVatTableRef.reload(), onDataSaved: () => invoiceInVatTableRef.reload(),
}" }"
:crud-model="{ goTo: `/invoice-in/${$route.params.id}/due-day` }" :go-to="`invoice-in/${$route.params.id}/due-day`"
> >
<template #column-footer-taxableBase> <template #column-footer-taxableBase>
{{ toCurrency(taxableBaseTotal) }} {{ toCurrency(taxableBaseTotal) }}