Ticket #{{ entity.id }} - {{ entity.client?.name }} ({{
@@ -112,7 +126,7 @@ function toTicketUrl(section) {
ref="stateBtnDropdownRef"
color="black"
text-color="white"
- :label="t('ticket.summary.changeState')"
+ :label="t('globals.changeState')"
:disable="!isEditable()"
>
[
]);
const applyVolumes = async (salesData) => {
- try {
- if (!salesData.length) return;
+ if (!salesData.length) return;
- sales.value = salesData;
- const ticket = sales.value[0].ticketFk;
- const { data } = await axios.get(`Tickets/${ticket}/getVolume`);
- const volumes = new Map(data.saleVolume.map((volume) => [volume.saleFk, volume]));
+ sales.value = salesData;
+ const ticket = sales.value[0].ticketFk;
+ const { data } = await axios.get(`Tickets/${ticket}/getVolume`);
+ const volumes = new Map(data.saleVolume.map((volume) => [volume.saleFk, volume]));
- sales.value.forEach((sale) => {
- sale.saleVolume = volumes.get(sale.id);
- });
+ sales.value.forEach((sale) => {
+ sale.saleVolume = volumes.get(sale.id);
+ });
- packingTypeVolume.value = data.packingTypeVolume;
- } catch (error) {
- console.error(error);
- }
+ packingTypeVolume.value = data.packingTypeVolume;
};
onMounted(() => (stateStore.rightDrawer = true));
diff --git a/src/pages/Ticket/TicketAdvance.vue b/src/pages/Ticket/TicketAdvance.vue
index 43b500dc0..bdd980c07 100644
--- a/src/pages/Ticket/TicketAdvance.vue
+++ b/src/pages/Ticket/TicketAdvance.vue
@@ -1,24 +1,19 @@
+watch(
+ () => vnTableRef.value.tableRef?.$el,
+ ($el) => {
+ if (!$el) return;
+ const head = $el.querySelector('thead');
+ const firstRow = $el.querySelector('thead > tr');
+ const newRow = document.createElement('tr');
+ destinationElRef.value = document.createElement('th');
+ originElRef.value = document.createElement('th');
+
+ newRow.classList.add('bg-header');
+ destinationElRef.value.classList.add('text-uppercase', 'color-vn-label');
+ originElRef.value.classList.add('text-uppercase', 'color-vn-label');
+
+ destinationElRef.value.setAttribute('colspan', '7');
+ originElRef.value.setAttribute('colspan', '9');
+
+ destinationElRef.value.textContent = `${t(
+ 'advanceTickets.destination'
+ )} ${toDateFormat(vnTableRef.value.params.dateToAdvance)}`;
+ originElRef.value.textContent = `${t('advanceTickets.origin')} ${toDateFormat(
+ vnTableRef.value.params.dateFuture
+ )}`;
+
+ newRow.append(destinationElRef.value, originElRef.value);
+ head.insertBefore(newRow, firstRow);
+ },
+ { once: true, inmmediate: true }
+);
+
+watch(
+ () => vnTableRef.value.params,
+ () => {
+ if (originElRef.value && destinationElRef.value) {
+ destinationElRef.value.textContent = `${t(
+ 'advanceTickets.destination'
+ )} ${toDateFormat(vnTableRef.value.params.dateToAdvance)}`;
+ originElRef.value.textContent = `${t('advanceTickets.origin')} ${toDateFormat(
+ vnTableRef.value.params.dateFuture
+ )}`;
+ }
+ },
+ { deep: true }
+);
+
{
auto-load
@on-fetch="(data) => (zonesOptions = data)"
/>
-
{
-
+
-
-
- {{ userParams.scopeDays }}
-
-
- {{ t('advanceTickets.destination') }}
- {{ toDateFormat(userParams.dateToAdvance) }}
-
-
- {{ t('advanceTickets.origin') }}
- {{ toDateFormat(userParams.dateFuture) }}
-
-
-
-
-
-
-
- {{ col.label }}
-
-
+
+
+
+
+ {{
+ t('advanceTickets.originAgency', {
+ agency: row.futureAgency,
+ })
+ }}
+
+
+ {{
+ t('advanceTickets.destinationAgency', {
+ agency: row.agency,
+ })
+ }}
+
+
+
-
-
-
-
-
-
-
+
+
+ {{ row.id }}
+
+
-
-
- {{ col.label }}
-
+
+
+ {{ row.state }}
+
+ {{ dashIfEmpty(row.state) }}
-
-
-
-
-
- {{
- t('advanceTickets.originAgency', {
- agency: row.futureAgency,
- })
- }}
-
-
- {{
- t('advanceTickets.destinationAgency', {
- agency: row.agency,
- })
- }}
-
-
-
-
+
+
+ {{ toCurrency(row.totalWithVat || 0) }}
+
-
-
-
-
- {{ row.id }}
-
-
-
+
+
+ {{ row.futureId }}
+
+
-
-
-
- {{ row.state }}
-
- {{ dashIfEmpty(row.state) }}
-
+
+
+ {{ row.futureState }}
+
-
-
-
- {{ toCurrency(row.totalWithVat || 0) }}
-
-
+
+
+ {{ toCurrency(row.futureTotalWithVat || 0) }}
+
-
-
-
- {{ row.futureId }}
-
-
-
-
-
-
-
- {{ row.futureState }}
-
-
-
-
-
-
- {{ toCurrency(row.futureTotalWithVat || 0) }}
-
-
-
-
+
{
diff --git a/src/pages/Ticket/TicketAdvanceFilter.vue b/src/pages/Ticket/TicketAdvanceFilter.vue
index b25ebdea6..a1d301f35 100644
--- a/src/pages/Ticket/TicketAdvanceFilter.vue
+++ b/src/pages/Ticket/TicketAdvanceFilter.vue
@@ -11,7 +11,7 @@ import axios from 'axios';
import { onMounted } from 'vue';
import VnInputNumber from 'src/components/common/VnInputNumber.vue';
-const { t } = useI18n();
+const { t, te } = useI18n();
const props = defineProps({
dataKey: {
type: String,
@@ -27,20 +27,21 @@ const warehousesOptions = ref([]);
const itemPackingTypes = ref([]);
const getItemPackingTypes = async () => {
- try {
- const filter = {
- where: { isActive: true },
- };
- const { data } = await axios.get('ItemPackingTypes', {
- params: { filter: JSON.stringify(filter) },
- });
- itemPackingTypes.value = data.map((ipt) => ({
- description: t(ipt.description),
- code: ipt.code,
- }));
- } catch (error) {
- console.error(error);
- }
+ const filter = {
+ where: { isActive: true },
+ };
+ const { data } = await axios.get('ItemPackingTypes', {
+ params: { filter: JSON.stringify(filter) },
+ });
+ itemPackingTypes.value = data.map((ipt) => ({
+ description: t(ipt.description),
+ code: ipt.code,
+ }));
+};
+
+const getLocale = (val) => {
+ const param = `params.${val}`;
+ return te(param) ? t(param) : t(`globals.${param}`);
};
onMounted(async () => await getItemPackingTypes());
@@ -53,6 +54,7 @@ onMounted(async () => await getItemPackingTypes());
auto-load
/>
await getItemPackingTypes());
>
- {{ t(`params.${tag.label}`) }}:
+ {{ getLocale(tag.label) }}:
{{ formatFn(tag.value) }}
@@ -96,6 +98,7 @@ onMounted(async () => await getItemPackingTypes());
dense
outlined
rounded
+ :use-like="false"
>
@@ -113,6 +116,7 @@ onMounted(async () => await getItemPackingTypes());
dense
outlined
rounded
+ :use-like="false"
>
@@ -136,6 +140,19 @@ onMounted(async () => await getItemPackingTypes());
/>
+
+
+
+
+
{
+ for (const state of data) {
+ groupedStates.value.push({
+ id: state.id,
+ name: t(`${state.code}`),
+ code: state.code,
+ });
+ }
+};
(provinces = data)" auto-load />
(states = data)" auto-load />
+ {
+ getGroupedStates(data);
+ }
+ "
+ auto-load
+ />
(agencies = data)" auto-load />
(warehouses = data)" auto-load />
@@ -90,12 +110,35 @@ const warehouses = ref([]);
option-label="name"
emit-value
map-options
+ use-input
dense
outlined
rounded
/>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -245,6 +309,11 @@ en:
provinceFk: Province
agencyModeFk: Agency
warehouseFk: Warehouse
+ FREE: Free
+ ON_PREPARATION: On preparation
+ PACKED: Packed
+ DELIVERED: Delivered
+ ON_PREVIOUS: ON_PREVIOUS
es:
params:
search: Contiene
@@ -278,4 +347,12 @@ es:
Yes: Si
No: No
Days onward: Días adelante
+ Grouped state: Estado agrupado
+ FREE: Libre
+ ON_PREPARATION: En preparación
+ PACKED: Encajado
+ DELIVERED: Servido
+ ON_PREVIOUS: ON_PREVIOUS
+ Collection: Colección
+ Nickname: Nombre mostrado
diff --git a/src/pages/Ticket/TicketFutureFilter.vue b/src/pages/Ticket/TicketFutureFilter.vue
index 6345f62b3..ffe967272 100644
--- a/src/pages/Ticket/TicketFutureFilter.vue
+++ b/src/pages/Ticket/TicketFutureFilter.vue
@@ -24,33 +24,25 @@ const itemPackingTypes = ref([]);
const stateOptions = ref([]);
const getItemPackingTypes = async () => {
- try {
- const filter = {
- where: { isActive: true },
- };
- const { data } = await axios.get('ItemPackingTypes', {
- params: { filter: JSON.stringify(filter) },
- });
- itemPackingTypes.value = data.map((ipt) => ({
- description: t(ipt.description),
- code: ipt.code,
- }));
- } catch (error) {
- console.error(error);
- }
+ const filter = {
+ where: { isActive: true },
+ };
+ const { data } = await axios.get('ItemPackingTypes', {
+ params: { filter: JSON.stringify(filter) },
+ });
+ itemPackingTypes.value = data.map((ipt) => ({
+ description: t(ipt.description),
+ code: ipt.code,
+ }));
};
const getGroupedStates = async () => {
- try {
- const { data } = await axios.get('AlertLevels');
- stateOptions.value = data.map((state) => ({
- id: state.id,
- name: t(`futureTickets.${state.code}`),
- code: state.code,
- }));
- } catch (error) {
- console.error(error);
- }
+ const { data } = await axios.get('AlertLevels');
+ stateOptions.value = data.map((state) => ({
+ id: state.id,
+ name: t(`futureTickets.${state.code}`),
+ code: state.code,
+ }));
};
onMounted(async () => {
diff --git a/src/pages/Ticket/TicketList.vue b/src/pages/Ticket/TicketList.vue
index fe9667bea..dd1f2d69a 100644
--- a/src/pages/Ticket/TicketList.vue
+++ b/src/pages/Ticket/TicketList.vue
@@ -204,7 +204,7 @@ const columns = computed(() => [
action: (row) => redirectToLines(row.id),
},
{
- title: t('ticketList.summary'),
+ title: t('components.smartCard.viewSummary'),
icon: 'preview',
isPrimary: true,
action: (row) => viewSummary(row.id, TicketSummary),
@@ -550,7 +550,7 @@ function setReference(data) {
- {{ dashIfEmpty(row.salesPerson) }}
+ {{ dashIfEmpty(row.userName) }}
diff --git a/src/pages/Ticket/locale/es.yml b/src/pages/Ticket/locale/es.yml
index b372e48ef..eab38a402 100644
--- a/src/pages/Ticket/locale/es.yml
+++ b/src/pages/Ticket/locale/es.yml
@@ -100,7 +100,7 @@ weeklyTickets:
advanceTickets:
preparation: Preparación
origin: Origen
- destination: Destinatario
+ destination: Destino
originAgency: 'Agencia origen: {agency}'
destinationAgency: 'Agencia destino: {agency}'
ticketId: ID
diff --git a/src/pages/Worker/Card/WorkerBasicData.vue b/src/pages/Worker/Card/WorkerBasicData.vue
index d131fea3e..6a13e3f39 100644
--- a/src/pages/Worker/Card/WorkerBasicData.vue
+++ b/src/pages/Worker/Card/WorkerBasicData.vue
@@ -1,5 +1,5 @@
-
{
+ Object.assign(data, advancedSummary);
+ }
+ "
>
@@ -134,7 +130,7 @@ const workerFilter = {
-
+
{
-
+
diff --git a/src/pages/Worker/Card/WorkerLocker.vue b/src/pages/Worker/Card/WorkerLocker.vue
index 4a19e472c..015bced35 100644
--- a/src/pages/Worker/Card/WorkerLocker.vue
+++ b/src/pages/Worker/Card/WorkerLocker.vue
@@ -18,7 +18,7 @@ const { store } = useArrayData('Worker');
const entityId = computed(() => useRoute().params.id);
const filter = computed(() => ({
where: {
- gender: store.data?.sex,
+ gender: store.data?.[0]?.sex,
or: [{ workerFk: null }, { workerFk: entityId.value }],
},
}));
@@ -51,6 +51,7 @@ const init = async (data) => {
>
$props.id || route.params.id);
const basicDataUrl = ref(null);
-const isHr = computed(() => useRole().hasAny(['hr']));
const advancedSummary = ref();
onBeforeMount(async () => {
- if (isHr.value) {
- advancedSummary.value = (
- await axios.get('Workers/advancedSummary', {
- params: { filter: { where: { id: entityId.value } } },
- })
- ).data[0];
- basicDataUrl.value = `#/worker/${entityId.value}/basic-data`;
- }
+ advancedSummary.value = await useAdvancedSummary('Workers', entityId.value);
+ basicDataUrl.value = `#/worker/${entityId.value}/basic-data`;
});
@@ -45,7 +37,7 @@ onBeforeMount(async () => {
ref="summary"
:url="`Workers/summary`"
:filter="{ where: { id: entityId } }"
- data-key="WorkerSummary"
+ data-key="Worker"
>
{{ entity.id }} - {{ entity.firstName }} {{ entity.lastName }}
@@ -101,21 +93,27 @@ onBeforeMount(async () => {
:label="t('worker.summary.seniority')"
:value="toDate(worker.seniority)"
/>
-
-
+
+
+
-
diff --git a/src/pages/Worker/WorkerList.vue b/src/pages/Worker/WorkerList.vue
index 7a3f760bc..022cecdc6 100644
--- a/src/pages/Worker/WorkerList.vue
+++ b/src/pages/Worker/WorkerList.vue
@@ -169,7 +169,7 @@ async function autofillBic(worker) {
@@ -191,13 +191,13 @@ async function autofillBic(worker) {
/>
-
+
+describe('Client consignee', () => {
+ beforeEach(() => {
+ cy.viewport(1280, 720);
+ cy.login('developer');
+ cy.visit('#/customer/1110/address', {
+ timeout: 5000,
+ });
+ });
+ it('Should load layout', () => {
+ cy.get('.q-card').should('be.visible');
+ });
+});
diff --git a/test/cypress/integration/client/clientBalance.spec.js b/test/cypress/integration/client/clientBalance.spec.js
new file mode 100644
index 000000000..dfba56b16
--- /dev/null
+++ b/test/cypress/integration/client/clientBalance.spec.js
@@ -0,0 +1,13 @@
+///
+describe('Client balance', () => {
+ beforeEach(() => {
+ cy.viewport(1280, 720);
+ cy.login('developer');
+ cy.visit('#/customer/1101/balance', {
+ timeout: 5000,
+ });
+ });
+ it('Should load layout', () => {
+ cy.get('.q-page').should('be.visible');
+ });
+});
diff --git a/test/cypress/integration/client/clientBasicData.spec.js b/test/cypress/integration/client/clientBasicData.spec.js
new file mode 100644
index 000000000..7b0a19828
--- /dev/null
+++ b/test/cypress/integration/client/clientBasicData.spec.js
@@ -0,0 +1,13 @@
+///
+describe('Client basic data', () => {
+ beforeEach(() => {
+ cy.viewport(1280, 720);
+ cy.login('developer');
+ cy.visit('#/customer/1110/basic-data', {
+ timeout: 5000,
+ });
+ });
+ it('Should load layout', () => {
+ cy.get('.q-card').should('be.visible');
+ });
+});
diff --git a/test/cypress/integration/client/clientBillingData.spec.js b/test/cypress/integration/client/clientBillingData.spec.js
new file mode 100644
index 000000000..00af82e39
--- /dev/null
+++ b/test/cypress/integration/client/clientBillingData.spec.js
@@ -0,0 +1,13 @@
+///
+describe('Client billing data', () => {
+ beforeEach(() => {
+ cy.viewport(1280, 720);
+ cy.login('developer');
+ cy.visit('#/customer/1110/billing-data', {
+ timeout: 5000,
+ });
+ });
+ it('Should load layout', () => {
+ cy.get('.q-card').should('be.visible');
+ });
+});
diff --git a/test/cypress/integration/client/clientCredits.spec.js b/test/cypress/integration/client/clientCredits.spec.js
new file mode 100644
index 000000000..5f303b40d
--- /dev/null
+++ b/test/cypress/integration/client/clientCredits.spec.js
@@ -0,0 +1,13 @@
+///
+describe('Client credits', () => {
+ beforeEach(() => {
+ cy.viewport(1280, 720);
+ cy.login('developer');
+ cy.visit('#/customer/1110/credits', {
+ timeout: 5000,
+ });
+ });
+ it('Should load layout', () => {
+ cy.get('.q-page').should('be.visible');
+ });
+});
diff --git a/test/cypress/integration/client/clientFiscalData.spec.js b/test/cypress/integration/client/clientFiscalData.spec.js
new file mode 100644
index 000000000..e337c26f8
--- /dev/null
+++ b/test/cypress/integration/client/clientFiscalData.spec.js
@@ -0,0 +1,13 @@
+///
+describe('Client fiscal data', () => {
+ beforeEach(() => {
+ cy.viewport(1280, 720);
+ cy.login('developer');
+ cy.visit('#/customer/1110/fiscal-data', {
+ timeout: 5000,
+ });
+ });
+ it('Should load layout', () => {
+ cy.get('.q-card').should('be.visible');
+ });
+});
diff --git a/test/cypress/integration/client/clientGreuges.spec.js b/test/cypress/integration/client/clientGreuges.spec.js
new file mode 100644
index 000000000..23f8b3182
--- /dev/null
+++ b/test/cypress/integration/client/clientGreuges.spec.js
@@ -0,0 +1,13 @@
+///
+describe('Client greuges', () => {
+ beforeEach(() => {
+ cy.viewport(1280, 720);
+ cy.login('developer');
+ cy.visit('#/customer/1101/greuges', {
+ timeout: 5000,
+ });
+ });
+ it('Should load layout', () => {
+ cy.get('.q-card').should('be.visible');
+ });
+});
diff --git a/test/cypress/integration/client/clientList.spec.js b/test/cypress/integration/client/clientList.spec.js
new file mode 100644
index 000000000..22bca15ac
--- /dev/null
+++ b/test/cypress/integration/client/clientList.spec.js
@@ -0,0 +1,46 @@
+///
+describe('Client list', () => {
+ beforeEach(() => {
+ cy.viewport(1280, 720);
+ cy.login('developer');
+ cy.visit('/#/customer/list', {
+ timeout: 5000,
+ onBeforeLoad(win) {
+ cy.stub(win, 'open');
+ },
+ });
+ });
+
+ it('Client list create new client', () => {
+ cy.get('.q-page-sticky > div > .q-btn > .q-btn__content > .q-icon').click();
+ const data = {
+ Name: { val: 'Name 1' },
+ 'Social name': { val: 'TEST 1' },
+ 'Tax number': { val: '20852113Z' },
+ 'Web user': { val: 'user_test_1' },
+ Street: { val: 'C/ STREET 1' },
+ Email: { val: 'user.test@1.com' },
+ 'Business type': { val: 'Otros', type: 'select' },
+ 'Sales person': { val: 'salesboss', type: 'select' },
+ Location: { val: '46000, Valencia(Province one), España', type: 'select' },
+ };
+ cy.fillInForm(data);
+
+ cy.get('.q-mt-lg > .q-btn--standard').click();
+
+ cy.checkNotification('Data created');
+ cy.url().should('include', '/summary');
+ });
+ it('Client list search client', () => {
+ const search = 'Jessica Jones';
+ cy.searchByLabel('Name', search);
+
+ cy.get('.title > span').should('have.text', search);
+ let id = null;
+ cy.get('.q-item > .q-item__label').then((text) => {
+ id = text.text().trim().split('#')[1];
+ cy.get('.q-item > .q-item__label').should('have.text', ` #${id}`);
+ cy.url().should('include', `/customer/${id}/summary`);
+ });
+ });
+});
diff --git a/test/cypress/integration/client/clientNotes.spec.js b/test/cypress/integration/client/clientNotes.spec.js
new file mode 100644
index 000000000..99a7c66c5
--- /dev/null
+++ b/test/cypress/integration/client/clientNotes.spec.js
@@ -0,0 +1,13 @@
+///
+describe('Client notes', () => {
+ beforeEach(() => {
+ cy.viewport(1280, 720);
+ cy.login('developer');
+ cy.visit('#/customer/1110/notes', {
+ timeout: 5000,
+ });
+ });
+ it('Should load layout', () => {
+ cy.get('.q-card').should('be.visible');
+ });
+});
diff --git a/test/cypress/integration/client/clientRecoveries.spec.js b/test/cypress/integration/client/clientRecoveries.spec.js
new file mode 100644
index 000000000..ea6f14407
--- /dev/null
+++ b/test/cypress/integration/client/clientRecoveries.spec.js
@@ -0,0 +1,13 @@
+///
+describe('Client recoveries', () => {
+ beforeEach(() => {
+ cy.viewport(1280, 720);
+ cy.login('developer');
+ cy.visit('#/customer/1101/recoveries', {
+ timeout: 5000,
+ });
+ });
+ it('Should load layout', () => {
+ cy.get('.q-page').should('be.visible');
+ });
+});
diff --git a/test/cypress/integration/client/clientWebAccess.spec.js b/test/cypress/integration/client/clientWebAccess.spec.js
new file mode 100644
index 000000000..47f9efa4c
--- /dev/null
+++ b/test/cypress/integration/client/clientWebAccess.spec.js
@@ -0,0 +1,13 @@
+///
+describe('Client web-access', () => {
+ beforeEach(() => {
+ cy.viewport(1280, 720);
+ cy.login('developer');
+ cy.visit('#/customer/1110/web-access', {
+ timeout: 5000,
+ });
+ });
+ it('Should load layout', () => {
+ cy.get('.q-card').should('be.visible');
+ });
+});
diff --git a/test/cypress/integration/client/credit-management/clientCreditContracts.spec.js b/test/cypress/integration/client/credit-management/clientCreditContracts.spec.js
new file mode 100644
index 000000000..3c35d5ed0
--- /dev/null
+++ b/test/cypress/integration/client/credit-management/clientCreditContracts.spec.js
@@ -0,0 +1,13 @@
+///
+describe('Client credit opinion', () => {
+ beforeEach(() => {
+ cy.viewport(1280, 720);
+ cy.login('developer');
+ cy.visit('#/customer/1101/credit-management/credit-contracts', {
+ timeout: 5000,
+ });
+ });
+ it('Should load layout', () => {
+ cy.get('.q-card').should('be.visible');
+ });
+});
diff --git a/test/cypress/integration/client/credit-management/clientCreditOpinion.spec.js b/test/cypress/integration/client/credit-management/clientCreditOpinion.spec.js
new file mode 100644
index 000000000..c32215f01
--- /dev/null
+++ b/test/cypress/integration/client/credit-management/clientCreditOpinion.spec.js
@@ -0,0 +1,13 @@
+///
+describe('Client credit opinion', () => {
+ beforeEach(() => {
+ cy.viewport(1280, 720);
+ cy.login('developer');
+ cy.visit('#/customer/1110/credit-management/credit-opinion', {
+ timeout: 5000,
+ });
+ });
+ it('Should load layout', () => {
+ cy.get('.q-page').should('be.visible');
+ });
+});
diff --git a/test/cypress/integration/client/others/clientConsumption.spec.js b/test/cypress/integration/client/others/clientConsumption.spec.js
new file mode 100644
index 000000000..bbc11998e
--- /dev/null
+++ b/test/cypress/integration/client/others/clientConsumption.spec.js
@@ -0,0 +1,13 @@
+///
+describe('Client consumption', () => {
+ beforeEach(() => {
+ cy.viewport(1280, 720);
+ cy.login('developer');
+ cy.visit('#/customer/1101/others/consumption', {
+ timeout: 5000,
+ });
+ });
+ it('Should load layout', () => {
+ cy.get('.q-page').should('be.visible');
+ });
+});
diff --git a/test/cypress/integration/client/others/clientContacts.spec.js b/test/cypress/integration/client/others/clientContacts.spec.js
new file mode 100644
index 000000000..66a86801a
--- /dev/null
+++ b/test/cypress/integration/client/others/clientContacts.spec.js
@@ -0,0 +1,13 @@
+///
+describe('Client contacts', () => {
+ beforeEach(() => {
+ cy.viewport(1280, 720);
+ cy.login('developer');
+ cy.visit('#/customer/1101/others/contacts', {
+ timeout: 5000,
+ });
+ });
+ it('Should load layout', () => {
+ cy.get('.q-card').should('be.visible');
+ });
+});
diff --git a/test/cypress/integration/client/others/clientMandates.spec.js b/test/cypress/integration/client/others/clientMandates.spec.js
new file mode 100644
index 000000000..055eda2d0
--- /dev/null
+++ b/test/cypress/integration/client/others/clientMandates.spec.js
@@ -0,0 +1,13 @@
+///
+describe('Client mandates', () => {
+ beforeEach(() => {
+ cy.viewport(1280, 720);
+ cy.login('developer');
+ cy.visit('#/customer/1110/others/mandates', {
+ timeout: 5000,
+ });
+ });
+ it('Should load layout', () => {
+ cy.get('.q-page').should('be.visible');
+ });
+});
diff --git a/test/cypress/integration/client/others/clientSamples.spec.js b/test/cypress/integration/client/others/clientSamples.spec.js
new file mode 100644
index 000000000..a50120402
--- /dev/null
+++ b/test/cypress/integration/client/others/clientSamples.spec.js
@@ -0,0 +1,13 @@
+///
+describe('Client samples', () => {
+ beforeEach(() => {
+ cy.viewport(1280, 720);
+ cy.login('developer');
+ cy.visit('#/customer/1101/others/samples', {
+ timeout: 5000,
+ });
+ });
+ it('Should load layout', () => {
+ cy.get('.q-page').should('be.visible');
+ });
+});
diff --git a/test/cypress/integration/client/others/clientUnpaid.spec.js b/test/cypress/integration/client/others/clientUnpaid.spec.js
new file mode 100644
index 000000000..9972ba0e9
--- /dev/null
+++ b/test/cypress/integration/client/others/clientUnpaid.spec.js
@@ -0,0 +1,13 @@
+///
+describe('Client unpaid', () => {
+ beforeEach(() => {
+ cy.viewport(1280, 720);
+ cy.login('developer');
+ cy.visit('#/customer/1110/others/unpaid', {
+ timeout: 5000,
+ });
+ });
+ it('Should load layout', () => {
+ cy.get('.q-card').should('be.visible');
+ });
+});
diff --git a/test/cypress/integration/client/others/clientWebPayments.spec.js b/test/cypress/integration/client/others/clientWebPayments.spec.js
new file mode 100644
index 000000000..f35b12612
--- /dev/null
+++ b/test/cypress/integration/client/others/clientWebPayments.spec.js
@@ -0,0 +1,13 @@
+///
+describe('Client web payments', () => {
+ beforeEach(() => {
+ cy.viewport(1280, 720);
+ cy.login('developer');
+ cy.visit('#/customer/1101/others/web-payment', {
+ timeout: 5000,
+ });
+ });
+ it('Should load layout', () => {
+ cy.get('.q-page').should('be.visible');
+ });
+});
diff --git a/test/cypress/integration/outLogin/logout.spec.js b/test/cypress/integration/outLogin/logout.spec.js
index 423189908..8d4e90aac 100644
--- a/test/cypress/integration/outLogin/logout.spec.js
+++ b/test/cypress/integration/outLogin/logout.spec.js
@@ -13,7 +13,7 @@ describe('Logout', () => {
});
describe('not user', () => {
beforeEach(() => {
- cy.intercept('GET', '**/VnUsers/acl', {
+ cy.intercept('GET', '**DefaultViewConfigs**', {
statusCode: 401,
body: {
error: {
@@ -24,10 +24,11 @@ describe('Logout', () => {
},
},
statusMessage: 'AUTHORIZATION_REQUIRED',
- }).as('someRoute');
+ });
});
+
it('when token not exists', () => {
- cy.reload();
+ cy.get('.q-list > [href="#/item"]').click();
cy.get('.q-notification__message').should(
'have.text',
'Authorization Required'
diff --git a/test/cypress/integration/parking/parkingList.spec.js b/test/cypress/integration/parking/parkingList.spec.js
index b78a660d1..f1efaa375 100644
--- a/test/cypress/integration/parking/parkingList.spec.js
+++ b/test/cypress/integration/parking/parkingList.spec.js
@@ -1,5 +1,6 @@
///
describe('ParkingList', () => {
+ const searchbar = '#searchbar input';
const firstCard = '.q-card:nth-child(1)';
const firstChipId =
':nth-child(1) > :nth-child(1) > .justify-between > .flex > .q-chip > .q-chip__content';
@@ -14,6 +15,7 @@ describe('ParkingList', () => {
});
it('should redirect on clicking a parking', () => {
+ cy.get(searchbar).type('{enter}');
cy.get(firstChipId)
.invoke('text')
.then((content) => {
@@ -24,6 +26,7 @@ describe('ParkingList', () => {
});
it('should open the details', () => {
+ cy.get(searchbar).type('{enter}');
cy.get(firstDetailBtn).click();
cy.get(summaryHeader).contains('Basic data');
});
diff --git a/test/cypress/integration/route/agency/agencyWorkCenter.spec.js b/test/cypress/integration/route/agency/agencyWorkCenter.spec.js
index 353c5805b..fdfcd4286 100644
--- a/test/cypress/integration/route/agency/agencyWorkCenter.spec.js
+++ b/test/cypress/integration/route/agency/agencyWorkCenter.spec.js
@@ -7,31 +7,20 @@ describe('AgencyWorkCenter', () => {
const createButton = '.q-page-sticky > div > .q-btn > .q-btn__content > .q-icon';
const workCenterCombobox = 'input[role="combobox"]';
- it('assign workCenter', () => {
+ it('check workCenter crud', () => {
+ // create
cy.get(createButton).click();
cy.get(workCenterCombobox).type('workCenterOne{enter}');
- cy.get('.q-notification__message').should('have.text', 'Data created');
- });
+ cy.checkNotification('Data created');
- it('delete workCenter', () => {
+ // expect error when duplicate
+ cy.get(createButton).click();
+ cy.get('[data-cy="FormModelPopup_save"]').click();
+ cy.checkNotification('This workCenter is already assigned to this agency');
+ cy.get('[data-cy="FormModelPopup_cancel"]').click();
+
+ // delete
cy.get('.q-item__section--side > .q-btn > .q-btn__content > .q-icon').click();
- cy.get('.q-notification__message').should(
- 'have.text',
- 'WorkCenter removed successfully'
- );
- });
-
- it('error on duplicate workCenter', () => {
- cy.get(createButton).click();
- cy.get(workCenterCombobox).type('workCenterOne{enter}');
- cy.get('.q-notification__message').should('have.text', 'Data created');
- cy.get(createButton).click();
- cy.get(
- '.vn-row > .q-field > .q-field__inner > .q-field__control > .q-field__control-container'
- ).type('workCenterOne{enter}');
-
- cy.get(
- ':nth-child(2) > .q-notification__wrapper > .q-notification__content > .q-notification__message'
- ).should('have.text', 'This workCenter is already assigned to this agency');
+ cy.checkNotification('WorkCenter removed successfully');
});
});
diff --git a/test/cypress/integration/ticket/ticketExpedition.spec.js b/test/cypress/integration/ticket/ticketExpedition.spec.js
new file mode 100644
index 000000000..d4afd401f
--- /dev/null
+++ b/test/cypress/integration/ticket/ticketExpedition.spec.js
@@ -0,0 +1,26 @@
+///
+
+describe('Ticket expedtion', () => {
+ const tableContent = '.q-table .q-virtual-scroll__content';
+ const stateTd = 'td:nth-child(9)';
+
+ beforeEach(() => {
+ cy.login('developer');
+ cy.viewport(1920, 1080);
+ });
+
+ it('should change the state', () => {
+ cy.visit('#/ticket/1/expedition');
+ cy.intercept('GET', /\/api\/Expeditions\/filter/).as('show');
+ cy.intercept('POST', /\/api\/ExpeditionStates\/addExpeditionState/).as('add');
+
+ cy.wait('@show');
+ cy.selectRows([1, 2]);
+ cy.selectOption('[data-cy="change-state"]', 'Perdida');
+ cy.wait('@add');
+
+ cy.get(`${tableContent} tr:nth-child(-n+2) ${stateTd}`).each(($el) => {
+ cy.wrap($el).contains('Perdida');
+ });
+ });
+});
diff --git a/test/cypress/integration/worker/workerList.spec.js b/test/cypress/integration/worker/workerList.spec.js
index 8a8bea443..c1c37fd32 100644
--- a/test/cypress/integration/worker/workerList.spec.js
+++ b/test/cypress/integration/worker/workerList.spec.js
@@ -11,7 +11,7 @@ describe('WorkerList', () => {
it('should open the worker summary', () => {
cy.get(inputName).type('jessica{enter}');
cy.get(searchBtn).click();
- cy.intercept('GET', /\/api\/Workers\/\d+/).as('worker');
+ cy.intercept('GET', /\/api\/Workers\/summary+/).as('worker');
cy.wait('@worker').then(() =>
cy.get(descriptorTitle).should('include.text', 'Jessica')
);
diff --git a/test/cypress/integration/worker/workerLocker.spec.js b/test/cypress/integration/worker/workerLocker.spec.js
index 8a169dfb2..c222414fd 100644
--- a/test/cypress/integration/worker/workerLocker.spec.js
+++ b/test/cypress/integration/worker/workerLocker.spec.js
@@ -1,8 +1,7 @@
describe('WorkerLocker', () => {
const productionId = 49;
- const lockerCode = '2F';
- const input = '.q-card input';
- const thirdOpt = '[role="listbox"] .q-item:nth-child(1)';
+ const lockerCode = '4F';
+ const lockerSelect = '[data-cy="locker"]';
beforeEach(() => {
cy.viewport(1280, 720);
cy.login('productionBoss');
@@ -10,10 +9,8 @@ describe('WorkerLocker', () => {
});
it('should allocates a locker', () => {
- cy.get(input).click();
- cy.waitForElement('[role="listbox"]');
- cy.get(thirdOpt).click();
+ cy.selectOption(lockerSelect, lockerCode);
cy.saveCard();
- cy.get(input).invoke('val').should('eq', lockerCode);
+ cy.get(lockerSelect).invoke('val').should('eq', lockerCode);
});
});
diff --git a/test/cypress/integration/worker/workerNotificationsManager.spec.js b/test/cypress/integration/worker/workerNotificationsManager.spec.js
index ac452c4ff..f121b3894 100644
--- a/test/cypress/integration/worker/workerNotificationsManager.spec.js
+++ b/test/cypress/integration/worker/workerNotificationsManager.spec.js
@@ -17,8 +17,7 @@ describe('WorkerNotificationsManager', () => {
cy.login('developer');
cy.visit(`/#/worker/${salesPersonId}/notifications`);
cy.get(firstAvailableNotification).click();
- cy.notificationHas(
- '.q-notification__message',
+ cy.checkNotification(
'The notification subscription of this worker cant be modified'
);
});
diff --git a/test/cypress/support/commands.js b/test/cypress/support/commands.js
index 83f45b721..76bdefd27 100755
--- a/test/cypress/support/commands.js
+++ b/test/cypress/support/commands.js
@@ -82,7 +82,7 @@ Cypress.Commands.add('getValue', (selector) => {
// Fill Inputs
Cypress.Commands.add('selectOption', (selector, option) => {
cy.waitForElement(selector);
- cy.get(selector).find('.q-select__dropdown-icon').click();
+ cy.get(selector).click();
cy.get('.q-menu .q-item').contains(option).click();
});
@@ -152,6 +152,14 @@ Cypress.Commands.add('notificationHas', (selector, text) => {
cy.get(selector).should('have.text', text);
});
+Cypress.Commands.add('selectRows', (rows) => {
+ rows.forEach((row) => {
+ cy.get('.q-table .q-virtual-scroll__content tr .q-checkbox__inner')
+ .eq(row - 1)
+ .click();
+ });
+});
+
Cypress.Commands.add('fillRow', (rowSelector, data) => {
// Usar el selector proporcionado para obtener la fila deseada
cy.waitForElement('tbody');
@@ -245,6 +253,13 @@ Cypress.Commands.add('validateContent', (selector, expectedValue) => {
cy.get(selector).should('have.text', expectedValue);
});
+Cypress.Commands.add('openActionDescriptor', (opt) => {
+ cy.openActionsDescriptor();
+ const listItem = '[role="menu"] .q-list .q-item';
+ cy.contains(listItem, opt).click();
+ 1;
+});
+
Cypress.Commands.add('openActionsDescriptor', () => {
cy.get('.header > :nth-child(3) > .q-btn__content > .q-icon').click();
});
@@ -254,3 +269,21 @@ Cypress.Commands.add('openUserPanel', () => {
'.column > .q-avatar > .q-avatar__content > .q-img > .q-img__container > .q-img__image'
).click();
});
+
+Cypress.Commands.add('openActions', (row) => {
+ cy.get('tbody > tr').eq(row).find('.actions > .q-btn').click();
+});
+
+Cypress.Commands.add('checkNotification', (text) => {
+ cy.get('.q-notification')
+ .should('be.visible')
+ .last()
+ .then(($lastNotification) => {
+ if (!Cypress.$($lastNotification).text().includes(text))
+ throw new Error(`Notification not found: "${text}"`);
+ });
+});
+
+Cypress.Commands.add('searchByLabel', (label, value) => {
+ cy.get(`[label="${label}"] > .q-field > .q-field__inner`).type(`${value}{enter}`);
+});
diff --git a/test/vitest/__tests__/boot/axios.spec.js b/test/vitest/__tests__/boot/axios.spec.js
index feb0d93ea..19d396ec5 100644
--- a/test/vitest/__tests__/boot/axios.spec.js
+++ b/test/vitest/__tests__/boot/axios.spec.js
@@ -7,75 +7,59 @@ vi.mock('src/composables/useSession', () => ({
getToken: () => 'DEFAULT_TOKEN',
isLoggedIn: () => vi.fn(),
destroy: () => vi.fn(),
- })
+ }),
+}));
+
+vi.mock('src/stores/useStateQueryStore', () => ({
+ useStateQueryStore: () => ({
+ add: () => vi.fn(),
+ remove: () => vi.fn(),
+ }),
}));
describe('Axios boot', () => {
-
describe('onRequest()', async () => {
it('should set the "Authorization" property on the headers', async () => {
const config = { headers: {} };
const resultConfig = onRequest(config);
- expect(resultConfig).toEqual(expect.objectContaining({
- headers: {
- Authorization: 'DEFAULT_TOKEN'
- }
- }));
- });
- })
-
- describe('onResponseError()', async () => {
- it('should call to the Notify plugin with a message error for an status code "500"', async () => {
- Notify.create = vi.fn()
-
- const error = {
- response: {
- status: 500
- }
- };
-
- const result = onResponseError(error);
-
-
- expect(result).rejects.toEqual(
- expect.objectContaining(error)
- );
- expect(Notify.create).toHaveBeenCalledWith(
+ expect(resultConfig).toEqual(
expect.objectContaining({
- message: 'An internal server error has ocurred',
- type: 'negative',
+ headers: {
+ Authorization: 'DEFAULT_TOKEN',
+ },
})
);
});
+ });
+
+ describe('onResponseError()', async () => {
+ it('should call to the Notify plugin with a message error for an status code "500"', async () => {
+ const error = {
+ response: {
+ status: 500,
+ },
+ };
+
+ const result = onResponseError(error);
+ expect(result).rejects.toEqual(expect.objectContaining(error));
+ });
it('should call to the Notify plugin with a message from the response property', async () => {
- Notify.create = vi.fn()
-
const error = {
response: {
status: 401,
data: {
error: {
- message: 'Invalid user or password'
- }
- }
- }
+ message: 'Invalid user or password',
+ },
+ },
+ },
};
const result = onResponseError(error);
-
-
- expect(result).rejects.toEqual(
- expect.objectContaining(error)
- );
- expect(Notify.create).toHaveBeenCalledWith(
- expect.objectContaining({
- message: 'Invalid user or password',
- type: 'negative',
- })
- );
+ expect(result).rejects.toEqual(expect.objectContaining(error));
});
- })
+ });
});
diff --git a/test/vitest/__tests__/stores/useStateQueryStore.spec.js b/test/vitest/__tests__/stores/useStateQueryStore.spec.js
new file mode 100644
index 000000000..ab3afb007
--- /dev/null
+++ b/test/vitest/__tests__/stores/useStateQueryStore.spec.js
@@ -0,0 +1,58 @@
+import { describe, expect, it, beforeEach, beforeAll } from 'vitest';
+import { createWrapper } from 'app/test/vitest/helper';
+
+import { useStateQueryStore } from 'src/stores/useStateQueryStore';
+
+describe('useStateQueryStore', () => {
+ beforeAll(() => {
+ createWrapper({}, {});
+ });
+
+ const stateQueryStore = useStateQueryStore();
+ const { add, isLoading, remove, reset } = useStateQueryStore();
+ const firstQuery = { url: 'myQuery' };
+
+ function getQueries() {
+ return stateQueryStore.queries;
+ }
+
+ beforeEach(() => {
+ reset();
+ expect(getQueries().size).toBeFalsy();
+ });
+
+ it('should add two queries', async () => {
+ expect(getQueries().size).toBeFalsy();
+ add(firstQuery);
+
+ expect(getQueries().size).toBeTruthy();
+ expect(getQueries().has(firstQuery)).toBeTruthy();
+
+ add();
+ expect(getQueries().size).toBe(2);
+ });
+
+ it('should add and remove loading state', async () => {
+ expect(isLoading().value).toBeFalsy();
+ add(firstQuery);
+ expect(isLoading().value).toBeTruthy();
+ remove(firstQuery);
+ expect(isLoading().value).toBeFalsy();
+ });
+
+ it('should add and remove query', async () => {
+ const secondQuery = { ...firstQuery };
+ const thirdQuery = { ...firstQuery };
+
+ add(firstQuery);
+ add(secondQuery);
+
+ const beforeCount = getQueries().size;
+ add(thirdQuery);
+ expect(getQueries().has(thirdQuery)).toBeTruthy();
+
+ remove(thirdQuery);
+ expect(getQueries().has(thirdQuery)).toBeFalsy();
+ expect(getQueries().size).toBe(beforeCount);
+ });
+});