From 1a0df60e06878c3695a7011016ec705a3b19dbaa Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Fri, 14 Mar 2025 14:21:26 +0100 Subject: [PATCH 01/13] fix: remove reserved ticket functionality from TicketProblems and TicketSaleMoreActions components --- src/components/TicketProblems.vue | 11 ------ .../Ticket/Card/TicketSaleMoreActions.vue | 35 ------------------- 2 files changed, 46 deletions(-) diff --git a/src/components/TicketProblems.vue b/src/components/TicketProblems.vue index c11cc2e7b..aee132fe0 100644 --- a/src/components/TicketProblems.vue +++ b/src/components/TicketProblems.vue @@ -17,17 +17,6 @@ defineProps({ row: { type: Object, required: true } }); - - - {{ t('ticketSale.reserved') }} - - { } return false; }); -const hasReserves = computed(() => props.sales.some((sale) => sale.reserved == true)); const sendSms = async (params) => { await axios.post(`Tickets/${ticket.value.id}/sendSms`, params); @@ -144,14 +143,6 @@ const onCreateClaimAccepted = async () => { push({ name: 'ClaimBasicData', params: { id: data.id } }); }; -const setReserved = async (reserved) => { - const params = { ticketId: ticket.value.id, sales: props.sales, reserved: reserved }; - await axios.post(`Sales/reserve`, params); - props.sales.forEach((sale) => { - sale.reserved = reserved; - }); -}; - const createRefund = async (withWarehouse) => { if (!props.ticket) return; @@ -240,30 +231,6 @@ const createRefund = async (withWarehouse) => { {{ t('Add claim') }} - - - {{ t('Mark as reserved') }} - - - - - {{ t('Unmark as reserved') }} - - {{ t('Refund') }} @@ -309,8 +276,6 @@ es: Recalculate price: Recalcular precio Update discount: Actualizar descuento Add claim: Crear reclamación - Mark as reserved: Marcar como reservado - Unmark as reserved: Desmarcar como reservado Refund: Abono with warehouse: con almacén without warehouse: sin almacén From 26f20440972b8fd42d032e49c580c58bc8b3edb0 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Mon, 24 Mar 2025 09:08:18 +0100 Subject: [PATCH 02/13] test: update order creation test and remove reserved ticket tests --- test/cypress/integration/order/orderList.spec.js | 2 +- .../integration/ticket/ticketSale.spec.js | 16 ---------------- 2 files changed, 1 insertion(+), 17 deletions(-) diff --git a/test/cypress/integration/order/orderList.spec.js b/test/cypress/integration/order/orderList.spec.js index 1c954622f..024517bbf 100644 --- a/test/cypress/integration/order/orderList.spec.js +++ b/test/cypress/integration/order/orderList.spec.js @@ -6,7 +6,7 @@ describe('OrderList', () => { cy.visit('/#/order/list'); }); - it('create order', () => { + it.only('create order', () => { cy.get('[data-cy="vnTableCreateBtn"]').click(); cy.get('[data-cy="Client_select"]').type('1101'); cy.get('.q-menu').contains('Bruce Wayne').click(); diff --git a/test/cypress/integration/ticket/ticketSale.spec.js b/test/cypress/integration/ticket/ticketSale.spec.js index 61ba9fe4f..514c50281 100644 --- a/test/cypress/integration/ticket/ticketSale.spec.js +++ b/test/cypress/integration/ticket/ticketSale.spec.js @@ -152,22 +152,6 @@ describe('TicketSale', () => { cy.checkNotification('Future ticket date not allowed'); }); - it('marks row as reserved', () => { - selectFirstRow(); - cy.dataCy('ticketSaleMoreActionsDropdown').click(); - cy.waitForElement('[data-cy="markAsReservedItem"]'); - cy.dataCy('markAsReservedItem').click(); - cy.dataCy('ticketSaleReservedIcon').should('exist'); - }); - - it('unmarks row as reserved', () => { - selectFirstRow(); - cy.dataCy('ticketSaleMoreActionsDropdown').click(); - cy.waitForElement('[data-cy="unmarkAsReservedItem"]'); - cy.dataCy('unmarkAsReservedItem').click(); - cy.dataCy('ticketSaleReservedIcon').should('not.exist'); - }); - it('refunds row with warehouse', () => { selectFirstRow(); cy.dataCy('ticketSaleMoreActionsDropdown').click(); From 17b784e4d107711f329a84324be5706b406b0d11 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Mon, 24 Mar 2025 09:46:10 +0100 Subject: [PATCH 03/13] test: rename account descriptor test and enable claim notes test --- .../integration/account/accountDescriptorMenu.spec.js | 5 ++++- test/cypress/integration/claim/claimNotes.spec.js | 2 +- test/cypress/integration/ticket/ticketSale.spec.js | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/test/cypress/integration/account/accountDescriptorMenu.spec.js b/test/cypress/integration/account/accountDescriptorMenu.spec.js index 67a7d8ef6..04fc57040 100644 --- a/test/cypress/integration/account/accountDescriptorMenu.spec.js +++ b/test/cypress/integration/account/accountDescriptorMenu.spec.js @@ -1,4 +1,4 @@ -describe('ClaimNotes', () => { +describe('Account descriptor', () => { const descriptorOptions = '[data-cy="descriptor-more-opts-menu"] > .q-list'; const url = '/#/account/1/summary'; @@ -7,6 +7,9 @@ describe('ClaimNotes', () => { cy.visit(url); cy.dataCy('descriptor-more-opts').click(); cy.get(descriptorOptions) + .should('exist') + .should('be.visible') + .find('.q-item') .its('length') .then((count) => { diff --git a/test/cypress/integration/claim/claimNotes.spec.js b/test/cypress/integration/claim/claimNotes.spec.js index ae8b4186c..fa4a214a1 100644 --- a/test/cypress/integration/claim/claimNotes.spec.js +++ b/test/cypress/integration/claim/claimNotes.spec.js @@ -1,4 +1,4 @@ -describe.skip('ClaimNotes', () => { +describe('ClaimNotes', () => { const saveBtn = '.q-field__append > .q-btn > .q-btn__content > .q-icon'; const firstNote = '.q-infinite-scroll :nth-child(1) > .q-card__section--vert'; beforeEach(() => { diff --git a/test/cypress/integration/ticket/ticketSale.spec.js b/test/cypress/integration/ticket/ticketSale.spec.js index 514c50281..6d84f214c 100644 --- a/test/cypress/integration/ticket/ticketSale.spec.js +++ b/test/cypress/integration/ticket/ticketSale.spec.js @@ -23,7 +23,7 @@ describe('TicketSale', () => { cy.get('[data-col-field="price"]') .find('.q-btn > .q-btn__content') - .should('have.text', `€${price}`); + .should('contain.text', `€${price}`); }); it('update discount', () => { const discount = Math.floor(Math.random() * 100) + 1; From dd4e872fcca53e22418a9dbf7b3bbec2daea65d7 Mon Sep 17 00:00:00 2001 From: jorgep Date: Wed, 26 Mar 2025 16:00:50 +0100 Subject: [PATCH 04/13] refactor: refs #8718 simplify VnAccountNumber component and remove obsolete tests --- src/components/common/VnAccountNumber.vue | 25 +------------ .../vnComponent/VnAccountNumber.spec.js | 37 ------------------- 2 files changed, 2 insertions(+), 60 deletions(-) delete mode 100644 test/cypress/integration/vnComponent/VnAccountNumber.spec.js diff --git a/src/components/common/VnAccountNumber.vue b/src/components/common/VnAccountNumber.vue index 56add7329..8bff3e261 100644 --- a/src/components/common/VnAccountNumber.vue +++ b/src/components/common/VnAccountNumber.vue @@ -1,35 +1,14 @@ diff --git a/test/cypress/integration/vnComponent/VnAccountNumber.spec.js b/test/cypress/integration/vnComponent/VnAccountNumber.spec.js deleted file mode 100644 index 053902f35..000000000 --- a/test/cypress/integration/vnComponent/VnAccountNumber.spec.js +++ /dev/null @@ -1,37 +0,0 @@ -describe('VnAccountNumber', () => { - const accountInput = 'input[data-cy="supplierFiscalDataAccount_input"]'; - beforeEach(() => { - cy.login('developer'); - cy.viewport(1920, 1080); - cy.visit('/#/supplier/1/fiscal-data'); - }); - - describe('VnInput handleInsertMode()', () => { - it('should replace character at cursor position in insert mode', () => { - cy.get(accountInput).type('{selectall}4100000001'); - cy.get(accountInput).type('{movetostart}'); - cy.get(accountInput).type('999'); - cy.get(accountInput).should('have.value', '9990000001'); - }); - - it('should replace character at cursor position in insert mode', () => { - cy.get(accountInput).clear(); - cy.get(accountInput).type('4100000001'); - cy.get(accountInput).type('{movetostart}'); - cy.get(accountInput).type('999'); - cy.get(accountInput).should('have.value', '9990000001'); - }); - - it('should respect maxlength prop', () => { - cy.get(accountInput).clear(); - cy.get(accountInput).type('123456789012345'); - cy.get(accountInput).should('have.value', '1234567890'); - }); - }); - - it('should convert short account number to standard format', () => { - cy.get(accountInput).clear(); - cy.get(accountInput).type('123.'); - cy.get(accountInput).should('have.value', '1230000000'); - }); -}); From 67e0791f3480ff279d82c76fa8553bda73cec391 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Thu, 27 Mar 2025 09:03:40 +0100 Subject: [PATCH 05/13] fix: update order list tests to remove only and skip modifiers --- test/cypress/integration/order/orderList.spec.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/cypress/integration/order/orderList.spec.js b/test/cypress/integration/order/orderList.spec.js index 0f04d256b..ee011ea05 100644 --- a/test/cypress/integration/order/orderList.spec.js +++ b/test/cypress/integration/order/orderList.spec.js @@ -10,7 +10,7 @@ describe('OrderList', () => { cy.visit('/#/order/list'); }); - it.only('create order', () => { + it('create order', () => { cy.get('[data-cy="vnTableCreateBtn"]').click(); cy.selectOption(clientCreateSelect, 1101); cy.get(addressCreateSelect).click(); @@ -30,9 +30,11 @@ describe('OrderList', () => { cy.url().should('include', `/order`); }); - it.skip('filter list and create order', () => { + it('filter list and create order', () => { cy.dataCy('Customer ID_input').type('1101{enter}'); + cy.intercept('GET', /\/api\/Clients/).as('clientFilter'); cy.dataCy('vnTableCreateBtn').click(); + cy.wait('@clientFilter'); cy.dataCy('landedDate').find('input').type('06/01/2001'); cy.selectOption(agencyCreateSelect, 1); From a91a0146fe294d01717a394380e94a9bc9362a35 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Thu, 27 Mar 2025 13:03:21 +0100 Subject: [PATCH 06/13] fix: hasChanges --- src/pages/Ticket/Card/TicketSale.vue | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/pages/Ticket/Card/TicketSale.vue b/src/pages/Ticket/Card/TicketSale.vue index 2fb305cc3..666b5fefe 100644 --- a/src/pages/Ticket/Card/TicketSale.vue +++ b/src/pages/Ticket/Card/TicketSale.vue @@ -187,7 +187,9 @@ const getRowUpdateInputEvents = (sale) => { const resetChanges = async () => { arrayData.fetch({ append: false }); + tableRef.value.CrudModelRef.hasChanges = false; tableRef.value.reload(); + selectedRows.value = []; }; const changeQuantity = async (sale) => { @@ -390,7 +392,7 @@ const changeTicketState = async (val) => { const params = { ticketFk: route.params.id, code: val }; await axios.post('Tickets/state', params); notify('globals.dataSaved', 'positive'); - await resetChanges(); + resetChanges(); }; const removeSelectedSales = () => { From 6e84341aeade6662684dcbb3292d5bcf3fab8b3e Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Thu, 27 Mar 2025 13:06:29 +0100 Subject: [PATCH 07/13] perf: add await --- src/pages/Ticket/Card/TicketSale.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/Ticket/Card/TicketSale.vue b/src/pages/Ticket/Card/TicketSale.vue index 666b5fefe..96a2dc43f 100644 --- a/src/pages/Ticket/Card/TicketSale.vue +++ b/src/pages/Ticket/Card/TicketSale.vue @@ -188,7 +188,7 @@ const getRowUpdateInputEvents = (sale) => { const resetChanges = async () => { arrayData.fetch({ append: false }); tableRef.value.CrudModelRef.hasChanges = false; - tableRef.value.reload(); + await tableRef.value.reload(); selectedRows.value = []; }; From c4ab00ffd21bbffdd3b99ae1b579fd47ae18bf82 Mon Sep 17 00:00:00 2001 From: alexm Date: Thu, 27 Mar 2025 14:56:22 +0100 Subject: [PATCH 08/13] fix: update filter in TravelCard to include route parameter --- src/pages/Travel/Card/TravelCard.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/Travel/Card/TravelCard.vue b/src/pages/Travel/Card/TravelCard.vue index 479b47fb9..d452f5287 100644 --- a/src/pages/Travel/Card/TravelCard.vue +++ b/src/pages/Travel/Card/TravelCard.vue @@ -8,6 +8,6 @@ import filter from './TravelFilter.js'; data-key="Travel" url="Travels" :descriptor="TravelDescriptor" - :filter="filter" + :filter="{ ...filter, where: { id: $route.params.id } }" /> From 2a3e072b1bd95c2484099b04e7e7c24b0bb6d9ab Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Fri, 28 Mar 2025 01:25:38 +0100 Subject: [PATCH 09/13] feat: add departmentFk to user data and filter clients by department --- src/composables/useRole.js | 1 + src/pages/Monitor/MonitorClients.vue | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/composables/useRole.js b/src/composables/useRole.js index ff54b409c..e700b1f2e 100644 --- a/src/composables/useRole.js +++ b/src/composables/useRole.js @@ -13,6 +13,7 @@ export function useRole() { name: data.user.name, nickname: data.user.nickname, lang: data.user.lang || 'es', + departmentFk: data.user.worker.department.departmentFk, }; state.setUser(userData); state.setRoles(roles); diff --git a/src/pages/Monitor/MonitorClients.vue b/src/pages/Monitor/MonitorClients.vue index c814d623e..99110df16 100644 --- a/src/pages/Monitor/MonitorClients.vue +++ b/src/pages/Monitor/MonitorClients.vue @@ -9,12 +9,14 @@ import VnInputDate from 'src/components/common/VnInputDate.vue'; import VnRow from 'src/components/ui/VnRow.vue'; import { dateRange } from 'src/filters'; import useOpenURL from 'src/composables/useOpenURL'; +import { useState } from 'src/composables/useState'; const { t } = useI18n(); const dates = dateRange(Date.vnNew()); const from = ref(dates[0]); const to = ref(dates[1]); +const state = useState(); const filter = computed(() => { const obj = {}; const formatFrom = setHours(from.value, 'from'); @@ -25,7 +27,9 @@ const filter = computed(() => { else if (formatFrom && !formatTo) stamp = { gte: formatFrom }; else if (formatFrom && formatTo) stamp = { between: [formatFrom, formatTo] }; - return Object.assign(obj, { where: { 'v.stamp': stamp } }); + return Object.assign(obj, { + where: { 'v.stamp': stamp, departmentFk: state.getUser().departmentFk }, + }); }); function exprBuilder(param, value) { From a49c8891a743d0e73162e1dbea0e05a385eb91cc Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Fri, 28 Mar 2025 10:22:08 +0100 Subject: [PATCH 10/13] fix: params.departmentFk i18n and ticketFilter.groupedStates --- src/pages/Claim/ClaimFilter.vue | 2 ++ src/pages/Customer/CustomerFilter.vue | 2 ++ .../Defaulter/CustomerDefaulterFilter.vue | 2 ++ src/pages/Order/Card/OrderFilter.vue | 2 ++ src/pages/Ticket/TicketFilter.vue | 29 +++++-------------- src/pages/Worker/WorkerFilter.vue | 3 ++ 6 files changed, 19 insertions(+), 21 deletions(-) diff --git a/src/pages/Claim/ClaimFilter.vue b/src/pages/Claim/ClaimFilter.vue index 37146865c..d86a233b5 100644 --- a/src/pages/Claim/ClaimFilter.vue +++ b/src/pages/Claim/ClaimFilter.vue @@ -122,6 +122,7 @@ const props = defineProps({ en: params: + departmentFk: Department search: Contains clientFk: Customer clientName: Customer @@ -134,6 +135,7 @@ en: zoneFk: Zone es: params: + departmentFk: Departamento search: Contiene clientFk: Cliente clientName: Cliente diff --git a/src/pages/Customer/CustomerFilter.vue b/src/pages/Customer/CustomerFilter.vue index 2ace6dd02..6231036c0 100644 --- a/src/pages/Customer/CustomerFilter.vue +++ b/src/pages/Customer/CustomerFilter.vue @@ -163,6 +163,7 @@ en: email: Email isToBeMailed: Mailed isEqualizated: Equailized + departmentFk: Department businessTypeFk: Business type sageTaxTypeFk: Sage Tax Type sageTransactionTypeFk: Sage Tax Type @@ -173,6 +174,7 @@ en: postcode: Postcode es: params: + departmentFk: Departamento search: Contiene fi: NIF isActive: Activo diff --git a/src/pages/Customer/Defaulter/CustomerDefaulterFilter.vue b/src/pages/Customer/Defaulter/CustomerDefaulterFilter.vue index 0eab7b7c5..c391e4c64 100644 --- a/src/pages/Customer/Defaulter/CustomerDefaulterFilter.vue +++ b/src/pages/Customer/Defaulter/CustomerDefaulterFilter.vue @@ -196,8 +196,10 @@ en: date: L. O. Date credit: Credit I. defaulterSinced: From + departmentFk: Department es: params: + departmentFk: Departamento clientFk: Cliente countryFk: País paymentMethod: F. Pago diff --git a/src/pages/Order/Card/OrderFilter.vue b/src/pages/Order/Card/OrderFilter.vue index 42578423f..362afd044 100644 --- a/src/pages/Order/Card/OrderFilter.vue +++ b/src/pages/Order/Card/OrderFilter.vue @@ -141,8 +141,10 @@ en: myTeam: My Team isConfirmed: Order Confirmed showEmpty: Show Empty + departmentFk: Department es: params: + departmentFk: Departamento search: Búsqueda clientFk: Cliente agencyModeFk: Agencia diff --git a/src/pages/Ticket/TicketFilter.vue b/src/pages/Ticket/TicketFilter.vue index f959157f6..318b27b13 100644 --- a/src/pages/Ticket/TicketFilter.vue +++ b/src/pages/Ticket/TicketFilter.vue @@ -22,16 +22,6 @@ const states = ref([]); const agencies = ref([]); const warehouses = ref([]); const groupedStates = ref([]); - -const getGroupedStates = (data) => { - for (const state of data) { - groupedStates.value.push({ - id: state.id, - name: t(`${state.code}`), - code: state.code, - }); - } -};