From 5645e03a2d6168c5b795a9e4fba56fb8360929bf Mon Sep 17 00:00:00 2001 From: Jon Date: Mon, 24 Feb 2025 10:44:28 +0100 Subject: [PATCH 01/14] 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 653259aeae14c6707b6dee1f88f60ae9b89463f8 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Tue, 25 Feb 2025 14:41:32 +0100 Subject: [PATCH 02/14] 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 03/14] 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 04/14] 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 05/14] 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 () => { - - - - + + +