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', 'branch_manager', ]) ) { 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: '/workflow', name: 'Workflow', component: () => import('pages/04_flow-managment/MainPage.vue'), }, { path: '/property', name: 'Property', component: () => import('pages/04_property-managment/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: '/agencies-management', name: 'agencies-management', component: () => import('pages/07_agencies-management/MainPage.vue'), }, { path: '/request-list', name: 'RequestList', component: () => import('pages/08_request-list/MainPage.vue'), }, { path: '/task-order', name: 'TaskOrder', component: () => import('pages/09_task-order/MainPage.vue'), }, { path: '/invoice', name: '/Invoice', component: () => import('pages/10_invoice/MainPage.vue'), }, { path: '/credit-note', name: 'CreditNote', component: () => import('pages/11_credit-note/MainPage.vue'), }, { path: '/debit-note', name: 'debitNote', component: () => import('pages/12_debit-note/MainPage.vue'), }, { path: '/receipt', name: 'receipt', component: () => import('pages/13_receipt/MainPage.vue'), }, { path: '/report', name: 'report', component: () => import('pages/14_report/MainPage.vue'), }, { path: '/dash-board', name: 'dashBoard', component: () => import('pages/15_dash-board/MainPage.vue'), }, { path: '/notification', name: 'Notification', component: () => import('pages/00_notification/MainPage.vue'), }, { path: '/manual', name: 'Manual', component: () => import('pages/00_manual/MainPage.vue'), }, { path: '/manual/:category/:page', name: 'ManualView', component: () => import('pages/00_manual/ViewPage.vue'), }, { path: '/troubleshooting', name: 'Troubleshooting', component: () => import('pages/00_manual/MainPage.vue'), }, { path: '/troubleshooting/:category/:page', name: 'TroubleshootingView', component: () => import('pages/00_manual/ViewPage.vue'), }, ], }, { path: '/quotation/add', name: 'QuotationAdd', component: () => import('pages/05_quotation/QuotationForm.vue'), }, { path: '/quotation/view', name: 'QuotationView', component: () => import('pages/05_quotation/QuotationForm.vue'), }, { path: '/quotation/document-view', name: 'QuotationDocumentView', component: () => import('pages/05_quotation/preview/ViewForm.vue'), }, { path: '/request-list/:requestListId', name: 'requestListView', component: () => import('pages/08_request-list/RequestListView.vue'), }, { path: '/task-order/add', name: 'TaskOrderAdd', component: () => import('pages/09_task-order/order_view/MainPage.vue'), }, { path: '/task-order/:id', name: 'TaskOrderView', component: () => import('pages/09_task-order/PageView.vue'), }, { path: '/task-order/:id/doc-product-receive', name: 'docReceive', component: () => import('pages/09_task-order/document_view/MainPage.vue'), }, { path: '/task-order/:id/doc-product-order', name: 'docOrder', component: () => import('pages/09_task-order/document_view/MainPage.vue'), }, { path: '/credit-note/add', name: 'CreditNoteNew', component: () => import('pages/11_credit-note/FormPage.vue'), }, { path: '/credit-note/:id', name: 'CreditNoteView', component: () => import('pages/11_credit-note/FormPage.vue'), }, { path: '/credit-note/document-view', name: 'CreditNoteDocumentView', component: () => import('pages/11_credit-note/document-view/MainPage.vue'), }, { path: '/receipt/:id', name: 'receiptform', component: () => import('pages/13_receipt/MainPage.vue'), }, { path: '/debit-note/add', name: 'DebitNoteNew', component: () => import('pages/12_debit-note/FormPage.vue'), }, { path: '/debit-note/:id', name: 'DebitNoteView', component: () => import('pages/12_debit-note/FormPage.vue'), }, { path: '/debit-note/document-view', name: 'DebitNoteDocumentView', component: () => import('pages/12_debit-note/document-view/MainPage.vue'), }, // Always leave this as last one, // but you can also remove it { path: '/:catchAll(.*)*', component: () => import('pages/error/NotFound.vue'), }, ]; export default routes;