-
-
Responsive monitor
-
Dashboard page..
+
+
+
Responsive monitor
+
Dashboard page..
+
-
-
+
+
diff --git a/src/pages/Login/Login.vue b/src/pages/Login/Login.vue
index a49222ab4..4166c10b0 100644
--- a/src/pages/Login/Login.vue
+++ b/src/pages/Login/Login.vue
@@ -1,6 +1,6 @@
+
+
+
+
+
+
+ Customer ID: {{ entityId }}
+
+
+
+
+
+
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..ebc291933 100644
--- a/src/pages/Ticket/TicketList.vue
+++ b/src/pages/Ticket/TicketList.vue
@@ -0,0 +1,110 @@
+
+
+
+
+
+
+
+
+
+ {{ customer.name }}
+ @{{ customer.username }}
+
+
+
+
+ Email
+ {{ customer.email }}
+
+
+
+
+ Phone
+ {{ customer.phone }}
+
+
+
+
+
+
+
+
+
+ Action 1
+
+
+ Action 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Address
+ Avenue 11
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/pages/Ticket/TicketMain.vue b/src/pages/Ticket/TicketMain.vue
new file mode 100644
index 000000000..731ebb803
--- /dev/null
+++ b/src/pages/Ticket/TicketMain.vue
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/router/index.js b/src/router/index.js
index 221671eb0..dae8969eb 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -1,11 +1,16 @@
import { route } from 'quasar/wrappers';
import { createRouter, createMemoryHistory, createWebHistory, createWebHashHistory } from 'vue-router';
+import { Notify } from 'quasar';
import routes from './routes';
import { i18n } from 'src/boot/i18n';
+import { useState } from 'src/composables/useState';
import { useSession } from 'src/composables/useSession';
import { useRole } from 'src/composables/useRole';
+
+const state = useState();
const session = useSession();
const role = useRole();
+const { t } = i18n.global;
/*
* If not building with SSR mode, you can
@@ -33,12 +38,29 @@ export default route(function (/* { store, ssrContext } */) {
history: createHistory(process.env.MODE === 'ssr' ? void 0 : process.env.VUE_ROUTER_BASE),
});
- Router.beforeEach((to, from, next) => {
+ Router.beforeEach(async (to, from, next) => {
const { isLoggedIn } = session;
if (!isLoggedIn() && to.name !== 'Login') {
- next({ name: 'Login', query: { redirect: to.fullPath } });
- } else {
+ return next({ name: 'Login', query: { redirect: to.fullPath } });
+ }
+
+ if (isLoggedIn()) {
+ try {
+ const stateRoles = state.getRoles().value;
+ if (stateRoles.length === 0) {
+ await role.fetch();
+ }
+ } catch (error) {
+ Notify.create({
+ message: t('errors.statusUnauthorized'),
+ type: 'negative',
+ });
+
+ session.destroy();
+ return next({ path: '/login' });
+ }
+
const matches = to.matched;
const hasRequiredRoles = matches.every(route => {
const meta = route.meta;
@@ -47,16 +69,15 @@ export default route(function (/* { store, ssrContext } */) {
return true;
});
- if (hasRequiredRoles) {
- next();
- } else {
- next({ path: '/' });
+ if (!hasRequiredRoles) {
+ return next({ path: '/' });
}
}
+
+ next();
});
Router.afterEach((to) => {
- const { t } = i18n.global;
let title = t(`login.title`);
const matches = to.matched;
diff --git a/src/router/modules/customer.js b/src/router/modules/customer.js
index 948fcc4c3..9fc377f62 100644
--- a/src/router/modules/customer.js
+++ b/src/router/modules/customer.js
@@ -1,29 +1,40 @@
+import { RouterView } from 'vue-router';
+
export default {
path: '/customer',
name: 'Customer',
meta: {
title: 'customers',
- icon: 'vn:client',
- roles: ['salesPerson'],
+ icon: 'vn:client'
},
- 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',
+ icon: 'view_list',
+ },
+ component: () => import('src/pages/Customer/CustomerList.vue'),
+ },
+ {
+ path: 'create',
+ name: 'CustomerCreate',
+ meta: {
+ title: 'createCustomer',
+ icon: 'vn:addperson',
+ },
+ component: () => import('src/pages/Customer/CustomerCreate.vue'),
+ },
+ ]
},
{
path: ':id',
@@ -40,5 +51,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..8920b1104 100644
--- a/src/router/modules/ticket.js
+++ b/src/router/modules/ticket.js
@@ -1,18 +1,57 @@
+import { RouterView } from 'vue-router';
+
export default {
path: '/ticket',
name: 'Ticket',
meta: {
title: 'tickets',
- icon: 'vn:ticket',
+ icon: 'vn:ticket'
},
- 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',
+ icon: 'view_list',
+ },
+ component: () => import('src/pages/Ticket/TicketList.vue'),
+ },
+ {
+ path: 'create',
+ name: 'TicketCreate',
+ meta: {
+ title: 'createTicket',
+ icon: 'vn:ticketAdd',
+ roles: ['salesPerson'],
+ },
+ component: () => import('src/pages/Ticket/TicketList.vue'),
+ },
+
+ ]
+ },
+ {
+ path: ':id',
+ component: () => import('src/pages/Ticket/Card/TicketCard.vue'),
+ redirect: { name: 'TicketBasicData' },
+ children: [
+ {
+ path: 'basic-data',
+ name: 'TicketBasicData',
+ meta: {
+ title: 'basicData'
+ },
+ component: () => import('src/pages/Ticket/Card/TicketBasicData.vue'),
+ }
+ ]
+ },
+ ]
};
\ No newline at end of file
diff --git a/src/router/routes.js b/src/router/routes.js
index d4b63df1d..6905c4116 100644
--- a/src/router/routes.js
+++ b/src/router/routes.js
@@ -20,16 +20,16 @@ const routes = [
meta: { title: 'dashboard', icon: 'dashboard' },
component: () => import('../pages/Dashboard/Dashboard.vue'),
},
- /* {
- path: '/:pathMatch(.*)*',
- name: 'NotFound',
- component: () => import('../pages/NotFound.vue'),
- }, */
// Module routes
customer,
ticket,
],
},
+ {
+ path: '/:pathMatch(.*)*',
+ name: 'NotFound',
+ component: () => import('../pages/NotFound.vue'),
+ }
];
export default routes;
\ No newline at end of file
diff --git a/src/types/route.ts b/src/types/route.ts
deleted file mode 100644
index ea7b84d42..000000000
--- a/src/types/route.ts
+++ /dev/null
@@ -1,4 +0,0 @@
-export interface Route {
- path: string;
- component: any;
-}
\ No newline at end of file