purityselect_admin/resources/js/plugins/1.router/additional-routes.js
2024-10-25 19:58:19 +05:00

338 lines
10 KiB
JavaScript
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

const emailRouteComponent = () => import('@/pages/apps/email/index.vue')
// 👉 Redirects
export const redirects = [
// We are redirecting to different pages based on role.
// NOTE: Role is just for UI purposes. ACL is based on abilities.
{
path: '/admin',
// name: 'index',
redirect: to => {
// TODO: Get type from backend
const userData = useCookie('userData')
const userRole = userData.value?.role
console.log(userRole)
if (userRole)
return { name: 'admin-dashboard' }
if (userRole === 'admin')
return { name: 'admin-dashboard' }
if (userRole === 'client')
return { name: 'access-control' }
return { name: 'login', query: to.query }
},
},
{
path: '/',
// name: 'index',
redirect: to => {
// TODO: Get type from backend
const userData = useCookie('userData')
const userRole = userData.value?.role
if (userRole)
return { name: 'admin-dashboard' }
if (userRole === 'admin')
return { name: 'admin-dashboard' }
if (userRole === 'user')
return { name: 'admin-dashboard' }
if (userRole === 'client')
return { name: 'access-control' }
return { name: 'login', query: to.query }
},
},
{
path: '/pages/user-profile',
name: 'pages-user-profile',
redirect: () => ({ name: 'pages-user-profile-tab', params: { tab: 'profile' } }),
},
{
path: '/pages/account-settings',
name: 'pages-account-settings',
redirect: () => ({ name: 'pages-account-settings-tab', params: { tab: 'account' } }),
meta: {action: 'read', subject: 'Profile Update'},
},
]
export const routes = [
// Email filter
{
path: '/admin/dashboard',
name: 'admin-dashboard',
component: () => import('@/pages/dashboards/analytics.vue'),
meta: {action: 'read', subject: 'Dashboard Data'},
},
{
path: '/admin/account-settings',
name: 'admin-account-settings',
//redirect: () => ({ name: 'admin-account-settings', params: { tab: 'account' } }),
component: () => import('@/views/pages/account-settings/main-tab.vue'),
props: route => ({ tab: route.params.tab || 'account' }),
meta: {action: 'read', subject: 'Profile Update'},
},
{
path: '/admin/account-settings',
name: 'admin-account-settings',
redirect: { name: 'admin-account-settings-tab', params: { tab: 'account' } },
meta: {action: 'read', subject: 'Profile Update'},
children: [
{
path: ':tab',
name: 'admin-account-settings-tab',
component: () => import('@/views/pages/account-settings/main-tab.vue'),
props: true,
}
]
},
{
path: '/admin/patients',
name: 'admin-patients',
component: () => import('@/pages/patients/patients.vue'),
meta: {action: 'read', subject: 'Patient View'},
},
{
path: '/admin/patients/labkit/:patient_id',
name: 'admin-patients-labkit',
component: () => import('@/pages/pages/patient-labkits/labkit.vue'),
},
{
path: '/admin/patient/meetings/:id',
name: 'admin-patient-meeitngs',
component: () => import('@/pages/patients/meetings.vue'),
},
{
path: '/admin/patient/meeting-details/:patient_id/:id',
name: 'admin-patient-meeitng-details',
component: () => import('@/pages/patients/meeting-details.vue'),
},
{
path: '/admin/provider/meetings/:id',
name: 'admin-provider-meeitngs',
component: () => import('@/pages/providers/meetings.vue'),
},
{
path: '/admin/provider/meeting-details/:provider_id/:id',
name: 'admin-provider-meeitng-details',
component: () => import('@/pages/providers/meeting-details.vue'),
},
{
path: '/admin/patient/meeting/prescription/:patient_id/:id',
name: 'admin-patient-meeitng-prescription',
component: () => import('@/pages/pages/patient-meetings/prescription.vue'),
},
{
path: '/admin/patient/meeting/notes/:patient_id/:id',
name: 'admin-patient-meeitng-notes',
component: () => import('@/pages/pages/patient-meetings/notes.vue'),
},
{
path: '/admin/providers',
name: 'admin-providers',
component: () => import('@/pages/providers/providers.vue'),
meta: {action: 'read', subject: 'Product View'},
},
{
path: '/admin/labs',
name: 'admin-labs',
component: () => import('@/pages/labs/labs.vue'),
},
{
path: '/admin/lab-kites',
name: 'admin-lab-kites',
component: () => import('@/pages/labs/labs-kit.vue'),
},
{
path: '/admin/products',
name: 'admin-products',
component: () => import('@/pages/products/product.vue'),
meta: {action: 'read', subject: 'Product View'},
},
{
path: '/admin/profile',
name: 'admin-profile',
component: () => import('@/views/pages/account-settings/AccountSettingsAccount.vue'),
meta: {action: 'read', subject: 'Profile Update'},
},
{
path: '/admin/change-password',
name: 'admin-change-password',
component: () => import('@/views/pages/account-settings/AccountSettingsSecurity.vue'),
meta: {action: 'read', subject: 'Security'},
},
{
path: '/admin/calender-integration',
name: 'admin-calender-integration',
component: () => import('@/views/pages/account-settings/CalenderIntegration.vue'),
meta: {action: 'read', subject: 'Site Settings'},
},
{
path: '/admin/site-setting',
name: 'admin-site-setting',
component: () => import('@/views/pages/account-settings/WebsiteSettings.vue'),
meta: {action: 'read', subject: 'Site Settings'},
},
{
path: '/admin/patients/patient-profile/:id',
name: 'admin-patient-profile',
component: () => import('@/pages/patients/patient-profile.vue'),
meta: {
activeParent: 'admin-patients',
action: 'read', subject: 'Patient Overview Tab'
}
},
{
path: '/admin/patients/add-patient',
name: 'admin-add-patient',
component: () => import('@/pages/patients/register-patient-step.vue'),
meta: {
activeParent: 'admin-patients'
}
},
{
path: '/admin/provider/provider-profile/:id',
name: 'admin-provider-profile',
component: () => import('@/pages/providers/provider-profile.vue'),
meta: {
activeParent: 'admin-providers',
action: 'read', subject: 'Provider Detail',
}
},
{
path: '/admin/providers/patientprofile/:id',
name: 'admin-providers-patientprofile',
component: () => import('@/pages/patients/PatientQuestionProfile.vue'),
},
{
path: '/admin/reports/providers',
name: 'admin-provider-report',
component: () => import('@/pages/reports/providers-report.vue'),
},
{
path: '/admin/precriptions',
name: 'admin-precriptions',
component: () => import('@/pages/prescrptions/prescription.vue'),
meta: {action: 'read', subject: 'Prescription View'},
},
{
path: '/admin/orders',
name: 'admin-orders-list',
component: () => import('@/pages/apps/ecommerce/order/list/orders-list-new.vue'),
meta: {action: 'read', subject: 'Order View'},
},
{
path: '/admin/subscriptions',
name: 'admin-subcriptions',
component: () => import('@/pages/subcriptions/subcriptions.vue'),
meta: {action: 'read', subject: 'Subscription View'},
},
{
path: '/admin/add-order',
name: 'admin-add-orders',
component: () => import('@/pages/apps/ecommerce/order/AddOrder.vue'),
meta: {action: 'read', subject: 'Order Add'},
},
{
path: "/admin/order-detail/:id",
name: "admin-order-detail",
component: () => import('@/pages/apps/ecommerce/order/list/main-orders-detail-tabs.vue'),
meta: {action: 'read', subject: 'Order Detail Tab'},
},
{
path: "/admin/order-edit/:id",
name: "admin-order-edit",
component: () => import('@/pages/apps/ecommerce/order/list/order-list-edit.vue'),
meta: {action: 'read', subject: 'Order Edit'},
},
{
path: '/admin/users',
name: 'admin-users',
component: () => import('@/pages/admin-users/admin-list.vue'),
meta: {action: 'read', subject: 'Admin View'},
},
{
path: '/admin/role-permission/:id',
name: 'admin-role-permission',
component: () => import('@/pages/user-permission/assign-permission.vue'),
meta: {action: 'read', subject: 'Role Permissions'},
},
{
path: '/admin/analytics/overview',
name: 'admin-overview-analytics',
component: () => import('@/pages/analytics/overview.vue'),
meta: {action: 'read', subject: 'Analytics Overview'},
},
{
path: '/admin/analytics/overview-order',
name: 'admin-overview-analytics-order',
component: () => import('@/pages/analytics/overview-order.vue'),
meta: {action: 'read', subject: 'Analytics Overview'},
},
{
path: '/admin/analytics/orders',
name: 'admin-orders-analytics',
component: () => import('@/pages/analytics/orders.vue'),
meta: {action: 'read', subject: 'Analytics Orders'},
},
{
path: '/admin/analytics/products',
name: 'admin-products-analytics',
component: () => import('@/pages/analytics/products.vue'),
meta: {action: 'read', subject: 'Analytics Products'},
},
{
path: '/admin/roles/roles',
name: 'admin-roles',
component: () => import('@/pages/roles/roles.vue'),
meta: {action: 'read', subject: 'Role View'},
},
{
path: '/apps/email/filter/:filter',
name: 'apps-email-filter',
component: emailRouteComponent,
meta: {
navActiveLink: 'apps-email',
layoutWrapperClasses: 'layout-content-height-fixed',
},
},
// Email label
{
path: '/apps/email/label/:label',
name: 'apps-email-label',
component: emailRouteComponent,
meta: {
// contentClass: 'email-application',
navActiveLink: 'apps-email',
layoutWrapperClasses: 'layout-content-height-fixed',
},
},
{
path: '/dashboards/logistics',
name: 'dashboards-logistics',
component: () => import('@/pages/apps/logistics/dashboard.vue'),
},
{
path: '/dashboards/academy',
name: 'dashboards-academy',
component: () => import('@/pages/apps/academy/dashboard.vue'),
},
{
path: '/apps/ecommerce/dashboard',
name: 'apps-ecommerce-dashboard',
component: () => import('@/pages/dashboards/ecommerce.vue'),
},
]