Compare commits

..

21 Commits

Author SHA1 Message Date
Benjamin Esteve bde19f0d4c Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix-front into 7549-autofillWorkerClaimDevelopment
gitea/salix-front/pipeline/pr-dev This commit looks good Details
2025-05-12 12:45:36 +02:00
Benjamin Esteve 9cf7e33afb Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix-front into 7549-autofillWorkerClaimDevelopment
gitea/salix-front/pipeline/pr-dev This commit looks good Details
2025-05-12 11:27:02 +02:00
Benjamin Esteve c3ae161eb0 refactor: refs #7549 optimize claim data retrieval in handleWorker function
gitea/salix-front/pipeline/pr-dev This commit looks good Details
2025-05-09 12:38:41 +02:00
Benjamin Esteve c1b6d96aef Merge branch '7549-autofillWorkerClaimDevelopment' of https://gitea.verdnatura.es/verdnatura/salix-front into 7549-autofillWorkerClaimDevelopment
gitea/salix-front/pipeline/pr-dev This commit looks good Details
2025-05-09 10:43:15 +02:00
Benjamin Esteve 640bc21022 Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix-front into 7549-autofillWorkerClaimDevelopment 2025-05-09 10:43:11 +02:00
Benjamin Esteve f3b06c84a5 Merge branch 'dev' into 7549-autofillWorkerClaimDevelopment
gitea/salix-front/pipeline/pr-dev This commit looks good Details
2025-05-09 08:40:07 +00:00
Benjamin Esteve 02a4960712 Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix-front into 7549-autofillWorkerClaimDevelopment
gitea/salix-front/pipeline/pr-dev This commit looks good Details
2025-05-08 10:38:19 +02:00
Benjamin Esteve 254d5562dd Merge branch '7549-autofillWorkerClaimDevelopment' of https://gitea.verdnatura.es/verdnatura/salix-front into 7549-autofillWorkerClaimDevelopment
gitea/salix-front/pipeline/pr-dev This commit looks good Details
2025-05-08 09:45:25 +02:00
Benjamin Esteve 40899c4c3d fix(ClaimDevelopment): refs #7549 move claim data fetch to after responsible check 2025-05-08 09:45:23 +02:00
Benjamin Esteve 191af3f917 Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix-front into 7549-autofillWorkerClaimDevelopment 2025-05-08 09:08:54 +02:00
Benjamin Esteve b9788bc097 Merge branch 'dev' into 7549-autofillWorkerClaimDevelopment
gitea/salix-front/pipeline/pr-dev This commit looks good Details
2025-05-07 11:32:07 +00:00
Benjamin Esteve a63926ff48 Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix-front into 7549-autofillWorkerClaimDevelopment
gitea/salix-front/pipeline/pr-dev This commit looks good Details
2025-05-07 11:38:03 +02:00
Benjamin Esteve b687c80559 Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix-front into 7549-autofillWorkerClaimDevelopment
gitea/salix-front/pipeline/pr-dev This commit looks good Details
2025-05-07 10:24:39 +02:00
Benjamin Esteve ad178825db fix: refs #7549 update handleWorker to check for commercial responsible by description
gitea/salix-front/pipeline/pr-dev This commit looks good Details
2025-05-07 09:40:53 +02:00
Benjamin Esteve 8eb81fadf3 Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix-front into 7549-autofillWorkerClaimDevelopment
gitea/salix-front/pipeline/pr-dev This commit looks good Details
2025-05-07 09:12:05 +02:00
Benjamin Esteve f351734d84 Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix-front into 7549-autofillWorkerClaimDevelopment
gitea/salix-front/pipeline/pr-dev This commit looks good Details
2025-05-06 11:31:57 +02:00
Benjamin Esteve a6a3d5a3d5 fix: refs #7549 handle null claimResponsibleFk in handleWorker function 2025-05-06 11:31:02 +02:00
Benjamin Esteve 20ca8f8072 Merge branch 'dev' of https: refs #7549//gitea.verdnatura.es/verdnatura/salix-front into 7549-autofillWorkerClaimDevelopment
gitea/salix-front/pipeline/pr-dev This commit looks good Details
2025-05-06 09:20:57 +02:00
Benjamin Esteve 9af63555c3 fix: refs #7549 update handleWorker function to correctly assign workerFk based on claimResponsibleFk
gitea/salix-front/pipeline/pr-dev This commit looks good Details
2025-05-05 14:18:55 +02:00
Benjamin Esteve 50cb0e243b Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix-front into 7549-autofillWorkerClaimDevelopment
gitea/salix-front/pipeline/pr-dev This commit looks good Details
2025-05-05 11:50:18 +02:00
Benjamin Esteve 41e4cc13b1 feat: refs #7549 implement worker selection handling
gitea/salix-front/pipeline/pr-dev This commit looks good Details
2025-05-02 12:28:55 +02:00
7 changed files with 96 additions and 112 deletions

