From a864e2786b06b01ffa9c82fe64f9816a107ed875 Mon Sep 17 00:00:00 2001 From: joan Date: Tue, 14 Feb 2023 14:59:39 +0100 Subject: [PATCH] Navigate through card/index --- src/components/ui/VnSearchbar.vue | 23 +- src/composables/useArrayData.js | 4 +- .../Customer/Card/CustomerDescriptor.vue | 66 ++++-- src/pages/Customer/CustomerFilter.vue | 213 +++++++++--------- src/pages/Customer/CustomerList.vue | 17 +- src/pages/Customer/CustomerMain.vue | 5 - src/pages/Ticket/TicketFilter.vue | 0 src/pages/Ticket/TicketList.vue | 90 +++++--- 8 files changed, 237 insertions(+), 181 deletions(-) create mode 100644 src/pages/Ticket/TicketFilter.vue diff --git a/src/components/ui/VnSearchbar.vue b/src/components/ui/VnSearchbar.vue index 2f184fbe7..6c0809c8b 100644 --- a/src/components/ui/VnSearchbar.vue +++ b/src/components/ui/VnSearchbar.vue @@ -2,12 +2,18 @@ import { onMounted, ref } from 'vue'; import { useRouter } from 'vue-router'; import { useArrayData } from 'composables/useArrayData'; +import { route } from 'quasar/wrappers'; const props = defineProps({ dataKey: { type: String, required: true, }, + label: { + type: String, + required: false, + default: 'Search', + }, redirect: { type: Boolean, required: false, @@ -16,6 +22,7 @@ const props = defineProps({ }); const router = useRouter(); +// const route = useRoute(); const arrayData = useArrayData(props.dataKey); const store = arrayData.store; const searchText = ref(); @@ -28,20 +35,26 @@ onMounted(() => { }); async function search() { - console.log('search!'); await arrayData.apply({ params: { search: searchText.value, }, }); if (!props.redirect) return; - + console.log(route.query); const rows = store.data; - if (rows.length === 1) { const firstRow = rows[0]; router.push({ path: `/customer/${firstRow.id}` }); + } else { + router.replace({ path: `/customer` }); } + + // if (route.matched.length > 2) { + + // } else { + + // } } @@ -50,9 +63,9 @@ async function search() { + + +{ + "en": { + "ticketList": "Customer ticket list", + "invoiceOutList": "Customer invoice out list" + }, + "es": { + "ticketList": "Listado de tickets del cliente", + "invoiceOutList": "Listado de facturas del cliente" + } +} + diff --git a/src/pages/Customer/CustomerFilter.vue b/src/pages/Customer/CustomerFilter.vue index 237cc192c..dcc363487 100644 --- a/src/pages/Customer/CustomerFilter.vue +++ b/src/pages/Customer/CustomerFilter.vue @@ -1,13 +1,14 @@