diff --git a/src/pages/Customer/components/CustomerNewPayment.vue b/src/pages/Customer/components/CustomerNewPayment.vue index 6ecccc544..2295b922b 100644 --- a/src/pages/Customer/components/CustomerNewPayment.vue +++ b/src/pages/Customer/components/CustomerNewPayment.vue @@ -74,26 +74,27 @@ onBeforeMount(() => { urlCreate.value = `Clients/${route.params.id}/createReceipt`; }); -function setPaymentType(accounting) { +function setPaymentType(data, accounting) { + data.bankFk = accounting.id; + console.log('accounting: ', accounting); if (!accounting) return; accountingType.value = accounting.accountingType; - initialData.description = []; - initialData.payed = Date.vnNew(); + console.log('accountingType.value: ', accountingType.value); + data.description = []; + data.payed = Date.vnNew(); isCash.value = accountingType.value.code == 'cash'; viewReceipt.value = isCash.value; if (accountingType.value.daysInFuture) - initialData.payed.setDate( - initialData.payed.getDate() + accountingType.value.daysInFuture, - ); + data.payed.setDate(data.payed.getDate() + accountingType.value.daysInFuture); + console.log('data.payed', data.payed); maxAmount.value = accountingType.value && accountingType.value.maxAmount; - if (accountingType.value.code == 'compensation') - return (initialData.description = ''); + if (accountingType.value.code == 'compensation') return (data.description = ''); let descriptions = []; if (accountingType.value.receiptDescription) descriptions.push(accountingType.value.receiptDescription); - if (initialData.description) descriptions.push(initialData.description); - initialData.description = descriptions.join(', '); + if (data.description) descriptions.push(data.description); + data.description = descriptions.join(', '); } const calculateFromAmount = (event) => { @@ -113,7 +114,8 @@ function onBeforeSave(data) { if (isCash.value && shouldSendEmail.value && !data.email) return notify(t('There is no assigned email for this client'), 'negative'); - data.bankFk = data.bankFk?.id; + // data.bankFk = data.bankFk?.id; + return data; } @@ -184,11 +186,10 @@ async function getAmountPaid() {