Merge branch 'dev' into 8041-unifyClassLink
gitea/salix-front/pipeline/pr-dev This commit looks good Details

This commit is contained in:
BENJAMIN ESTEVE DIAZ CANO 2025-03-10 12:42:52 +00:00
commit 9e1ea248b4
25 changed files with 198 additions and 59 deletions

2
Jenkinsfile vendored
View File

@ -123,7 +123,7 @@ pipeline {
sh "docker-compose ${env.COMPOSE_PARAMS} up -d"
image.inside("--network ${env.COMPOSE_PROJECT}_default -e CI -e TZ --init") {
sh 'sh test/cypress/cypressParallel.sh 3'
sh 'sh test/cypress/cypressParallel.sh 2'
}
}
}

View File

@ -1136,9 +1136,13 @@ es:
.grid-create {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(150px, max-content));
grid-template-columns: 1fr 1fr;
max-width: 100%;
grid-gap: 20px;
margin: 0 auto;
.col-span-2 {
grid-column: span 2;
}
}
.flex-one {

View File

@ -149,14 +149,12 @@ const columns = computed(() => [
:right-search="false"
>
<template #more-create-dialog="{ data }">
<QCardSection>
<VnInputPassword
:label="t('Password')"
v-model="data.password"
:required="true"
autocomplete="new-password"
/>
</QCardSection>
</template>
</VnTable>
</template>

View File

@ -16,7 +16,6 @@ const filter = {
{ relation: 'mandateType', scope: { fields: ['id', 'code'] } },
{ relation: 'company', scope: { fields: ['id', 'code'] } },
],
where: { clientFk: route.params.id },
order: ['created DESC'],
limit: 20,
};
@ -65,7 +64,8 @@ const columns = computed(() => [
<VnTable
data-key="Mandates"
url="Mandates"
:filter="filter"
:user-filter="filter"
:filter="{ where: { clientFk: route.params.id } }"
auto-load
:columns="columns"
class="full-width q-mt-md"

View File

@ -146,9 +146,8 @@ async function deleteEntry() {
<template>
<CardDescriptor
ref="entryDescriptorRef"
:url="`Entries/${entityId}`"
:userFilter="entryFilter"
:filter="entryFilter"
title="supplier.nickname"
data-key="Entry"
width="lg-width"

View File

@ -283,7 +283,11 @@ onBeforeMount(async () => {
</script>
<template>
<VnSection :data-key="dataKey" prefix="entry">
<VnSection
:data-key="dataKey"
prefix="entry"
:array-data-props="{ url: 'Entries/filter' }"
>
<template #advanced-menu>
<EntryFilter :data-key="dataKey" />
</template>

View File

@ -230,7 +230,7 @@ watchEffect(selectedRows);
</span>
</template>
<template #more-create-dialog="{ data }">
<div class="row q-col-gutter-xs">
<div class="row q-col-gutter-xs col-span-2">
<div class="col-12">
<div class="q-col-gutter-xs">
<VnRow fixed>

View File

@ -156,9 +156,7 @@ const columns = computed(() => [
onMounted(async () => {
if (!route.query) return;
if (route.query?.createForm) {
const query = JSON.parse(route.query?.createForm);
formInitialData.value = query;
await onClientSelected({ ...formInitialData.value, clientFk: query?.clientFk });
await onClientSelected(JSON.parse(route.query?.createForm));
} else if (route.query?.table) {
const query = JSON.parse(route.query?.table);
const clientFk = query?.clientFk;
@ -177,7 +175,6 @@ watch(
tableRef.value.create.formInitialData = formInitialData.value;
}
},
{ immediate: true },
);
async function onClientSelected({ clientFk }, formData = {}) {
@ -191,13 +188,17 @@ async function onClientSelected({ clientFk }, formData = {}) {
addressOptions.value = data;
formData.defaultAddressFk = data[0].client.defaultAddressFk;
formData.addressId = formData.defaultAddressFk;
formInitialData.value = { addressId: formData.addressId, clientFk };
formInitialData.value = { ...formData, clientFk };
await fetchAgencies(formData);
}
async function fetchAgencies({ landed, addressId }) {
if (!landed || !addressId) return (agencyList.value = []);
async function fetchAgencies(formData) {
const { landed, addressId } = formData;
if (!landed || !addressId) {
formData.defaultAddressFk = formInitialData.value.defaultAddressFk;
return (agencyList.value = []);
}
const { data } = await axios.get('Agencies/landsThatDay', {
params: {
@ -220,6 +221,11 @@ const getDateColor = (date) => {
if (difference == 0) return 'bg-warning';
if (difference < 0) return 'bg-success';
};
const isDefaultAddress = (opt, data) => {
const addressId = data.defaultAddressFk ?? data.addressId;
return addressId === opt.id && opt.isActive;
};
</script>
<template>
@ -310,10 +316,7 @@ const getDateColor = (date) => {
>
<QItemSection style="min-width: min-content" avatar>
<QIcon
v-if="
scope.opt.isActive &&
data.defaultAddressFk === scope.opt.id
"
v-if="isDefaultAddress(scope.opt, data)"
size="sm"
color="grey"
name="star"

View File

@ -172,6 +172,7 @@ const filterColumns = computed(() => {
>
<template #more-create-dialog="{ data }">
<VnInput
class="col-span-2"
:label="t('globals.name')"
v-model="data.socialName"
:uppercase="true"

View File

@ -54,8 +54,7 @@ onBeforeMount(() => {
onMounted(async () => {
if (!route.query) return;
if (route.query?.createForm) {
formInitialData.value = JSON.parse(route.query?.createForm);
await onClientSelected(formInitialData.value);
await onClientSelected(JSON.parse(route.query?.createForm));
} else if (route.query?.table) {
const query = route.query?.table;
const clientId = +JSON.parse(query)?.clientFk;
@ -273,12 +272,18 @@ const fetchAddresses = async (formData) => {
return;
}
const { data } = await getAddresses(formData.clientId);
formInitialData.value = { clientId: formData.clientId };
if (!data) return;
if (!data) {
formInitialData.value = { clientId: formData.clientId };
return;
}
addressesOptions.value = data;
selectedClient.value = data[0].client;
formData.addressId = selectedClient.value.defaultAddressFk;
formInitialData.value.addressId = formData.addressId;
formInitialData.value = {
clientId: formData.clientId,
addressId: formData.addressId,
};
};
watch(
() => route.query.table,

View File

@ -96,6 +96,7 @@ async function setAdvancedSummary(data) {
option-label="name"
option-value="code"
v-model="data.maritalStatus"
data-cy="MaritalStatus"
/>
</VnRow>
@ -107,6 +108,7 @@ async function setAdvancedSummary(data) {
option-label="name"
option-value="id"
v-model="data.originCountryFk"
data-cy="country"
/>
<VnSelect
:label="t('Education level')"
@ -132,7 +134,7 @@ async function setAdvancedSummary(data) {
<VnInputDate :label="t('seniority')" v-model="data.seniority" />
</VnRow>
<VnRow>
<VnInput v-model="data.fi" :label="t('fi')" />
<VnInput v-model="data.fi" :label="t('fi')" data-cy="fi" />
<VnInputDate :label="t('birth')" v-model="data.birth" />
</VnRow>
<VnRow wrap>

View File

@ -98,12 +98,14 @@ watch(
<VnInput
:label="t('worker.operator.numberOfWagons')"
v-model="row.numberOfWagons"
data-cy="numberOfWagons"
/>
<VnSelect
:label="t('worker.operator.train')"
:options="trainsData"
hide-selected
v-model="row.trainFk"
data-cy="train"
:required="true"
/>
</VnRow>
@ -116,6 +118,7 @@ watch(
option-value="code"
v-model="row.itemPackingTypeFk"
:required="true"
data-cy="itemPackingType"
/>
<VnSelect
:label="t('worker.operator.warehouse')"
@ -123,6 +126,7 @@ watch(
hide-selected
v-model="row.warehouseFk"
:required="true"
data-cy="warehouse"
/>
</VnRow>
<VnRow>
@ -132,6 +136,7 @@ watch(
hide-selected
option-label="description"
v-model="row.sectorFk"
data-cy="sector"
/>
<VnSelect
:label="t('worker.operator.labeler')"
@ -139,6 +144,7 @@ watch(
hide-selected
option-label="name"
v-model="row.labelerFk"
data-cy="labeler"
>
<template #option="scope">
<QItem v-bind="scope.itemProps">
@ -160,11 +166,13 @@ watch(
:label="t('worker.operator.linesLimit')"
v-model="row.linesLimit"
lazy-rules
data-cy="linesLimit"
/>
<VnInput
:label="t('worker.operator.volumeLimit')"
v-model="row.volumeLimit"
lazy-rules
data-cy="volumeLimit"
/>
</VnRow>
<VnRow>
@ -172,6 +180,7 @@ watch(
:label="t('worker.operator.sizeLimit')"
v-model="row.sizeLimit"
lazy-rules
data-cy="sizeLimit"
/>
<VnInput
:label="t('worker.operator.isOnReservationMode')"

View File

@ -68,8 +68,14 @@ const deleteRelative = async (id) => {
:label="t('familySituation')"
clearable
v-model="data.familySituation"
data-cy="familySituation"
/>
<VnInput
:label="t('spouseNif')"
clearable
v-model="data.spouseNif"
data-cy="spouseNif"
/>
<VnInput :label="t('spouseNif')" clearable v-model="data.spouseNif" />
</VnRow>
<VnRow>
<VnSelect
@ -93,11 +99,13 @@ const deleteRelative = async (id) => {
clearable
v-model="data.childPension"
:label="t(`childPension`)"
data-cy="childPension"
/>
<VnInput
clearable
v-model="data.spousePension"
:label="t(`spousePension`)"
data-cy="spousePension"
/>
</VnRow>
<VnRow wrap>
@ -190,12 +198,14 @@ const deleteRelative = async (id) => {
type="number"
v-model="row.birthed"
:label="t(`birthed`)"
data-cy="birthed"
/>
<VnInput
type="number"
v-model="row.adoptionYear"
:label="t(`adoptionYear`)"
data-cy="adoptionYear"
/>
<QCheckbox
v-model="row.isDependend"

View File

@ -53,7 +53,7 @@ const title = computed(() => (isEditMode.value ? t('Edit entry') : t('Add time')
const urlCreate = computed(() =>
isEditMode.value
? `WorkerTimeControls/${$props.entryId}/updateTimeEntry`
: `WorkerTimeControls/${route.params.id}/addTimeEntry`
: `WorkerTimeControls/${route.params.id}/addTimeEntry`,
);
onBeforeMount(() => {
@ -83,6 +83,7 @@ onBeforeMount(() => {
autofocus
:required="true"
:is-clearable="false"
data-cy="entryHour"
/>
<VnSelect
:label="t('Type')"
@ -91,6 +92,7 @@ onBeforeMount(() => {
option-value="code"
option-label="description"
hide-selected
data-cy="entryType"
/>
</template>
</FormModelPopup>

View File

@ -223,7 +223,7 @@ async function autofillBic(worker) {
:right-search="false"
>
<template #more-create-dialog="{ data }">
<div class="q-pa-lg full-width">
<div class="col-span-2">
<VnRadio
v-model="data.isFreelance"
:val="false"

View File

@ -34,8 +34,8 @@ describe('OrderList', () => {
cy.dataCy('Customer ID_input').type('1101{enter}');
cy.dataCy('vnTableCreateBtn').click();
cy.dataCy('landedDate').find('input').type('06/01/2001');
cy.get(agencyCreateSelect).click();
cy.get('.q-menu > div> .q-item:nth-child(1)').click();
cy.selectOption(agencyCreateSelect, 1);
cy.intercept('GET', /\/api\/Orders\/\d/).as('orderSale');
cy.get('[data-cy="FormModelPopup_save"] > .q-btn__content > .block').click();
cy.wait('@orderSale');
@ -60,8 +60,8 @@ describe('OrderList', () => {
cy.get(clientCreateSelect).should('have.value', 'Bruce Wayne');
cy.get(addressCreateSelect).should('have.value', 'Bruce Wayne');
cy.dataCy('landedDate').find('input').type('06/01/2001');
cy.get(agencyCreateSelect).click();
cy.get('.q-menu > div> .q-item:nth-child(1)').click();
cy.selectOption(agencyCreateSelect, 1);
cy.intercept('GET', /\/api\/Orders\/\d/).as('orderSale');
cy.get('[data-cy="FormModelPopup_save"] > .q-btn__content > .block').click();
cy.wait('@orderSale');

View File

@ -139,7 +139,7 @@ describe.skip('Ticket Lack detail', () => {
cy.wait('@getItemGetSimilar');
});
describe('Replace item if', () => {
it('Quantity is less than available', () => {
it.skip('Quantity is less than available', () => {
cy.get(':nth-child(1) > .text-right > .q-btn').click();
});
});

View File

@ -38,8 +38,8 @@ describe('TicketList', () => {
it('filter client and create ticket', () => {
cy.intercept('GET', /\/api\/Tickets\/filter/).as('ticketSearchbar');
searchResults();
cy.wait('@ticketSearchbar');
cy.intercept('GET', /\/api\/Tickets\/filter/).as('ticketFilter');
cy.dataCy('Customer ID_input').clear('1');
cy.dataCy('Customer ID_input').type('1101{enter}');

View File

@ -0,0 +1,15 @@
describe('WorkerBasicData', () => {
beforeEach(() => {
cy.viewport(1280, 720);
cy.login('developer');
cy.visit('/#/worker/1107/basic-data');
});
it('should modify worker summary', () => {
cy.dataCy('MaritalStatus').type('Married');
cy.dataCy('fi').type('42572374H');
cy.dataCy('country').type('Alemania');
cy.saveCard();
cy.checkNotification('Data saved');
});
});

View File

@ -0,0 +1,34 @@
describe('WorkerBusiness', () => {
const saveBtn = '.q-mt-lg > .q-btn--standard';
const contributionCode = `Representantes de comercio`;
const contractType = `INDEFINIDO A TIEMPO COMPLETO`;
const Business = {
'Start Date': { val: '26-12-2002', type: 'date' },
Company: { val: `VNL`, type: 'select' },
Department: { val: `RECICLAJE`, type: 'select' },
'Professional Category': { val: `employee`, type: 'select' },
'Work Calendar': { val: `General schedule`, type: 'select' },
'Work Center': { val: `Silla`, type: 'select' },
'Contract Category': { val: `INFORMATICA`, type: 'select' },
'Contribution Code': { val: contributionCode, type: 'select' },
Rate: { val: `5` },
'Contract Type': { val: contractType, type: 'select' },
'Transport Workers Salary': { val: `1000` },
};
beforeEach(() => {
cy.viewport(1280, 720);
cy.login('hr');
cy.visit('/#/worker/1107/business');
cy.addCard();
});
it('should create a business', () => {
cy.fillInForm({
...Business,
});
cy.get(saveBtn).click();
cy.checkNotification('Data created');
});
});

View File

@ -0,0 +1,23 @@
/// <reference types="cypress" />
describe('WorkerMutual', () => {
const userId = 1106;
const saveBtn = '.q-mt-lg > .q-btn--standard';
const medicalReview = {
Date: { val: '01-01-2001', type: 'date' },
'Formation Center': { val: '1', type: 'select' },
Invoice: { val: '24532' },
Amount: { val: '540' },
};
beforeEach(() => {
cy.viewport(1280, 720);
cy.login('developer');
cy.visit(`/#/worker/${userId}/medical`);
cy.addCard();
});
it('should create a medical Review', () => {
cy.fillInForm(medicalReview);
cy.get(saveBtn).click();
cy.checkNotification('Data created');
});
});

View File

@ -0,0 +1,13 @@
/// <reference types="cypress" />
describe('WorkerNotes', () => {
const userId = 1106;
beforeEach(() => {
cy.viewport(1280, 720);
cy.login('developer');
cy.visit(`/#/worker/${userId}/notes`);
});
it('Should load layout', () => {
cy.get('.q-card').should('be.visible');
});
});

View File

@ -0,0 +1,19 @@
/// <reference types="cypress" />
describe('WorkerOperator', () => {
const userId = 1106;
beforeEach(() => {
cy.viewport(1280, 720);
cy.login('hr');
cy.visit(`/#/worker/${userId}/operator`);
});
it('should fill the operator form', () => {
cy.dataCy('numberOfWagons').type('4');
cy.dataCy('linesLimit').type('6');
cy.dataCy('volumeLimit').type('3');
cy.dataCy('sizeLimit').type('3');
cy.saveCard();
cy.checkNotification('Data saved');
});
});

View File

@ -1,19 +1,5 @@
describe('WorkerPit', () => {
const familySituationInput = '[data-cy="Family Situation_input"]';
const familySituation = '1';
const childPensionInput = '[data-cy="Child Pension_input"]';
const childPension = '120';
const spouseNifInput = '[data-cy="Spouse Pension_input"]';
const spouseNif = '65117125P';
const spousePensionInput = '[data-cy="Spouse Pension_input"]';
const spousePension = '120';
const addRelative = '[data-cy="addRelative"]';
const isDescendantSelect = '[data-cy="Descendant/Ascendant"]';
const Descendant = 'Descendiente';
const birthedInput = '[data-cy="Birth Year_input"]';
const birthed = '2002';
const adoptionYearInput = '[data-cy="Adoption Year_input"]';
const adoptionYear = '2004';
const saveRelative = '[data-cy="workerPitRelativeSaveBtn"]';
const savePIT = '#st-actions > .q-btn-group > .q-btn--standard';
@ -24,15 +10,15 @@ describe('WorkerPit', () => {
});
it('complete PIT', () => {
cy.get(familySituationInput).type(familySituation);
cy.get(childPensionInput).type(childPension);
cy.get(spouseNifInput).type(spouseNif);
cy.get(spousePensionInput).type(spousePension);
cy.dataCy('familySituation').type('1');
cy.dataCy('childPension').type('120');
cy.dataCy('spouseNif').type('65117125P');
cy.dataCy('spousePension').type('120');
cy.get(savePIT).click();
cy.get(addRelative).click();
cy.get(isDescendantSelect).type(Descendant);
cy.get(birthedInput).type(birthed);
cy.get(adoptionYearInput).type(adoptionYear);
cy.dataCy('Descendant/Ascendant').type('Descendiente');
cy.dataCy('birthed').type('2002');
cy.dataCy('adoptionYear').type('2004');
cy.get(saveRelative).click();
});
});

View File

@ -1,4 +1,6 @@
describe('WorkerSummary', () => {
const departmentDescriptor = ':nth-child(1) > :nth-child(3) > .value > .link';
const roleDescriptor = ':nth-child(3) > :nth-child(4) > .value > .link';
beforeEach(() => {
cy.viewport(1280, 720);
cy.login('developer');
@ -10,7 +12,17 @@ describe('WorkerSummary', () => {
cy.get('.summaryHeader > div').should('have.text', '19 - salesboss salesboss');
cy.get(':nth-child(1) > :nth-child(2) > .value > span').should(
'have.text',
'salesBossNick'
'salesBossNick',
);
});
it('should try descriptors', () => {
cy.waitForElement('.summaryHeader');
cy.get(departmentDescriptor).click();
cy.get('.descriptor').should('be.visible');
cy.get('.q-item > .q-item__label').should('include.text', '43');
cy.get(roleDescriptor).click();
cy.get('.descriptor').should('be.visible');
cy.get('.q-item > .q-item__label').should('include.text', '19');
});
});