Merge branch 'test' of https://gitea.verdnatura.es/verdnatura/salix-front into dev
gitea/salix-front/pipeline/head This commit looks good
Details
gitea/salix-front/pipeline/head This commit looks good
Details
This commit is contained in:
commit
a49b2851a8
|
@ -17,7 +17,6 @@ const filter = {
|
|||
{ relation: 'company', scope: { fields: ['id', 'code'] } },
|
||||
],
|
||||
order: ['created DESC'],
|
||||
limit: 20,
|
||||
};
|
||||
|
||||
const columns = computed(() => [
|
||||
|
@ -31,7 +30,7 @@ const columns = computed(() => [
|
|||
{
|
||||
align: 'left',
|
||||
cardVisible: true,
|
||||
format: ({ company }) => company.code,
|
||||
format: ({ company }) => company?.code,
|
||||
label: t('globals.company'),
|
||||
name: 'company',
|
||||
},
|
||||
|
|
|
@ -5,7 +5,7 @@ import { useRoute } from 'vue-router';
|
|||
import axios from 'axios';
|
||||
import { getClientRisk } from '../composables/getClientRisk';
|
||||
import { useDialogPluginComponent } from 'quasar';
|
||||
|
||||
import FormModelPopup from 'components/FormModelPopup.vue';
|
||||
import { usePrintService } from 'composables/usePrintService';
|
||||
import useNotify from 'src/composables/useNotify.js';
|
||||
import FetchData from 'components/FetchData.vue';
|
||||
|
@ -74,26 +74,24 @@ onBeforeMount(() => {
|
|||
urlCreate.value = `Clients/${route.params.id}/createReceipt`;
|
||||
});
|
||||
|
||||
function setPaymentType(accounting) {
|
||||
function setPaymentType(data, accounting) {
|
||||
data.bankFk = accounting.id;
|
||||
if (!accounting) return;
|
||||
accountingType.value = accounting.accountingType;
|
||||
initialData.description = [];
|
||||
initialData.payed = Date.vnNew();
|
||||
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);
|
||||
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 +111,6 @@ 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;
|
||||
return data;
|
||||
}
|
||||
|
||||
|
@ -181,42 +178,19 @@ async function getAmountPaid() {
|
|||
auto-load
|
||||
url="Clients/findOne"
|
||||
/>
|
||||
<FormModel
|
||||
<FormModelPopup
|
||||
ref="formModelRef"
|
||||
:form-initial-data="initialData"
|
||||
:observe-form-changes="false"
|
||||
:url-create="urlCreate"
|
||||
:mapper="onBeforeSave"
|
||||
@on-data-saved="onDataSaved"
|
||||
prevent-submit
|
||||
:prevent-submit="true"
|
||||
>
|
||||
<template #form="{ data, validate }">
|
||||
<span ref="closeButton" class="row justify-end close-icon" v-close-popup>
|
||||
<QIcon name="close" size="sm" />
|
||||
</span>
|
||||
|
||||
<template #form-inputs="{ data, validate }">
|
||||
<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>
|
||||
<VnSelect
|
||||
autofocus
|
||||
:label="t('Bank')"
|
||||
v-model="data.bankFk"
|
||||
url="Accountings"
|
||||
|
@ -225,9 +199,10 @@ async function getAmountPaid() {
|
|||
sort-by="id"
|
||||
:limit="0"
|
||||
@update:model-value="
|
||||
(value, options) => setPaymentType(value, options)
|
||||
(value, options) => setPaymentType(data, value, options)
|
||||
"
|
||||
:emit-value="false"
|
||||
data-cy="paymentBank"
|
||||
>
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
|
@ -245,8 +220,28 @@ async function getAmountPaid() {
|
|||
@update:model-value="calculateFromAmount($event)"
|
||||
clearable
|
||||
v-model.number="data.amountPaid"
|
||||
data-cy="paymentAmount"
|
||||
/>
|
||||
</VnRow>
|
||||
<VnRow>
|
||||
<VnInputDate
|
||||
:label="t('Date')"
|
||||
v-model="data.payed"
|
||||
:required="true"
|
||||
/>
|
||||
<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 class="text-h6">
|
||||
{{ t('Compensation') }}
|
||||
|
@ -287,27 +282,8 @@ async function getAmountPaid() {
|
|||
<QCheckbox v-model="shouldSendEmail" :label="t('Send email')" />
|
||||
</VnRow>
|
||||
</div>
|
||||
<div class="q-mt-lg row justify-end">
|
||||
<QBtn
|
||||
:disabled="formModelRef.isLoading"
|
||||
:label="t('globals.cancel')"
|
||||
:loading="formModelRef.isLoading"
|
||||
class="q-ml-sm"
|
||||
color="primary"
|
||||
flat
|
||||
type="reset"
|
||||
v-close-popup
|
||||
/>
|
||||
<QBtn
|
||||
:disabled="formModelRef.isLoading"
|
||||
:label="t('globals.save')"
|
||||
:loading="formModelRef.isLoading"
|
||||
color="primary"
|
||||
@click="formModelRef.save()"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
</FormModel>
|
||||
</FormModelPopup>
|
||||
</QDialog>
|
||||
</template>
|
||||
|
||||
|
|
|
@ -8,4 +8,10 @@ describe('Client balance', () => {
|
|||
it('Should load layout', () => {
|
||||
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