From a60351a0e997cce65f13fc8ee8b53fd0fafcd944 Mon Sep 17 00:00:00 2001 From: joan Date: Tue, 19 Apr 2022 12:37:47 +0200 Subject: [PATCH] Routing changes --- src/layouts/MainLayout.vue | 2 +- src/pages/Customer/Card/CustomerCard.vue | 23 ++-- src/pages/Customer/CustomerLayout.vue | 3 - src/pages/Customer/CustomerList.vue | 32 ------ src/pages/Customer/CustomerMain.vue | 1 - src/pages/Dashboard/Dashboard.vue | 138 +++++++++++------------ src/pages/Dashboard/DashboardLayout.vue | 17 --- src/pages/Ticket/TicketLayout.vue | 3 - src/pages/Ticket/TicketList.vue | 105 +++++++++++++++++ src/pages/Ticket/TicketMain.vue | 19 ++++ src/router/modules/customer.js | 36 +++--- src/router/modules/ticket.js | 44 ++++++-- src/router/routes.js | 60 ++-------- 13 files changed, 265 insertions(+), 218 deletions(-) delete mode 100644 src/pages/Customer/CustomerLayout.vue delete mode 100644 src/pages/Dashboard/DashboardLayout.vue delete mode 100644 src/pages/Ticket/TicketLayout.vue create mode 100644 src/pages/Ticket/TicketMain.vue diff --git a/src/layouts/MainLayout.vue b/src/layouts/MainLayout.vue index 4d43d79b8..2bb425ab1 100644 --- a/src/layouts/MainLayout.vue +++ b/src/layouts/MainLayout.vue @@ -13,7 +13,7 @@ import Navbar from 'src/components/Navbar.vue'; diff --git a/src/pages/Customer/Card/CustomerCard.vue b/src/pages/Customer/Card/CustomerCard.vue index 02db481f6..5d5b3ac0d 100644 --- a/src/pages/Customer/Card/CustomerCard.vue +++ b/src/pages/Customer/Card/CustomerCard.vue @@ -1,15 +1,12 @@ - - diff --git a/src/pages/Customer/CustomerLayout.vue b/src/pages/Customer/CustomerLayout.vue deleted file mode 100644 index 2785996d8..000000000 --- a/src/pages/Customer/CustomerLayout.vue +++ /dev/null @@ -1,3 +0,0 @@ - diff --git a/src/pages/Customer/CustomerList.vue b/src/pages/Customer/CustomerList.vue index 22dc02b7b..cf5dfcb4b 100644 --- a/src/pages/Customer/CustomerList.vue +++ b/src/pages/Customer/CustomerList.vue @@ -25,14 +25,9 @@ const customers = [ function navigate(id) { router.push({ path: `/customer/${id}` }); } - -// function onToggleDrawer() { -// drawer.value = !drawer.value; -// } diff --git a/src/pages/Dashboard/Dashboard.vue b/src/pages/Dashboard/Dashboard.vue index f02d33f3f..62f752875 100644 --- a/src/pages/Dashboard/Dashboard.vue +++ b/src/pages/Dashboard/Dashboard.vue @@ -1,87 +1,83 @@ - + diff --git a/src/pages/Dashboard/DashboardLayout.vue b/src/pages/Dashboard/DashboardLayout.vue deleted file mode 100644 index 917b15059..000000000 --- a/src/pages/Dashboard/DashboardLayout.vue +++ /dev/null @@ -1,17 +0,0 @@ - - diff --git a/src/pages/Ticket/TicketLayout.vue b/src/pages/Ticket/TicketLayout.vue deleted file mode 100644 index 2785996d8..000000000 --- a/src/pages/Ticket/TicketLayout.vue +++ /dev/null @@ -1,3 +0,0 @@ - diff --git a/src/pages/Ticket/TicketList.vue b/src/pages/Ticket/TicketList.vue index e69de29bb..cf5dfcb4b 100644 --- a/src/pages/Ticket/TicketList.vue +++ b/src/pages/Ticket/TicketList.vue @@ -0,0 +1,105 @@ + + + + + diff --git a/src/pages/Ticket/TicketMain.vue b/src/pages/Ticket/TicketMain.vue new file mode 100644 index 000000000..b763b1202 --- /dev/null +++ b/src/pages/Ticket/TicketMain.vue @@ -0,0 +1,19 @@ + + + diff --git a/src/router/modules/customer.js b/src/router/modules/customer.js index 948fcc4c3..0ff5b0798 100644 --- a/src/router/modules/customer.js +++ b/src/router/modules/customer.js @@ -1,3 +1,5 @@ +import { RouterView } from 'vue-router'; + export default { path: '/customer', name: 'Customer', @@ -6,24 +8,24 @@ export default { icon: 'vn:client', roles: ['salesPerson'], }, - component: () => import('src/pages/Customer/CustomerLayout.vue'), - redirect: { name: 'CustomerList' }, + component: RouterView, + redirect: { name: 'CustomerMain' }, children: [ { - path: 'list', - name: 'CustomerList', - meta: { - title: 'list' - }, - component: () => import('src/pages/Customer/CustomerList.vue'), - }, - { - path: 'create', - name: 'CustomerCreate', - meta: { - title: 'create' - }, - component: () => import('src/pages/Customer/CustomerCreate.vue'), + path: '', + name: 'CustomerMain', + component: () => import('src/pages/Customer/CustomerMain.vue'), + redirect: { name: 'CustomerList' }, + children: [ + { + path: 'list', + name: 'CustomerList', + meta: { + title: 'list' + }, + component: () => import('src/pages/Customer/CustomerList.vue'), + }, + ] }, { path: ':id', @@ -40,5 +42,5 @@ export default { } ] }, - ], + ] }; \ No newline at end of file diff --git a/src/router/modules/ticket.js b/src/router/modules/ticket.js index 6e22a0ecc..f95f2ab34 100644 --- a/src/router/modules/ticket.js +++ b/src/router/modules/ticket.js @@ -1,18 +1,46 @@ +import { RouterView } from 'vue-router'; + export default { path: '/ticket', name: 'Ticket', meta: { title: 'tickets', icon: 'vn:ticket', + roles: ['salesPerson'], }, - component: () => import('src/pages/Ticket/TicketLayout.vue'), - redirect: { path: '/ticket/list' }, + component: RouterView, + redirect: { name: 'TicketMain' }, children: [ { - path: 'list', - name: 'TicketList', - meta: { title: 'list' }, - component: () => import('src/pages/Ticket/TicketList.vue'), - } - ], + path: '', + name: 'TicketMain', + component: () => import('src/pages/Ticket/TicketMain.vue'), + redirect: { name: 'TicketList' }, + children: [ + { + path: 'list', + name: 'TicketList', + meta: { + title: 'list' + }, + component: () => import('src/pages/Ticket/TicketList.vue'), + }, + ] + }, + { + path: ':id', + component: () => import('src/pages/Customer/Card/CustomerCard.vue'), + redirect: { name: 'CustomerBasicData' }, + children: [ + { + path: 'basic-data', + name: 'CustomerBasicData', + meta: { + title: 'basicData' + }, + component: () => import('src/pages/Customer/Card/CustomerBasicData.vue'), + } + ] + }, + ] }; \ No newline at end of file diff --git a/src/router/routes.js b/src/router/routes.js index 652ec4610..6905c4116 100644 --- a/src/router/routes.js +++ b/src/router/routes.js @@ -1,4 +1,4 @@ -//import customer from './modules/customer'; +import customer from './modules/customer'; import ticket from './modules/ticket'; const routes = [ @@ -18,62 +18,18 @@ const routes = [ path: '/dashboard', name: 'Dashboard', meta: { title: 'dashboard', icon: 'dashboard' }, - component: () => import('../pages/Dashboard/DashboardLayout.vue'), + component: () => import('../pages/Dashboard/Dashboard.vue'), }, - { - path: '/customer', - name: 'Customer', - meta: { - title: 'customers', - icon: 'vn:client', - roles: ['salesPerson'], - }, - component: () => import('src/pages/Customer/CustomerLayout.vue'), - redirect: { name: 'CustomerMain' }, - children: [ - { - path: '', - name: 'CustomerMain', - component: () => import('src/pages/Customer/CustomerMain.vue'), - redirect: { name: 'CustomerList' }, - children: [ - { - path: 'list', - name: 'CustomerList', - meta: { - title: 'list' - }, - component: () => import('src/pages/Customer/CustomerList.vue'), - }, - ] - }, - { - path: ':id', - component: () => import('src/pages/Customer/Card/CustomerCard.vue'), - redirect: { name: 'CustomerBasicData' }, - children: [ - { - path: 'basic-data', - name: 'CustomerBasicData', - meta: { - title: 'basicData' - }, - component: () => import('src/pages/Customer/Card/CustomerBasicData.vue'), - } - ] - }, - ] - }, - /* { - path: '/:pathMatch(.*)*', - name: 'NotFound', - component: () => import('../pages/NotFound.vue'), - }, */ // Module routes - //customer, + customer, ticket, ], }, + { + path: '/:pathMatch(.*)*', + name: 'NotFound', + component: () => import('../pages/NotFound.vue'), + } ]; export default routes; \ No newline at end of file