fix: make data be reactive and use template values
gitea/salix-front/pipeline/pr-master There was a failure building this commit Details

This commit is contained in:
Jon Elias 2025-05-07 10:55:09 +02:00
parent efd2738553
commit a3c917f82a
1 changed files with 15 additions and 13 deletions

View File

@ -130,20 +130,22 @@ async function onDataSaved(formData, { id }) {
} }
} }
async function getSupplierClientReferences(value) { async function getSupplierClientReferences(data) {
if (!value) return (initialData.description = ''); if (!data) return (initialData.description = '');
const params = { bankAccount: value }; const params = { bankAccount: data.compensationAccount };
const { data } = await axios(`Clients/getClientOrSupplierReference`, { params }); const { data: reference } = await axios(`Clients/getClientOrSupplierReference`, {
if (!data.clientId) { params,
initialData.description = t('Supplier Compensation Reference', { });
supplierId: data.supplierId, if (!reference) {
supplierName: data.supplierName, data.description = t('Supplier Compensation Reference', {
supplierId: reference.supplierId,
supplierName: reference.supplierName,
}); });
return; return;
} }
initialData.description = t('Client Compensation Reference', { data.description = t('Client Compensation Reference', {
clientId: data.clientId, clientId: reference.clientId,
clientName: data.clientName, clientName: reference.clientName,
}); });
} }
@ -252,7 +254,7 @@ async function getAmountPaid() {
:label="t('Compensation account')" :label="t('Compensation account')"
clearable clearable
v-model="data.compensationAccount" v-model="data.compensationAccount"
@blur="getSupplierClientReferences(data.compensationAccount)" @blur="getSupplierClientReferences(data)"
/> />
</VnRow> </VnRow>
</div> </div>
@ -260,7 +262,7 @@ async function getAmountPaid() {
:label="t('Reference')" :label="t('Reference')"
:required="true" :required="true"
clearable clearable
v-model="initialData.description" v-model="data.description"
/> />
<div v-if="accountingType.code == 'cash'"> <div v-if="accountingType.code == 'cash'">
<div class="text-h6">{{ t('Cash') }}</div> <div class="text-h6">{{ t('Cash') }}</div>