2024-04-02 11:02:16 +07:00
|
|
|
import { RouteRecordRaw } from 'vue-router';
|
2024-08-30 12:05:37 +07:00
|
|
|
import { isRoleInclude } from 'stores/utils';
|
2024-04-02 11:02:16 +07:00
|
|
|
|
|
|
|
|
const routes: RouteRecordRaw[] = [
|
|
|
|
|
{
|
|
|
|
|
path: '',
|
|
|
|
|
redirect: { name: 'Home' },
|
|
|
|
|
component: () => import('layouts/MainLayout.vue'),
|
|
|
|
|
children: [
|
|
|
|
|
{
|
|
|
|
|
path: '/',
|
|
|
|
|
name: 'Home',
|
|
|
|
|
component: () => import('pages/MainPage.vue'),
|
|
|
|
|
},
|
2024-04-02 13:44:45 +07:00
|
|
|
{
|
|
|
|
|
path: '/branch-management',
|
|
|
|
|
name: 'BranchManagement',
|
2024-08-30 12:05:37 +07:00
|
|
|
beforeEnter: (to, from, next) => {
|
|
|
|
|
if (
|
|
|
|
|
isRoleInclude([
|
|
|
|
|
'admin',
|
|
|
|
|
'branch_admin',
|
|
|
|
|
'head_of_admin',
|
2024-09-04 14:37:22 +07:00
|
|
|
'head_of_account',
|
2024-08-30 12:05:37 +07:00
|
|
|
'system',
|
|
|
|
|
'owner',
|
|
|
|
|
])
|
|
|
|
|
) {
|
|
|
|
|
next();
|
|
|
|
|
} else {
|
|
|
|
|
next('/');
|
|
|
|
|
}
|
|
|
|
|
},
|
2024-04-02 13:44:45 +07:00
|
|
|
component: () => import('pages/01_branch-management/MainPage.vue'),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
path: '/personnel-management',
|
|
|
|
|
name: 'PersonnelManagement',
|
2024-08-30 12:05:37 +07:00
|
|
|
beforeEnter: (to, from, next) => {
|
|
|
|
|
if (
|
|
|
|
|
isRoleInclude([
|
|
|
|
|
'admin',
|
|
|
|
|
'branch_admin',
|
|
|
|
|
'head_of_admin',
|
|
|
|
|
'system',
|
|
|
|
|
'owner',
|
2024-09-02 09:44:16 +07:00
|
|
|
'branch_manager',
|
2024-08-30 12:05:37 +07:00
|
|
|
])
|
|
|
|
|
) {
|
|
|
|
|
next();
|
|
|
|
|
} else {
|
|
|
|
|
next('/');
|
|
|
|
|
}
|
|
|
|
|
},
|
2024-04-02 13:44:45 +07:00
|
|
|
component: () => import('pages/02_personnel-management/MainPage.vue'),
|
|
|
|
|
},
|
2024-04-22 12:16:17 +07:00
|
|
|
{
|
|
|
|
|
path: '/customer-management',
|
2024-08-02 16:13:22 +07:00
|
|
|
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',
|
2024-04-22 12:16:17 +07:00
|
|
|
component: () => import('pages/03_customer-management/MainPage.vue'),
|
|
|
|
|
},
|
2024-06-10 16:42:40 +07:00
|
|
|
{
|
|
|
|
|
path: '/product-service',
|
|
|
|
|
name: 'productAndService',
|
|
|
|
|
component: () => import('pages/04_product-service/MainPage.vue'),
|
|
|
|
|
},
|
2024-06-19 15:43:58 +07:00
|
|
|
{
|
2024-07-25 09:27:58 +07:00
|
|
|
path: '/quotation',
|
|
|
|
|
name: 'Quotation',
|
|
|
|
|
component: () => import('pages/05_quotation/MainPage.vue'),
|
2024-06-19 15:43:58 +07:00
|
|
|
},
|
2024-10-24 18:08:05 +07:00
|
|
|
{
|
|
|
|
|
path: '/workflow',
|
|
|
|
|
name: 'Workflow',
|
|
|
|
|
component: () => import('pages/04_flow-managment/MainPage.vue'),
|
|
|
|
|
},
|
2024-08-13 17:15:55 +07:00
|
|
|
{
|
2024-08-14 19:53:23 +07:00
|
|
|
path: '/document-management',
|
2024-08-13 17:15:55 +07:00
|
|
|
name: 'document-management',
|
|
|
|
|
component: () => import('pages/06_edm/MainPage.vue'),
|
|
|
|
|
},
|
2024-11-08 13:11:42 +07:00
|
|
|
{
|
|
|
|
|
path: '/agencies-management',
|
|
|
|
|
name: 'agencies-management',
|
|
|
|
|
component: () => import('pages/07_agencies-management/MainPage.vue'),
|
|
|
|
|
},
|
2024-04-02 11:02:16 +07:00
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
|
2024-09-27 15:45:24 +07:00
|
|
|
{
|
2024-11-07 14:55:16 +07:00
|
|
|
path: '/quotation/add',
|
2024-09-27 15:45:24 +07:00
|
|
|
name: 'QuotationAdd',
|
|
|
|
|
component: () => import('pages/05_quotation/QuotationForm.vue'),
|
|
|
|
|
},
|
2024-11-07 14:55:16 +07:00
|
|
|
{
|
|
|
|
|
path: '/quotation/view',
|
|
|
|
|
name: 'QuotationView',
|
|
|
|
|
component: () => import('pages/05_quotation/QuotationForm.vue'),
|
|
|
|
|
},
|
2024-10-16 18:03:50 +07:00
|
|
|
{
|
2024-10-18 10:56:10 +07:00
|
|
|
path: '/quotation/document-view',
|
|
|
|
|
name: 'QuotationDocumentView',
|
2024-10-24 16:36:46 +07:00
|
|
|
component: () => import('pages/05_quotation/preview/ViewForm.vue'),
|
2024-10-16 18:03:50 +07:00
|
|
|
},
|
2024-09-27 15:45:24 +07:00
|
|
|
|
2024-04-02 11:02:16 +07:00
|
|
|
// Always leave this as last one,
|
|
|
|
|
// but you can also remove it
|
|
|
|
|
{
|
|
|
|
|
path: '/:catchAll(.*)*',
|
|
|
|
|
component: () => import('pages/error/NotFound.vue'),
|
|
|
|
|
},
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
export default routes;
|