From 984b1f9e24c66fe2570ef40216b5fff42b5e64f9 Mon Sep 17 00:00:00 2001 From: joan Date: Thu, 16 Feb 2023 15:01:02 +0100 Subject: [PATCH] Added ticket filter panel --- src/components/ui/VnFilterPanel.vue | 71 +++++--- src/components/ui/VnSearchbar.vue | 1 - src/composables/useArrayData.js | 14 +- src/pages/Ticket/TicketFilter.vue | 261 ++++++++++++++++++++++++++++ src/pages/Ticket/TicketList.vue | 31 +--- src/pages/Ticket/TicketMain.vue | 2 +- 6 files changed, 318 insertions(+), 62 deletions(-) diff --git a/src/components/ui/VnFilterPanel.vue b/src/components/ui/VnFilterPanel.vue index 777ef5bfe..e1e3c9719 100644 --- a/src/components/ui/VnFilterPanel.vue +++ b/src/components/ui/VnFilterPanel.vue @@ -1,7 +1,9 @@ + + + { + "en": { + "appliedFilters": "Applied filters" + }, + "es": { + "appliedFilters": "Filtros aplicados" + } + } + diff --git a/src/components/ui/VnSearchbar.vue b/src/components/ui/VnSearchbar.vue index d8e6efcf2..f380079d5 100644 --- a/src/components/ui/VnSearchbar.vue +++ b/src/components/ui/VnSearchbar.vue @@ -49,7 +49,6 @@ async function search() { const firstRow = rows[0]; const stateName = `${moduleRoute.name}Card`; await router.push({ name: stateName, params: { id: firstRow.id } }); - arrayData.updateStateParams(); } else if (route.matched.length > 3) { await router.push({ name: moduleRoute.name }); arrayData.updateStateParams(); diff --git a/src/composables/useArrayData.js b/src/composables/useArrayData.js index 6c9558637..37d6febc7 100644 --- a/src/composables/useArrayData.js +++ b/src/composables/useArrayData.js @@ -127,14 +127,16 @@ export function useArrayData(key, userOptions) { } function updateStateParams() { + const query = {}; + if (store.order) query.order = store.order; + if (store.limit) query.limit = store.limit; + if (store.skip) query.skip = store.skip; + if (store.userParams && Object.keys(store.userParams).length !== 0) + query.params = JSON.stringify(store.userParams); + router.replace({ path: route.path, - query: { - order: store.order, - limit: store.limit, - skip: store.skip, - params: JSON.stringify(store.userParams), - }, + query: query, }); } diff --git a/src/pages/Ticket/TicketFilter.vue b/src/pages/Ticket/TicketFilter.vue index e69de29bb..7a4849bbb 100644 --- a/src/pages/Ticket/TicketFilter.vue +++ b/src/pages/Ticket/TicketFilter.vue @@ -0,0 +1,261 @@ + + + + + +{ + "en": { + "search": "Contains", + "clientFk": 'Client', + "dateFrom": 'From', + "dateTo": 'To' + }, + "es": { + "search": "Contiene", + "clientFk": 'Cliente', + "dateFrom": 'Desde', + "dateTo": 'Hasta' + } +} + diff --git a/src/pages/Ticket/TicketList.vue b/src/pages/Ticket/TicketList.vue index aeebc6d09..dc96b9300 100644 --- a/src/pages/Ticket/TicketList.vue +++ b/src/pages/Ticket/TicketList.vue @@ -10,8 +10,7 @@ import TicketSummaryDialog from './Card/TicketSummaryDialog.vue'; import TeleportSlot from 'components/ui/TeleportSlot.vue'; import VnSearchbar from 'src/components/ui/VnSearchbar.vue'; -import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue'; -// import FetchData from 'components/FetchData.vue'; +import TicketFilter from './TicketFilter.vue'; const router = useRouter(); const quasar = useQuasar(); @@ -76,33 +75,7 @@ function viewSummary(id) { - - - +