From ac8e9cbfd25e2391627943e0ab50990438886b87 Mon Sep 17 00:00:00 2001 From: jtubau Date: Wed, 29 Jan 2025 12:43:02 +0100 Subject: [PATCH 01/33] refactor: refs #7414 update VnLog component to change display order value changes on update action --- src/components/common/VnLog.vue | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/components/common/VnLog.vue b/src/components/common/VnLog.vue index fdf2e52ee..d1d8d8360 100644 --- a/src/components/common/VnLog.vue +++ b/src/components/common/VnLog.vue @@ -641,16 +641,7 @@ watch( > {{ prop.nameI18n }}: - - - #{{ prop.val.id }} - - - ← - #{{ prop.old.id }} + + → + + + #{{ prop.val.id }} + From 3172ce8cecad5659239f2c7f66e4f86f43dff21b Mon Sep 17 00:00:00 2001 From: jtubau Date: Mon, 10 Feb 2025 09:40:43 +0100 Subject: [PATCH 02/33] fix: refs #7414 updated default value rendering for non-update scenarios --- src/components/common/VnLog.vue | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/src/components/common/VnLog.vue b/src/components/common/VnLog.vue index a90766c84..5a70edf6c 100644 --- a/src/components/common/VnLog.vue +++ b/src/components/common/VnLog.vue @@ -641,24 +641,20 @@ watch( > {{ prop.nameI18n }}: - - - #{{ prop.old.id }} - + + + #{{ prop.old.id }} + - - #{{ prop.val.id }} + + #{{ prop.val.id }} + + + + #{{ prop.old.id }} From 12aeb63f27ad9e10e844a55a8bee4b5396db249e Mon Sep 17 00:00:00 2001 From: jtubau Date: Wed, 12 Feb 2025 12:27:57 +0100 Subject: [PATCH 03/33] fix: refs #7414 update VnLog.vue to correctly display log actions and values --- src/components/common/VnLog.vue | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/src/components/common/VnLog.vue b/src/components/common/VnLog.vue index a90766c84..8f106a9f1 100644 --- a/src/components/common/VnLog.vue +++ b/src/components/common/VnLog.vue @@ -641,7 +641,8 @@ watch( > {{ prop.nameI18n }}: - + #{{ prop.old.id }} - → - - - #{{ prop.val.id }} + + + #{{ prop.val.id }} + + + + #{{ prop.old.id }} From 5fc221b52c7bd16987355fc1bf81181453de2f28 Mon Sep 17 00:00:00 2001 From: jtubau Date: Fri, 21 Feb 2025 09:11:09 +0100 Subject: [PATCH 04/33] test: refs #8620 add RouteAutonomous e2e test --- .../integration/route/routeAutonomous.spec.js | 121 ++++++++++++++++++ 1 file changed, 121 insertions(+) create mode 100644 test/cypress/integration/route/routeAutonomous.spec.js diff --git a/test/cypress/integration/route/routeAutonomous.spec.js b/test/cypress/integration/route/routeAutonomous.spec.js new file mode 100644 index 000000000..acf82bd95 --- /dev/null +++ b/test/cypress/integration/route/routeAutonomous.spec.js @@ -0,0 +1,121 @@ +describe('RouteAutonomous', () => { + const getLinkSelector = (colField) => + `tr:first-child > [data-col-field="${colField}"] > .no-padding > .link`; + + const selectors = { + reference: 'Reference_input', + date: 'tr:first-child > [data-col-field="dated"]', + total: '.value > .text-h6', + received: getLinkSelector('invoiceInFk'), + autonomous: getLinkSelector('supplierName'), + firstRowCheckbox: '.q-virtual-scroll__content tr:first-child .q-checkbox__bg', + secondRowCheckbox: '.q-virtual-scroll__content tr:nth-child(2) .q-checkbox__bg', + createInvoiceBtn: '.q-card > .q-btn', + saveFormBtn: 'FormModelPopup_save', + summaryIcon: 'tableAction-0', + summaryPopupBtn: '.header > :nth-child(2) > .q-btn__content > .q-icon', + summaryHeader: '.summaryHeader > :nth-child(2)', + descriptorHeader: '.summaryHeader > div', + descriptorTitle: '.q-item__label--header > .title > span', + summaryGoToSummaryBtn: '.header > .q-icon', + descriptorGoToSummaryBtn: '.descriptor > .header > a[href] > .q-btn', + }; + + const data = { + reference: 'Test invoice', + total: '€206.40', + supplier: 'PLANTS SL', + route: 'first route', + }; + + const summaryUrl = '/summary'; + const dataSaved = 'Data saved'; + + beforeEach(() => { + cy.viewport(1920, 1080); + cy.login('developer'); + cy.visit(`/#/route/agency-term`); + cy.typeSearchbar('{enter}'); + }); + + it('Should list autonomous routes', () => { + cy.get('.q-table') + .children() + .should('be.visible') + .should('have.length.greaterThan', 0); + }); + + it('Should create invoice in to selected route', () => { + cy.get(selectors.firstRowCheckbox).click(); + cy.get(selectors.createInvoiceBtn).click(); + cy.dataCy(selectors.reference).type(data.reference); + cy.get('.q-file').selectFile('test/cypress/fixtures/image.jpg', { + force: true, + }); + cy.dataCy(selectors.saveFormBtn).click(); + cy.checkNotification(dataSaved); + cy.typeSearchbar('{enter}'); + }); + + it('Should display the total price of the selected rows', () => { + cy.get(selectors.firstRowCheckbox).click(); + cy.get(selectors.secondRowCheckbox).click(); + cy.validateContent(selectors.total, data.total); + }); + + it('Should redirect to the summary when clicking a route', () => { + cy.get(selectors.date).click(); + cy.get(selectors.summaryHeader).should('contain', data.route); + cy.url().should('include', summaryUrl); + }); + + describe('Received pop-ups', () => { + it('Should redirect to invoice in summary from the received descriptor pop-up', () => { + cy.get(selectors.received).click(); + cy.validateContent(selectors.descriptorTitle, data.reference); + cy.get(selectors.descriptorGoToSummaryBtn).click(); + cy.get(selectors.descriptorHeader).should('contain', data.supplier); + cy.url().should('include', summaryUrl); + }); + + it('Should redirect to the invoiceIn summary from summary pop-up from the received descriptor pop-up', () => { + cy.get(selectors.received).click(); + cy.validateContent(selectors.descriptorTitle, data.reference); + cy.get(selectors.summaryPopupBtn).click(); + cy.get(selectors.descriptorHeader).should('contain', data.supplier); + cy.get(selectors.summaryGoToSummaryBtn).click(); + cy.get(selectors.descriptorHeader).should('contain', data.supplier); + cy.url().should('include', summaryUrl); + }); + }); + + describe('Autonomous pop-ups', () => { + it('Should redirect to the supplier summary from the received descriptor pop-up', () => { + cy.get(selectors.autonomous).click(); + cy.validateContent(selectors.descriptorTitle, data.supplier); + cy.get(selectors.descriptorGoToSummaryBtn).click(); + cy.get(selectors.summaryHeader).should('contain', data.supplier); + cy.url().should('include', summaryUrl); + }); + + it('Should redirect to the supplier summary from summary pop-up from the autonomous descriptor pop-up', () => { + cy.get(selectors.autonomous).click(); + cy.get(selectors.descriptorTitle).should('contain', data.supplier); + cy.get(selectors.summaryPopupBtn).click(); + cy.get(selectors.summaryHeader).should('contain', data.supplier); + cy.get(selectors.summaryGoToSummaryBtn).click(); + cy.get(selectors.summaryHeader).should('contain', data.supplier); + cy.url().should('include', summaryUrl); + }); + }); + + describe('Route pop-ups', () => { + it('Should redirect to the summary from the route summary pop-up', () => { + cy.dataCy(selectors.summaryIcon).first().click(); + cy.get(selectors.summaryHeader).should('contain', data.route); + cy.get(selectors.summaryGoToSummaryBtn).click(); + cy.get(selectors.summaryHeader).should('contain', data.route); + cy.url().should('include', summaryUrl); + }); + }); +}); From 9e1ab1028d76bbd13bdfcc4b7c58bf1d885e78f1 Mon Sep 17 00:00:00 2001 From: jtubau Date: Fri, 21 Feb 2025 09:11:55 +0100 Subject: [PATCH 05/33] fix: refs #8620 add module name to InvoiceInSummary --- src/pages/InvoiceIn/Card/InvoiceInSummary.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/src/pages/InvoiceIn/Card/InvoiceInSummary.vue b/src/pages/InvoiceIn/Card/InvoiceInSummary.vue index d358601d3..18602f043 100644 --- a/src/pages/InvoiceIn/Card/InvoiceInSummary.vue +++ b/src/pages/InvoiceIn/Card/InvoiceInSummary.vue @@ -185,6 +185,7 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`; data-key="InvoiceInSummary" :url="`InvoiceIns/${entityId}/summary`" @on-fetch="(data) => init(data)" + module-name="InvoiceIn" > From 5645e03a2d6168c5b795a9e4fba56fb8360929bf Mon Sep 17 00:00:00 2001 From: Jon Date: Mon, 24 Feb 2025 10:44:28 +0100 Subject: [PATCH 07/33] fix: fixed style when clicking on icons --- src/components/ui/VnSearchbar.vue | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/ui/VnSearchbar.vue b/src/components/ui/VnSearchbar.vue index 30e4135e2..8607d9694 100644 --- a/src/components/ui/VnSearchbar.vue +++ b/src/components/ui/VnSearchbar.vue @@ -204,8 +204,9 @@ async function search() { } :deep(.q-field--focused) { - .q-icon { - color: black; + .q-icon, + .q-placeholder { + color: var(--vn-black-text-color); } } From c1e4b78253288b25de9a2760afd8d68b292fff92 Mon Sep 17 00:00:00 2001 From: Jon Date: Tue, 25 Feb 2025 14:09:18 +0100 Subject: [PATCH 08/33] fix: fixed negative bases style --- src/pages/InvoiceOut/InvoiceOutNegativeBases.vue | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/pages/InvoiceOut/InvoiceOutNegativeBases.vue b/src/pages/InvoiceOut/InvoiceOutNegativeBases.vue index 135eb9aca..605a9e2cf 100644 --- a/src/pages/InvoiceOut/InvoiceOutNegativeBases.vue +++ b/src/pages/InvoiceOut/InvoiceOutNegativeBases.vue @@ -97,16 +97,19 @@ const columns = computed(() => [ align: 'left', name: 'isActive', label: t('invoiceOut.negativeBases.active'), + component: 'checkbox', }, { align: 'left', name: 'hasToInvoice', label: t('invoiceOut.negativeBases.hasToInvoice'), + component: 'checkbox', }, { align: 'left', - name: 'hasVerifiedData', + name: 'isTaxDataChecked', label: t('invoiceOut.negativeBases.verifiedData'), + component: 'checkbox', }, { align: 'left', @@ -142,7 +145,7 @@ const downloadCSV = async () => { await invoiceOutGlobalStore.getNegativeBasesCsv( userParams.from, userParams.to, - filterParams + filterParams, ); }; From 653259aeae14c6707b6dee1f88f60ae9b89463f8 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Tue, 25 Feb 2025 14:41:32 +0100 Subject: [PATCH 09/33] fix: refreshData --- src/pages/Ticket/Card/TicketSale.vue | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/pages/Ticket/Card/TicketSale.vue b/src/pages/Ticket/Card/TicketSale.vue index 076e06dea..8f586b231 100644 --- a/src/pages/Ticket/Card/TicketSale.vue +++ b/src/pages/Ticket/Card/TicketSale.vue @@ -202,7 +202,7 @@ const updateQuantity = async (sale) => { sale.isNew = false; await axios.post(`Sales/${id}/updateQuantity`, { quantity }); notify('globals.dataSaved', 'positive'); - tableRef.value.reload(); + resetChanges(); } catch (e) { const { quantity } = tableRef.value.CrudModelRef.originalData.find( (s) => s.id === sale.id, @@ -246,7 +246,7 @@ const updateConcept = async (sale) => { const data = { newConcept: sale.concept }; await axios.post(`Sales/${sale.id}/updateConcept`, data); notify('globals.dataSaved', 'positive'); - tableRef.value.reload(); + resetChanges(); }; const DEFAULT_EDIT = { @@ -297,7 +297,7 @@ const updatePrice = async (sale, newPrice) => { sale.price = newPrice; edit.value = { ...DEFAULT_EDIT }; notify('globals.dataSaved', 'positive'); - tableRef.value.reload(); + resetChanges(); }; const changeDiscount = async (sale) => { @@ -329,7 +329,7 @@ const updateDiscount = async (sales, newDiscount = null) => { }; await axios.post(`Tickets/${route.params.id}/updateDiscount`, params); notify('globals.dataSaved', 'positive'); - tableRef.value.reload(); + resetChanges(); }; const getNewPrice = computed(() => { @@ -397,7 +397,7 @@ const removeSales = async () => { await axios.post('Sales/deleteSales', params); removeSelectedSales(); notify('globals.dataSaved', 'positive'); - window.location.reload(); + resetChanges(); }; const setTransferParams = async () => { From cb220ce268b523abee4899423c99bbc219ed5496 Mon Sep 17 00:00:00 2001 From: jorgep Date: Tue, 25 Feb 2025 18:14:32 +0100 Subject: [PATCH 10/33] fix: refs #8078 enhance row selection logic in VnTable component --- src/components/VnTable/VnTable.vue | 10 ++++- .../VnTable/__tests__/VnTable.spec.js | 40 ++++++++++++++++--- 2 files changed, 42 insertions(+), 8 deletions(-) diff --git a/src/components/VnTable/VnTable.vue b/src/components/VnTable/VnTable.vue index 6e5f9fef4..a5173374b 100644 --- a/src/components/VnTable/VnTable.vue +++ b/src/components/VnTable/VnTable.vue @@ -295,8 +295,14 @@ function handleSelection({ evt, added, rows: selectedRows }, rows) { if (evt?.shiftKey && added) { const rowIndex = selectedRows[0].$index; const selectedIndexes = new Set(selected.value.map((row) => row.$index)); - for (const row of rows) { - if (row.$index == rowIndex) break; + const minIndex = selectedIndexes.size + ? Math.min(...selectedIndexes, rowIndex) + : 0; + const maxIndex = Math.max(...selectedIndexes, rowIndex); + + for (let i = minIndex; i <= maxIndex; i++) { + const row = rows[i]; + if (row.$index == rowIndex) continue; if (!selectedIndexes.has(row.$index)) { selected.value.push(row); selectedIndexes.add(row.$index); diff --git a/src/components/VnTable/__tests__/VnTable.spec.js b/src/components/VnTable/__tests__/VnTable.spec.js index 74ba06987..e5e38a63c 100644 --- a/src/components/VnTable/__tests__/VnTable.spec.js +++ b/src/components/VnTable/__tests__/VnTable.spec.js @@ -27,30 +27,58 @@ describe('VnTable', () => { beforeEach(() => (vm.selected = [])); describe('handleSelection()', () => { - const rows = [{ $index: 0 }, { $index: 1 }, { $index: 2 }]; - const selectedRows = [{ $index: 1 }]; - it('should add rows to selected when shift key is pressed and rows are added except last one', () => { + const rows = [ + { $index: 0 }, + { $index: 1 }, + { $index: 2 }, + { $index: 3 }, + { $index: 4 }, + ]; + + it('should add rows to selected when shift key is pressed and rows are added in ascending order', () => { + const selectedRows = [{ $index: 1 }]; vm.handleSelection( { evt: { shiftKey: true }, added: true, rows: selectedRows }, - rows + rows, ); expect(vm.selected).toEqual([{ $index: 0 }]); }); + it('should add rows to selected when shift key is pressed and rows are added in descending order', () => { + const selectedRows = [{ $index: 3 }]; + vm.handleSelection( + { evt: { shiftKey: true }, added: true, rows: selectedRows }, + rows, + ); + expect(vm.selected).toEqual([{ $index: 0 }, { $index: 1 }, { $index: 2 }]); + }); + it('should not add rows to selected when shift key is not pressed', () => { + const selectedRows = [{ $index: 1 }]; vm.handleSelection( { evt: { shiftKey: false }, added: true, rows: selectedRows }, - rows + rows, ); expect(vm.selected).toEqual([]); }); it('should not add rows to selected when rows are not added', () => { + const selectedRows = [{ $index: 1 }]; vm.handleSelection( { evt: { shiftKey: true }, added: false, rows: selectedRows }, - rows + rows, ); expect(vm.selected).toEqual([]); }); + + it('should add all rows between the smallest and largest selected indexes', () => { + vm.selected = [{ $index: 1 }, { $index: 3 }]; + const selectedRows = [{ $index: 4 }]; + vm.handleSelection( + { evt: { shiftKey: true }, added: true, rows: selectedRows }, + rows, + ); + expect(vm.selected).toEqual([{ $index: 1 }, { $index: 3 }, { $index: 2 }]); + }); }); }); From 0225dcc736f8ba749688a96fa6a8f33b168682f6 Mon Sep 17 00:00:00 2001 From: jtubau Date: Wed, 26 Feb 2025 11:47:31 +0100 Subject: [PATCH 11/33] fix: fixed agency and vehicle Fk and add select fields on create form --- src/pages/Route/RouteList.vue | 40 ++++++++++++++++++++++++++++++++--- 1 file changed, 37 insertions(+), 3 deletions(-) diff --git a/src/pages/Route/RouteList.vue b/src/pages/Route/RouteList.vue index bc3227f6c..899b3b8c3 100644 --- a/src/pages/Route/RouteList.vue +++ b/src/pages/Route/RouteList.vue @@ -38,6 +38,17 @@ const columns = computed(() => [ align: 'left', name: 'workerFk', label: t('route.Worker'), + component: 'select', + attrs: { + url: 'Workers/activeWithInheritedRole', + fields: ['id', 'name'], + useLike: false, + optionFilter: 'firstName', + find: { + value: 'workerFk', + label: 'workerUserName', + }, + }, create: true, cardVisible: true, format: (row, dashIfEmpty) => dashIfEmpty(row.travelRef), @@ -45,18 +56,40 @@ const columns = computed(() => [ }, { align: 'left', - name: 'agencyName', + name: 'agencyModeFk', label: t('route.Agency'), + format: (row) => row?.agencyName, cardVisible: true, + component: 'select', + attrs: { + url: 'agencyModes', + fields: ['id', 'name'], + find: { + value: 'agencyModeFk', + label: 'agencyName', + }, + }, create: true, columnClass: 'expand', columnFilter: false, }, { align: 'left', - name: 'vehiclePlateNumber', + name: 'vehicleFk', label: t('route.Vehicle'), + format: (row) => row?.vehiclePlateNumber, cardVisible: true, + component: 'select', + attrs: { + url: 'vehicles', + fields: ['id', 'numberPlate'], + optionLabel: 'numberPlate', + optionFilterValue: 'numberPlate', + find: { + value: 'vehicleFk', + label: 'vehiclePlateNumber', + }, + }, create: true, columnFilter: false, }, @@ -124,6 +157,7 @@ const columns = computed(() => [ - + \ No newline at end of file From 754d673d0bcdfeb128c2cb734b80a19789cdd0c2 Mon Sep 17 00:00:00 2001 From: pablone Date: Wed, 26 Feb 2025 12:19:51 +0100 Subject: [PATCH 12/33] refactor: update ItemDescriptor to use dynamic labels for values --- src/pages/Item/Card/ItemDescriptor.vue | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/src/pages/Item/Card/ItemDescriptor.vue b/src/pages/Item/Card/ItemDescriptor.vue index c6fee8540..cac11c275 100644 --- a/src/pages/Item/Card/ItemDescriptor.vue +++ b/src/pages/Item/Card/ItemDescriptor.vue @@ -122,22 +122,9 @@ const updateStock = async () => { - - - - + + +