View File

@ -47,9 +47,7 @@ export function useValidator() {
return !validator.isEmpty(value ? String(value) : '') || message;
},
required: (required, value) => {
return required
? value === 0 || !!value || t('globals.fieldRequired')
: null;
return required ? !!value || t('globals.fieldRequired') : null;
},
length: (value) => {
const options = {

View File

@ -7,6 +7,8 @@ import FetchData from 'components/FetchData.vue';
import VnSelect from 'components/common/VnSelect.vue';
import { tMobile } from 'composables/tMobile';
import VnSelectWorker from 'src/components/common/VnSelectWorker.vue';
import axios from 'axios';
import { useArrayData } from 'composables/useArrayData';
const route = useRoute();
@ -19,6 +21,7 @@ const claimResponsibles = ref([]);
const claimRedeliveries = ref([]);
const selected = ref([]);
const saveButtonRef = ref();
const arrayData = useArrayData('Claim');
const developmentsFilter = computed(() => {
return {
@ -105,6 +108,32 @@ const columns = computed(() => [
align: 'left',
},
]);
const handleWorker = async (row) => {
const { claimResponsibleFk } = row;
if (!claimResponsibleFk) {
row.workerFk = null;
return;
}
const commercialResponsible = claimResponsibles?.value?.find(
(responsible) => responsible.description === 'Comerciales',
);
const claim = arrayData.store.data;
if (claimResponsibleFk === commercialResponsible?.id) {
row.workerFk = claim.workerFk;
return;
}
const { data: [responsible] = [] } = await axios.get(
`ClaimDevelopments/${claim.ticketFk}/getResponsible/${claimResponsibleFk}`,
);
row.workerFk = responsible?.userFk ?? null;
};
</script>
<template>
<FetchData
@ -166,6 +195,20 @@ const columns = computed(() => [
input-debounce="0"
hide-selected
/>
<VnSelect
v-else-if="col.name == 'claimResponsible'"
v-model="row[col.model]"
:url="col.url"
:where="col.where"
:sort-by="col.sortBy"
:options="col.options"
:option-value="col.optionValue"
:option-label="col.optionLabel"
@update:modelValue="handleWorker(row)"
:autofocus="col.tabIndex == 1"
input-debounce="0"
hide-selected
/>
<VnSelect
v-else
v-model="row[col.model]"

View File

@ -6,6 +6,7 @@ import { useQuasar } from 'quasar';
import axios from 'axios';
import useNotify from 'src/composables/useNotify.js';
import FetchData from 'components/FetchData.vue';
import FormModel from 'components/FormModel.vue';
import VnRow from 'components/ui/VnRow.vue';
import VnInput from 'src/components/common/VnInput.vue';
@ -20,6 +21,9 @@ const { t } = useI18n();
const route = useRoute();
const { notify } = useNotify();
const typesTaxes = ref([]);
const typesTransactions = ref([]);
function handleLocation(data, location) {
const { town, code, provinceFk, countryFk } = location ?? {};
data.postcode = code;
@ -35,7 +39,6 @@ function onBeforeSave(formData, originalData) {
}
async function checkEtChanges(data, _, originalData) {
isTaxDataChecked.value = data.isTaxDataChecked;
const equalizatedHasChanged = originalData.isEqualizated != data.isEqualizated;
const hasToInvoiceByAddress =
originalData.hasToInvoiceByAddress || data.hasToInvoiceByAddress;
@ -59,18 +62,15 @@ async function acceptPropagate({ isEqualizated }) {
});
notify(t('Equivalent tax spreaded'), 'warning');
}
const isTaxDataChecked = ref(false);
function isRequired({ isTaxDataChecked: taxDataChecked }) {
if (!isTaxDataChecked.value) {
return false;
} else {
return taxDataChecked;
}
}
</script>
<template>
<FetchData auto-load @on-fetch="(data) => (typesTaxes = data)" url="SageTaxTypes" />
<FetchData
auto-load
@on-fetch="(data) => (typesTransactions = data)"
url="SageTransactionTypes"
/>
<FormModel
:url-update="`Clients/${route.params.id}/updateFiscalData`"
auto-load
@ -80,7 +80,6 @@ function isRequired({ isTaxDataChecked: taxDataChecked }) {
@on-data-saved="checkEtChanges"
>
<template #form="{ data, validate, validations }">
{{ isTaxDataChecked }} {{ data.isTaxDataChecked }}
<VnRow>
<VnInput
:label="t('Social name')"
@ -112,27 +111,21 @@ function isRequired({ isTaxDataChecked: taxDataChecked }) {
<VnRow>
<VnSelect
:label="t('Sage tax type')"
url="SageTaxTypes"
:options="typesTaxes"
hide-selected
option-label="vat"
option-value="id"
v-model="data.sageTaxTypeFk"
data-cy="sageTaxTypeFk"
:required="isRequired(data)"
:rules="[(val) => validations.required(data.sageTaxTypeFk, val)]"
/>
<VnSelect
:label="t('Sage transaction type')"
url="SageTransactionTypes"
:options="typesTransactions"
hide-selected
option-label="transaction"
option-value="id"
data-cy="sageTransactionTypeFk"
v-model="data.sageTransactionTypeFk"
:required="isRequired(data)"
:rules="[
(val) => validations.required(data.sageTransactionTypeFk, val),
]"
>
<template #option="scope">
<QItem v-bind="scope.itemProps">
@ -158,11 +151,11 @@ function isRequired({ isTaxDataChecked: taxDataChecked }) {
/>
</VnRow>
<VnRow>
<VnCheckbox :label="t('Active')" v-model="data.isActive" />
<VnCheckbox :label="t('Frozen')" v-model="data.isFreezed" />
<QCheckbox :label="t('Active')" v-model="data.isActive" />
<QCheckbox :label="t('Frozen')" v-model="data.isFreezed" />
</VnRow>
<VnRow>
<VnCheckbox :label="t('Has to invoice')" v-model="data.hasToInvoice" />
<QCheckbox :label="t('Has to invoice')" v-model="data.hasToInvoice" />
<VnCheckbox
v-model="data.isVies"
:label="t('globals.isVies')"
@ -171,8 +164,8 @@ function isRequired({ isTaxDataChecked: taxDataChecked }) {
</VnRow>
<VnRow>
<VnCheckbox :label="t('Notify by email')" v-model="data.isToBeMailed" />
<VnCheckbox
<QCheckbox :label="t('Notify by email')" v-model="data.isToBeMailed" />
<QCheckbox
:label="t('Invoice by address')"
v-model="data.hasToInvoiceByAddress"
/>
@ -184,18 +177,16 @@ function isRequired({ isTaxDataChecked: taxDataChecked }) {
:label="t('Is equalizated')"
:info="t('inOrderToInvoice')"
/>
<VnCheckbox :label="t('Daily invoice')" v-model="data.hasDailyInvoice" />
<QCheckbox :label="t('Daily invoice')" v-model="data.hasDailyInvoice" />
</VnRow>
<VnRow>
<VnCheckbox
<QCheckbox
:label="t('Electronic invoice')"
v-model="data.hasElectronicInvoice"
/>
<VnCheckbox
/><QCheckbox
:label="t('Verified data')"
v-model="data.isTaxDataChecked"
@update:model-value="isTaxDataChecked = !isTaxDataChecked"
/>
</VnRow>
</template>

View File

@ -179,11 +179,6 @@ function handleLocation(data, location) {
data.provinceFk = provinceFk;
data.countryFk = countryFk;
}
function onAgentCreated({ id, fiscalName }, data) {
customsAgents.value.push({ id, fiscalName });
data.customsAgentFk = id;
}
</script>
<template>
@ -297,14 +292,9 @@ function onAgentCreated({ id, fiscalName }, data) {
option-value="id"
v-model="data.customsAgentFk"
:tooltip="t('New customs agent')"
:acls="[{ model: 'CustomsAgent', props: '*', accessType: 'WRITE' }]"
>
<template #form>
<CustomerNewCustomsAgent
@on-data-saved="
(requestResponse) => onAgentCreated(requestResponse, data)
"
/>
<CustomerNewCustomsAgent />
</template>
</VnSelectDialog>
</VnRow>

View File

@ -16,7 +16,6 @@ const onDataSaved = (dataSaved) => {
<template>
<FormModelPopup
:form-initial-data="{}"
:title="t('New customs agent')"
@on-data-saved="onDataSaved($event)"
model="customer"

View File

@ -7,27 +7,7 @@ describe('Client credits', () => {
timeout: 5000,
});
});
it('Should put a new credit', () => {
it('Should load layout', () => {
cy.get('.q-page').should('be.visible');
cy.dataCy('vnTableCreateBtn').click();
cy.dataCy('Credit_input').type('100');
cy.dataCy('FormModelPopup_save').click();
cy.checkNotification('Data saved');
});
it('Should put a new credit with value 0 to close the client card', () => {
cy.get('.q-page').should('be.visible');
cy.dataCy('vnTableCreateBtn').click();
cy.dataCy('Credit_input').type('0');
cy.dataCy('FormModelPopup_save').click();
cy.checkNotification('Data saved');
});
it('Should not create the credit if there is no value in the input', () => {
cy.get('.q-page').should('be.visible');
cy.dataCy('vnTableCreateBtn').click();
cy.dataCy('FormModelPopup_save').click();
cy.get('.q-notification__message').should('not.exist');
});
});

View File

@ -1,39 +1,23 @@
/// <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('#1008', () => {
beforeEach(() => {
cy.viewport(1280, 720);
cy.login('developer');
cy.visit('#/customer/1108/fiscal-data');
});
it('Should change required value when change customer', () => {
cy.get('.q-card').should('be.visible');
checkSageFields();
cy.get('[data-cy="vnCheckboxVerified data"]').click();
cy.get('.q-btn-group > .q-btn--standard > .q-btn__content').click();
checkSageFields();
cy.get('[data-cy="vnCheckboxVerified data"]').click();
checkSageFields(true);
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', () => {
describe('Client fiscal data', { testIsolation: true }, () => {
beforeEach(() => {
cy.viewport(1280, 720);
cy.login('developer');
cy.visit('#/customer/1107/fiscal-data');
});
it.skip('Should change required value when change customer', () => {
cy.get('.q-card').should('be.visible');
cy.dataCy('sageTaxTypeFk').filter('input').should('not.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');
cy.dataCy('sageTaxTypeFk').filter('input').should('have.attr', 'required');
});
it('check as equalizated', () => {
cy.dataCy('vnCheckboxIs equalizated').click();
cy.get(
':nth-child(1) > .q-checkbox > .q-checkbox__inner > .q-checkbox__bg',
).click();
cy.get('.q-btn-group > .q-btn--standard > .q-btn__content').click();
cy.get('.q-card > :nth-child(1) > span').should(
@ -51,4 +35,3 @@ describe('Client fiscal data', () => {
).should('have.text', 'Equivalent tax spreaded');
});
});
});