fix: refs #8731 customerBalance and test
gitea/salix-front/pipeline/pr-master This commit looks good
Details
gitea/salix-front/pipeline/pr-master This commit looks good
Details
This commit is contained in:
parent
7c0c1076e9
commit
e2fa5a87eb
|
@ -74,26 +74,27 @@ onBeforeMount(() => {
|
||||||
urlCreate.value = `Clients/${route.params.id}/createReceipt`;
|
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;
|
if (!accounting) return;
|
||||||
accountingType.value = accounting.accountingType;
|
accountingType.value = accounting.accountingType;
|
||||||
initialData.description = [];
|
console.log('accountingType.value: ', accountingType.value);
|
||||||
initialData.payed = Date.vnNew();
|
data.description = [];
|
||||||
|
data.payed = Date.vnNew();
|
||||||
isCash.value = accountingType.value.code == 'cash';
|
isCash.value = accountingType.value.code == 'cash';
|
||||||
viewReceipt.value = isCash.value;
|
viewReceipt.value = isCash.value;
|
||||||
if (accountingType.value.daysInFuture)
|
if (accountingType.value.daysInFuture)
|
||||||
initialData.payed.setDate(
|
data.payed.setDate(data.payed.getDate() + accountingType.value.daysInFuture);
|
||||||
initialData.payed.getDate() + accountingType.value.daysInFuture,
|
console.log('data.payed', data.payed);
|
||||||
);
|
|
||||||
maxAmount.value = accountingType.value && accountingType.value.maxAmount;
|
maxAmount.value = accountingType.value && accountingType.value.maxAmount;
|
||||||
if (accountingType.value.code == 'compensation')
|
if (accountingType.value.code == 'compensation') return (data.description = '');
|
||||||
return (initialData.description = '');
|
|
||||||
|
|
||||||
let descriptions = [];
|
let descriptions = [];
|
||||||
if (accountingType.value.receiptDescription)
|
if (accountingType.value.receiptDescription)
|
||||||
descriptions.push(accountingType.value.receiptDescription);
|
descriptions.push(accountingType.value.receiptDescription);
|
||||||
if (initialData.description) descriptions.push(initialData.description);
|
if (data.description) descriptions.push(data.description);
|
||||||
initialData.description = descriptions.join(', ');
|
data.description = descriptions.join(', ');
|
||||||
}
|
}
|
||||||
|
|
||||||
const calculateFromAmount = (event) => {
|
const calculateFromAmount = (event) => {
|
||||||
|
@ -113,7 +114,8 @@ function onBeforeSave(data) {
|
||||||
if (isCash.value && shouldSendEmail.value && !data.email)
|
if (isCash.value && shouldSendEmail.value && !data.email)
|
||||||
return notify(t('There is no assigned email for this client'), 'negative');
|
return notify(t('There is no assigned email for this client'), 'negative');
|
||||||
|
|
||||||
data.bankFk = data.bankFk?.id;
|
// data.bankFk = data.bankFk?.id;
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -184,11 +186,10 @@ async function getAmountPaid() {
|
||||||
<FormModel
|
<FormModel
|
||||||
ref="formModelRef"
|
ref="formModelRef"
|
||||||
:form-initial-data="initialData"
|
:form-initial-data="initialData"
|
||||||
:observe-form-changes="false"
|
|
||||||
:url-create="urlCreate"
|
:url-create="urlCreate"
|
||||||
:mapper="onBeforeSave"
|
:mapper="onBeforeSave"
|
||||||
@on-data-saved="onDataSaved"
|
@on-data-saved="onDataSaved"
|
||||||
prevent-submit
|
:prevent-submit="true"
|
||||||
>
|
>
|
||||||
<template #form="{ data, validate }">
|
<template #form="{ data, validate }">
|
||||||
<span ref="closeButton" class="row justify-end close-icon" v-close-popup>
|
<span ref="closeButton" class="row justify-end close-icon" v-close-popup>
|
||||||
|
@ -196,27 +197,9 @@ async function getAmountPaid() {
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<h5 class="q-mt-none">{{ t('New payment') }}</h5>
|
<h5 class="q-mt-none">{{ t('New payment') }}</h5>
|
||||||
|
|
||||||
<VnRow>
|
|
||||||
<VnInputDate
|
|
||||||
:label="t('Date')"
|
|
||||||
:required="true"
|
|
||||||
v-model="data.payed"
|
|
||||||
/>
|
|
||||||
<VnSelect
|
|
||||||
:label="t('Company')"
|
|
||||||
:options="companyOptions"
|
|
||||||
:required="true"
|
|
||||||
:rules="validate('entry.companyFk')"
|
|
||||||
hide-selected
|
|
||||||
option-label="code"
|
|
||||||
option-value="id"
|
|
||||||
v-model="data.companyFk"
|
|
||||||
@update:model-value="getAmountPaid()"
|
|
||||||
/>
|
|
||||||
</VnRow>
|
|
||||||
<VnRow>
|
<VnRow>
|
||||||
<VnSelect
|
<VnSelect
|
||||||
|
autofocus
|
||||||
:label="t('Bank')"
|
:label="t('Bank')"
|
||||||
v-model="data.bankFk"
|
v-model="data.bankFk"
|
||||||
url="Accountings"
|
url="Accountings"
|
||||||
|
@ -225,9 +208,10 @@ async function getAmountPaid() {
|
||||||
sort-by="id"
|
sort-by="id"
|
||||||
:limit="0"
|
:limit="0"
|
||||||
@update:model-value="
|
@update:model-value="
|
||||||
(value, options) => setPaymentType(value, options)
|
(value, options) => setPaymentType(data, value, options)
|
||||||
"
|
"
|
||||||
:emit-value="false"
|
:emit-value="false"
|
||||||
|
data-cy="paymentBank"
|
||||||
>
|
>
|
||||||
<template #option="scope">
|
<template #option="scope">
|
||||||
<QItem v-bind="scope.itemProps">
|
<QItem v-bind="scope.itemProps">
|
||||||
|
@ -245,8 +229,24 @@ async function getAmountPaid() {
|
||||||
@update:model-value="calculateFromAmount($event)"
|
@update:model-value="calculateFromAmount($event)"
|
||||||
clearable
|
clearable
|
||||||
v-model.number="data.amountPaid"
|
v-model.number="data.amountPaid"
|
||||||
|
data-cy="paymentAmount"
|
||||||
/>
|
/>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
|
<VnRow>
|
||||||
|
<VnInputDate :label="t('Date')" v-model="data.payed" />
|
||||||
|
<VnSelect
|
||||||
|
:label="t('Company')"
|
||||||
|
:options="companyOptions"
|
||||||
|
:required="true"
|
||||||
|
:rules="validate('entry.companyFk')"
|
||||||
|
hide-selected
|
||||||
|
option-label="code"
|
||||||
|
option-value="id"
|
||||||
|
v-model="data.companyFk"
|
||||||
|
@update:model-value="getAmountPaid()"
|
||||||
|
/>
|
||||||
|
</VnRow>
|
||||||
|
|
||||||
<div v-if="data.bankFk?.accountingType?.code == 'compensation'">
|
<div v-if="data.bankFk?.accountingType?.code == 'compensation'">
|
||||||
<div class="text-h6">
|
<div class="text-h6">
|
||||||
{{ t('Compensation') }}
|
{{ t('Compensation') }}
|
||||||
|
|
|
@ -8,4 +8,10 @@ describe('Client balance', () => {
|
||||||
it('Should load layout', () => {
|
it('Should load layout', () => {
|
||||||
cy.get('.q-page').should('be.visible');
|
cy.get('.q-page').should('be.visible');
|
||||||
});
|
});
|
||||||
|
it('Should create a mandate', () => {
|
||||||
|
cy.get('.q-page-sticky > div > .q-btn').click();
|
||||||
|
cy.dataCy('paymentBank').type({ arroyDown });
|
||||||
|
cy.dataCy('paymentAmount').type('100');
|
||||||
|
cy.saveCard();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue