refactor: refs #8388 update UI feedback
gitea/salix-front/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Jorge Penadés 2025-03-18 12:04:54 +01:00
parent 05bc79ec32
commit 6546d06f60
3 changed files with 31 additions and 8 deletions

View File

@ -25,7 +25,8 @@ const invoiceInFormRef = ref();
const invoiceId = +route.params.id; const invoiceId = +route.params.id;
const filter = { where: { invoiceInFk: invoiceId } }; const filter = { where: { invoiceInFk: invoiceId } };
const areRows = ref(false); const areRows = ref(false);
const totals = ref(); const totalTaxableBase = ref();
const noMatch = computed(() => totalAmount.value != totalTaxableBase.value);
const columns = computed(() => [ const columns = computed(() => [
{ {
name: 'duedate', name: 'duedate',
@ -74,9 +75,12 @@ async function insert() {
notify(t('globals.dataSaved'), 'positive'); notify(t('globals.dataSaved'), 'positive');
} }
onBeforeMount(async () => { async function setTaxableBase() {
totals.value = (await axios.get(`InvoiceIns/${invoiceId}/getTotals`)).data; const { data } = await axios.get(`InvoiceIns/${invoiceId}/getTotals`);
}); totalTaxableBase.value = data.totalTaxableBase;
}
onBeforeMount(async () => await setTaxableBase());
</script> </script>
<template> <template>
<CrudModel <CrudModel
@ -89,13 +93,14 @@ onBeforeMount(async () => {
:data-required="{ invoiceInFk: invoiceId }" :data-required="{ invoiceInFk: invoiceId }"
v-model:selected="rowsSelected" v-model:selected="rowsSelected"
@on-fetch="(data) => (areRows = !!data.length)" @on-fetch="(data) => (areRows = !!data.length)"
@save-changes="setTaxableBase"
> >
<template #body="{ rows }"> <template #body="{ rows }">
<QTable <QTable
v-model:selected="rowsSelected" v-model:selected="rowsSelected"
selection="multiple" selection="multiple"
:columns="columns" :columns
:rows="rows" :rows
row-key="$index" row-key="$index"
:grid="$q.screen.lt.sm" :grid="$q.screen.lt.sm"
> >
@ -151,7 +156,18 @@ onBeforeMount(async () => {
<QTd /> <QTd />
<QTd /> <QTd />
<QTd> <QTd>
{{ toCurrency(totalAmount) }} <QChip
dense
:color="noMatch ? 'negative' : 'transparent'"
class="q-pa-xs"
:title="
noMatch
? t('invoiceIn.noMatch', { totalTaxableBase })
: ''
"
>
{{ toCurrency(totalAmount) }}
</QChip>
</QTd> </QTd>
<QTd> <QTd>
<template v-if="isNotEuro(invoiceIn.currency.code)"> <template v-if="isNotEuro(invoiceIn.currency.code)">
@ -237,7 +253,7 @@ onBeforeMount(async () => {
if (!areRows) insert(); if (!areRows) insert();
else else
invoiceInFormRef.insert({ invoiceInFormRef.insert({
amount: (totals.totalTaxableBase - totalAmount).toFixed(2), amount: (totalTaxableBase - totalAmount).toFixed(2),
invoiceInFk: invoiceId, invoiceInFk: invoiceId,
}); });
} }
@ -249,6 +265,10 @@ onBeforeMount(async () => {
.bg { .bg {
background-color: var(--vn-light-gray); background-color: var(--vn-light-gray);
} }
.q-chip {
color: var(--vn-text-color);
}
</style> </style>
<i18n> <i18n>
es: es:

View File

@ -68,3 +68,4 @@ invoiceIn:
isBooked: Is booked isBooked: Is booked
account: Ledger account account: Ledger account
correctingFk: Rectificative correctingFk: Rectificative
noMatch: No match with the vat({totalTaxableBase})

View File

@ -60,9 +60,11 @@ invoiceIn:
net: Neto net: Neto
stems: Tallos stems: Tallos
country: País country: País
noMatch: No cuadra
params: params:
search: Id o nombre proveedor search: Id o nombre proveedor
correctedFk: Rectificada correctedFk: Rectificada
isBooked: Contabilizada isBooked: Contabilizada
account: Cuenta contable account: Cuenta contable
correctingFk: Rectificativa correctingFk: Rectificativa
noMatch: No cuadra con el iva({totalTaxableBase})