109 lines
2.8 KiB
TypeScript
109 lines
2.8 KiB
TypeScript
import { RouteRecordRaw } from 'vue-router';
|
|
import { isRoleInclude } from 'stores/utils';
|
|
|
|
const routes: RouteRecordRaw[] = [
|
|
{
|
|
path: '',
|
|
redirect: { name: 'Home' },
|
|
component: () => import('layouts/MainLayout.vue'),
|
|
children: [
|
|
{
|
|
path: '/',
|
|
name: 'Home',
|
|
component: () => import('pages/MainPage.vue'),
|
|
},
|
|
{
|
|
path: '/branch-management',
|
|
name: 'BranchManagement',
|
|
beforeEnter: (to, from, next) => {
|
|
if (
|
|
isRoleInclude([
|
|
'admin',
|
|
'branch_admin',
|
|
'head_of_admin',
|
|
'head_of_account',
|
|
'system',
|
|
'owner',
|
|
])
|
|
) {
|
|
next();
|
|
} else {
|
|
next('/');
|
|
}
|
|
},
|
|
component: () => import('pages/01_branch-management/MainPage.vue'),
|
|
},
|
|
{
|
|
path: '/personnel-management',
|
|
name: 'PersonnelManagement',
|
|
beforeEnter: (to, from, next) => {
|
|
if (
|
|
isRoleInclude([
|
|
'admin',
|
|
'branch_admin',
|
|
'head_of_admin',
|
|
'system',
|
|
'owner',
|
|
'branch_manager',
|
|
])
|
|
) {
|
|
next();
|
|
} else {
|
|
next('/');
|
|
}
|
|
},
|
|
component: () => import('pages/02_personnel-management/MainPage.vue'),
|
|
},
|
|
{
|
|
path: '/customer-management',
|
|
name: 'CustomerManagement',
|
|
component: () => import('pages/03_customer-management/MainPage.vue'),
|
|
},
|
|
{
|
|
path: '/customer-management/:customerId',
|
|
name: 'CustomerSpecificManagement',
|
|
component: () => import('pages/03_customer-management/MainPage.vue'),
|
|
},
|
|
{
|
|
path: '/customer-management/:customerId/branch',
|
|
name: 'CustomerBranchManagement',
|
|
component: () => import('pages/03_customer-management/MainPage.vue'),
|
|
},
|
|
{
|
|
path: '/product-service',
|
|
name: 'productAndService',
|
|
component: () => import('pages/04_product-service/MainPage.vue'),
|
|
},
|
|
{
|
|
path: '/quotation',
|
|
name: 'Quotation',
|
|
component: () => import('pages/05_quotation/MainPage.vue'),
|
|
},
|
|
{
|
|
path: '/document-management',
|
|
name: 'document-management',
|
|
component: () => import('pages/06_edm/MainPage.vue'),
|
|
},
|
|
],
|
|
},
|
|
|
|
{
|
|
path: '/quotation/add-quotation',
|
|
name: 'QuotationAdd',
|
|
component: () => import('pages/05_quotation/QuotationForm.vue'),
|
|
},
|
|
{
|
|
path: '/view',
|
|
name: 'view',
|
|
component: () => import('pages/05_quotation/peview/ViewForm.vue'),
|
|
},
|
|
|
|
// Always leave this as last one,
|
|
// but you can also remove it
|
|
{
|
|
path: '/:catchAll(.*)*',
|
|
component: () => import('pages/error/NotFound.vue'),
|
|
},
|
|
];
|
|
|
|
export default routes;
|