fix: add required validation depends on verified data checkbox
gitea/salix-front/pipeline/pr-test This commit is unstable
Details
gitea/salix-front/pipeline/pr-test This commit is unstable
Details
This commit is contained in:
parent
b993428201
commit
85e932a6b9
|
@ -62,6 +62,15 @@ async function acceptPropagate({ isEqualizated }) {
|
||||||
});
|
});
|
||||||
notify(t('Equivalent tax spreaded'), 'warning');
|
notify(t('Equivalent tax spreaded'), 'warning');
|
||||||
}
|
}
|
||||||
|
const isTaxDataChecked = ref(false);
|
||||||
|
|
||||||
|
function isRequired({ isTaxDataChecked: taxDataChecked }) {
|
||||||
|
if (!isTaxDataChecked.value) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return taxDataChecked;
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -111,21 +120,27 @@ async function acceptPropagate({ isEqualizated }) {
|
||||||
<VnRow>
|
<VnRow>
|
||||||
<VnSelect
|
<VnSelect
|
||||||
:label="t('Sage tax type')"
|
:label="t('Sage tax type')"
|
||||||
:options="typesTaxes"
|
url="SageTaxTypes"
|
||||||
hide-selected
|
hide-selected
|
||||||
option-label="vat"
|
option-label="vat"
|
||||||
option-value="id"
|
option-value="id"
|
||||||
v-model="data.sageTaxTypeFk"
|
v-model="data.sageTaxTypeFk"
|
||||||
data-cy="sageTaxTypeFk"
|
data-cy="sageTaxTypeFk"
|
||||||
|
:required="isRequired(data)"
|
||||||
|
:rules="[(val) => validations.required(data.sageTaxTypeFk, val)]"
|
||||||
/>
|
/>
|
||||||
<VnSelect
|
<VnSelect
|
||||||
:label="t('Sage transaction type')"
|
:label="t('Sage transaction type')"
|
||||||
:options="typesTransactions"
|
url="SageTransactionTypes"
|
||||||
hide-selected
|
hide-selected
|
||||||
option-label="transaction"
|
option-label="transaction"
|
||||||
option-value="id"
|
option-value="id"
|
||||||
data-cy="sageTransactionTypeFk"
|
data-cy="sageTransactionTypeFk"
|
||||||
v-model="data.sageTransactionTypeFk"
|
v-model="data.sageTransactionTypeFk"
|
||||||
|
:required="isRequired(data)"
|
||||||
|
:rules="[
|
||||||
|
(val) => validations.required(data.sageTransactionTypeFk, val),
|
||||||
|
]"
|
||||||
>
|
>
|
||||||
<template #option="scope">
|
<template #option="scope">
|
||||||
<QItem v-bind="scope.itemProps">
|
<QItem v-bind="scope.itemProps">
|
||||||
|
@ -151,11 +166,11 @@ async function acceptPropagate({ isEqualizated }) {
|
||||||
/>
|
/>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
<VnRow>
|
<VnRow>
|
||||||
<QCheckbox :label="t('Active')" v-model="data.isActive" />
|
<VnCheckbox :label="t('Active')" v-model="data.isActive" />
|
||||||
<QCheckbox :label="t('Frozen')" v-model="data.isFreezed" />
|
<VnCheckbox :label="t('Frozen')" v-model="data.isFreezed" />
|
||||||
</VnRow>
|
</VnRow>
|
||||||
<VnRow>
|
<VnRow>
|
||||||
<QCheckbox :label="t('Has to invoice')" v-model="data.hasToInvoice" />
|
<VnCheckbox :label="t('Has to invoice')" v-model="data.hasToInvoice" />
|
||||||
<VnCheckbox
|
<VnCheckbox
|
||||||
v-model="data.isVies"
|
v-model="data.isVies"
|
||||||
:label="t('globals.isVies')"
|
:label="t('globals.isVies')"
|
||||||
|
@ -164,8 +179,8 @@ async function acceptPropagate({ isEqualizated }) {
|
||||||
</VnRow>
|
</VnRow>
|
||||||
|
|
||||||
<VnRow>
|
<VnRow>
|
||||||
<QCheckbox :label="t('Notify by email')" v-model="data.isToBeMailed" />
|
<VnCheckbox :label="t('Notify by email')" v-model="data.isToBeMailed" />
|
||||||
<QCheckbox
|
<VnCheckbox
|
||||||
:label="t('Invoice by address')"
|
:label="t('Invoice by address')"
|
||||||
v-model="data.hasToInvoiceByAddress"
|
v-model="data.hasToInvoiceByAddress"
|
||||||
/>
|
/>
|
||||||
|
@ -177,16 +192,18 @@ async function acceptPropagate({ isEqualizated }) {
|
||||||
:label="t('Is equalizated')"
|
:label="t('Is equalizated')"
|
||||||
:info="t('inOrderToInvoice')"
|
:info="t('inOrderToInvoice')"
|
||||||
/>
|
/>
|
||||||
<QCheckbox :label="t('Daily invoice')" v-model="data.hasDailyInvoice" />
|
<VnCheckbox :label="t('Daily invoice')" v-model="data.hasDailyInvoice" />
|
||||||
</VnRow>
|
</VnRow>
|
||||||
|
|
||||||
<VnRow>
|
<VnRow>
|
||||||
<QCheckbox
|
<VnCheckbox
|
||||||
:label="t('Electronic invoice')"
|
:label="t('Electronic invoice')"
|
||||||
v-model="data.hasElectronicInvoice"
|
v-model="data.hasElectronicInvoice"
|
||||||
/><QCheckbox
|
/>
|
||||||
|
<VnCheckbox
|
||||||
:label="t('Verified data')"
|
:label="t('Verified data')"
|
||||||
v-model="data.isTaxDataChecked"
|
v-model="data.isTaxDataChecked"
|
||||||
|
@update:model-value="isTaxDataChecked = !isTaxDataChecked"
|
||||||
/>
|
/>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -1,37 +1,53 @@
|
||||||
/// <reference types="cypress" />
|
/// <reference types="cypress" />
|
||||||
|
function checkSageFields(isRequired = false) {
|
||||||
|
const haveAttr = isRequired ? 'have.attr' : 'not.have.attr';
|
||||||
|
cy.dataCy('sageTaxTypeFk').filter('input').should(haveAttr, 'required');
|
||||||
|
cy.dataCy('sageTransactionTypeFk').filter('input').should(haveAttr, 'required');
|
||||||
|
}
|
||||||
describe('Client fiscal data', () => {
|
describe('Client fiscal data', () => {
|
||||||
beforeEach(() => {
|
describe('#1008', () => {
|
||||||
cy.viewport(1280, 720);
|
beforeEach(() => {
|
||||||
cy.login('developer');
|
cy.viewport(1280, 720);
|
||||||
cy.visit('#/customer/1107/fiscal-data');
|
cy.login('developer');
|
||||||
});
|
cy.visit('#/customer/1108/fiscal-data');
|
||||||
it.skip('Should change required value when change customer', () => {
|
});
|
||||||
cy.get('.q-card').should('be.visible');
|
it('Should change required value when change customer', () => {
|
||||||
cy.dataCy('sageTaxTypeFk').filter('input').should('not.have.attr', 'required');
|
cy.get('.q-card').should('be.visible');
|
||||||
cy.get('#searchbar input').clear();
|
checkSageFields();
|
||||||
cy.get('#searchbar input').type('1{enter}');
|
cy.get('[data-cy="vnCheckboxVerified data"]').click();
|
||||||
cy.get('.q-item > .q-item__label').should('have.text', ' #1');
|
checkSageFields(true);
|
||||||
cy.dataCy('sageTaxTypeFk').filter('input').should('have.attr', 'required');
|
cy.get('#searchbar input').clear();
|
||||||
|
cy.get('#searchbar input').type('1{enter}');
|
||||||
|
cy.get('.q-item > .q-item__label').should('have.text', ' #1');
|
||||||
|
checkSageFields();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
describe('#1007', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
cy.viewport(1280, 720);
|
||||||
|
cy.login('developer');
|
||||||
|
cy.visit('#/customer/1107/fiscal-data');
|
||||||
|
});
|
||||||
|
|
||||||
it('check as equalizated', () => {
|
it('check as equalizated', () => {
|
||||||
cy.get(
|
cy.get(
|
||||||
':nth-child(1) > .q-checkbox > .q-checkbox__inner > .q-checkbox__bg',
|
':nth-child(1) > .q-checkbox > .q-checkbox__inner > .q-checkbox__bg',
|
||||||
).click();
|
).click();
|
||||||
cy.get('.q-btn-group > .q-btn--standard > .q-btn__content').click();
|
cy.get('.q-btn-group > .q-btn--standard > .q-btn__content').click();
|
||||||
|
|
||||||
cy.get('.q-card > :nth-child(1) > span').should(
|
cy.get('.q-card > :nth-child(1) > span').should(
|
||||||
'contain',
|
'contain',
|
||||||
'You changed the equalization tax',
|
'You changed the equalization tax',
|
||||||
);
|
);
|
||||||
|
|
||||||
cy.get('.q-card > :nth-child(2) > span').should(
|
cy.get('.q-card > :nth-child(2) > span').should(
|
||||||
'have.text',
|
'have.text',
|
||||||
'Do you want to spread the change?',
|
'Do you want to spread the change?',
|
||||||
);
|
);
|
||||||
cy.get('[data-cy="VnConfirm_confirm"] > .q-btn__content > .block').click();
|
cy.get('[data-cy="VnConfirm_confirm"] > .q-btn__content > .block').click();
|
||||||
cy.get(
|
cy.get(
|
||||||
'.bg-warning > .q-notification__wrapper > .q-notification__content > .q-notification__message',
|
'.bg-warning > .q-notification__wrapper > .q-notification__content > .q-notification__message',
|
||||||
).should('have.text', 'Equivalent tax spreaded');
|
).should('have.text', 'Equivalent tax spreaded');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue