697 lines
28 KiB
JavaScript

import { createRouter, createWebHashHistory } from 'vue-router'
import { hasPermission } from '@Plugins/RolePermission';
import examples from './Examples';
function can(next, can) {
if (!hasPermission(can)) {
next({ name: '404' });
} else {
next();
}
}
const router = createRouter({
history: createWebHashHistory(import.meta.env.BASE_URL),
routes: [
{
path: '/',
component: () => import('@Layouts/AppLayout.vue'),
name: 'root',
meta: {
title: 'Inicio',
icon: 'home',
},
redirect: '/dashboard',
children: [
{
path: '',
name: 'index',
redirect: '/dashboard'
},
{
path: 'dashboard',
name: 'dashboard.index',
component: () => import('@Pages/Dashboard/Employee.vue'),
meta: {
title: 'Dashboard',
icon: 'grid_view',
}
},
{
path: 'vacations',
name: 'vacations',
meta: {
title: 'Vacaciones',
icon: 'calendar_month',
},
children: [
{
path: '',
name: 'vacations.index',
component: () => import('@Pages/Vacations/Employee/Index.vue'),
},
{
path: 'create',
name: 'vacations.create',
component: () => import('@Pages/Vacations/Employee/Create.vue'),
}
]
},
{
path: 'courses',
name: 'courses.index',
meta: {
title: 'Cursos',
icon: 'info',
},
component: () => import('@Pages/Courses/Employee/Index.vue'),
},
{
path: 'profile',
name: 'profile.show',
component: () => import('@Pages/Profile/Show.vue'),
meta: {
title: 'Perfil',
icon: 'person',
}
},
{
path: 'profile/notifications',
name: 'profile.notifications.index',
component: () => import('@Pages/Profile/Notifications/Index.vue'),
meta: {
title: 'Notificaciones',
icon: 'notifications',
}
},
],
},
{
path: '/coordinator',
name: 'coordinator',
component: () => import('@Layouts/CoordinatorLayout.vue'),
meta: {
title: 'Inicio',
icon: 'home',
},
redirect: '/coordinator/dashboard',
children: [
{
path: 'dashboard',
name: 'coordinator.dashboard',
component: () => import('@Pages/Dashboard/Coordinator.vue'),
meta: {
title: 'Dashboard',
icon: 'grid_view',
},
redirect: '/coordinator/dashboard',
children: [
{
path: '',
name: 'coordinator.dashboard.index',
component: () => import('@Pages/Dashboard/Coordinator.vue'),
}
]
},
{
path: 'vacations',
name: 'vacations.coordinator.index',
meta: {
title: 'Vacaciones',
icon: 'calendar_month',
},
component: () => import('@Pages/Vacations/Coordinator/Index.vue'),
},
{
path: 'courses',
name: 'courses.coordinator',
meta: {
title: 'Capacitaciones',
icon: 'info',
},
children: [
{
path: '',
name: 'courses.coordinator.index',
component: () => import('@Pages/Courses/Coordinator/Index.vue'),
},
{
path: 'request',
name: 'courses.coordinator.request',
component: () => import('@Pages/Courses/Coordinator/Request.vue'),
}
],
}
]
},
{
path: '/admin',
name: 'admin',
component: () => import('@Layouts/AdminLayout.vue'),
meta: {
title: 'Inicio',
icon: 'home',
},
redirect: '/admin/dashboard',
children: [
{
path: 'dashboard',
name: 'admin.dashboard.index',
meta: {
title: 'Dashboard',
icon: 'grid_view',
},
component: () => import('@Pages/Dashboard/Admin.vue'),
},
{
path: 'vacations',
name: 'admin.vacations',
meta: {
title: 'Vacaciones',
icon: 'calendar_month',
},
redirect: '/admin/vacations',
children: [
{
path: '',
name: 'admin.vacations.index',
component: () => import('@Pages/Vacations/Admin/Index.vue'),
}
]
},
{
path: 'courses',
name: 'admin.courses',
meta: {
title: 'Capacitaciones',
icon: 'info',
},
redirect: '/admin/courses',
children: [
{
path: '',
name: 'admin.courses.index',
component: () => import('@Pages/Courses/Admin/Index.vue'),
},
{
path: 'request',
name: 'admin.courses.request',
component: () => import('@Pages/Courses/Admin/Request.vue'),
},
{
path: ':id/assignamment',
name: 'admin.courses.assignamment',
component: () => import('@Pages/Courses/Admin/Assignamment.vue'),
},
{
path: 'calendar',
name: 'admin.courses.calendar',
component: () => import('@Pages/Courses/Admin/Calendar.vue'),
},
]
},
{
path: 'events',
name: 'admin.events',
meta: {
title: 'Eventos',
icon: 'info',
},
redirect: '/admin/events',
children: [
{
path: '',
name: 'admin.events.index',
component: () => import('@Pages/Admin/Events/Index.vue'),
},
{
path: 'pettyCashes',
name: 'admin.events.pettyCashes',
redirect: '/admin/events/pettyCashes',
children: [
{
path: '',
name: 'admin.events.pettyCashes.index',
component: () => import('@Pages/Admin/Events/PettyCashes/Index.vue'),
},
{
path: 'create',
name: 'admin.events.pettyCashes.create',
component: () => import('@Pages/Admin/Events/PettyCashes/Create.vue'),
},
{
path: 'assignamment',
name: 'admin.events.pettyCashes.assignamment',
component: () => import('@Pages/Admin/Events/PettyCashes/Assignamment.vue'),
},
{
path: ':id/edit',
name: 'admin.events.pettyCashes.edit',
component: () => import('@Pages/Admin/Events/PettyCashes/Edit.vue'),
},
]
},
// {
// path: 'expense',
// name: 'admin.events.expense',
// redirect: '/admin/events/expense',
// children: [
// {
// path: '',
// name: 'admin.events.expense.index',
// component: () => import('@Pages/Admin/Events/ExpenseJustifications/Index.vue'),
// },
// ]
// },
{
path: 'justification',
name: 'admin.events.justification',
component: () => import('@Pages/Admin/Events/Justification.vue'),
},
{
path: 'reports',
name: 'admin.events.reports',
component: () => import('@Pages/Admin/Events/Reports.vue'),
},
]
},
{
path: 'users',
name: 'admin.users',
meta: {
title: 'Usuarios',
icon: 'people',
},
redirect: '/admin/users',
children: [
{
path: '',
name: 'admin.users.index',
component: () => import('@Pages/Admin/Users/Index.vue'),
},
{
path: 'online',
name: 'admin.users.online',
component: () => import('@Pages/Admin/Users/Online.vue')
},
{
path: 'create',
name: 'admin.users.create',
meta: {
title: 'Crear',
icon: 'add',
},
component: () => import('@Pages/Admin/Users/Create.vue')
}, {
path: ':id/edit',
name: 'admin.users.edit',
meta: {
title: 'Editar',
icon: 'edit',
},
component: () => import('@Pages/Admin/Users/Edit.vue')
}, {
path: ':id/settings',
name: 'admin.users.settings',
component: () => import('@Pages/Admin/Users/Settings.vue'),
meta: {
title: 'Configuración',
icon: 'settings',
},
},
{
path: 'academic',
name: 'admin.users.academic',
redirect: '/admin/users/academic',
children: [
{
path: '',
name: 'admin.users.academic.index',
component: () => import('@Pages/Admin/Users/Academic/Index.vue'),
},
{
path: ':id/create-record',
name: 'admin.users.academic.createRecord',
component: () => import('@Pages/Admin/Users/Academic/CreateRecord.vue'),
},
{
path: ':id/create-certification',
name: 'admin.users.academic.createCertification',
component: () => import('@Pages/Admin/Users/Academic/CreateCertification.vue'),
},
{
path: ':id/edit-record/:record',
name: 'admin.users.academic.editRecord',
component: () => import('@Pages/Admin/Users/Academic/EditRecord.vue'),
},
{
path: ':id/edit-certification/:certification',
name: 'admin.users.academic.editCertification',
component: () => import('@Pages/Admin/Users/Academic/EditCertification.vue'),
},
]
},
{
path: 'security',
name: 'admin.users.security',
component: () => import('@Pages/Admin/Users/Security.vue'),
},
{
path: 'additional',
name: 'admin.users.additional',
component: () => import('@Pages/Admin/Users/Additional.vue'),
},
]
},
{
path: 'warehouses',
name: 'admin.warehouses',
meta: {
title: 'Bodegas',
icon: 'inventory_2',
},
redirect: '/admin/warehouses',
children: [
{
path: ':id',
name: 'admin.warehouses.details',
component: () => import('@Pages/Warehouses/Details.vue'),
meta: {
title: 'Detalles',
icon: 'info',
},
},
{
path: '',
name: 'admin.warehouses.index',
component: () => import('@Pages/Warehouses/Index.vue'),
},
{
path: 'create',
name: 'admin.warehouses.create',
component: () => import('@Pages/Warehouses/Create.vue'),
meta: {
title: 'Crear',
icon: 'add',
},
},
{
path: ':id/edit',
name: 'admin.warehouses.edit',
component: () => import('@Pages/Warehouses/Edit.vue'),
meta: {
title: 'Editar',
icon: 'edit',
},
}
]
},
{
path: 'units-measure',
name: 'admin.units-measure',
meta: {
title: 'Unidades de Medida',
icon: 'straighten',
},
redirect: '/admin/units-measure',
children: [
{
path: '',
name: 'admin.units-measure.index',
component: () => import('@Pages/UnitsMeasure/Index.vue'),
},
]
},
{
path: 'warehouse-classifications',
name: 'admin.warehouse-classifications',
meta: {
title: 'Clasificaciones de Bodegas',
icon: 'category',
},
redirect: '/admin/warehouse-classifications',
children: [
{
path: '',
name: 'admin.warehouse-classifications.index',
component: () => import('@Pages/WarehouseClassifications/Index.vue'),
},
{
path: 'create',
name: 'admin.warehouse-classifications.create',
component: () => import('@Pages/WarehouseClassifications/Create.vue'),
meta: {
title: 'Crear',
icon: 'add',
},
},
{
path: ':id/edit',
name: 'admin.warehouse-classifications.edit',
component: () => import('@Pages/WarehouseClassifications/Edit.vue'),
meta: {
title: 'Editar',
icon: 'edit',
},
}
]
},
{
path: 'units-measure',
name: 'admin.units-measure',
meta: {
title: 'Unidades de Medida',
icon: 'straighten',
},
redirect: '/admin/units-measure',
children: [
{
path: '',
name: 'admin.units-measure.index',
component: () => import('@Pages/UnitsMeasure/Index.vue'),
},
{
path: 'create',
name: 'admin.units-measure.create',
component: () => import('@Pages/UnitsMeasure/Create.vue'),
meta: {
title: 'Crear',
icon: 'add',
},
},
{
path: ':id/edit',
name: 'admin.units-measure.edit',
component: () => import('@Pages/UnitsMeasure/Edit.vue'),
meta: {
title: 'Editar',
icon: 'edit',
},
}
]
},
{
path: 'comercial-classifications',
name: 'admin.comercial-classifications',
meta: {
title: 'Clasificaciones Comerciales',
icon: 'category',
},
redirect: '/admin/comercial-classifications',
children: [
{
path: '',
name: 'admin.comercial-classifications.index',
component: () => import('@Pages/ComercialClassifications/Index.vue'),
},
{
path: 'create',
name: 'admin.comercial-classifications.create',
component: () => import('@Pages/ComercialClassifications/Create.vue'),
meta: {
title: 'Crear',
icon: 'add',
},
},
{
path: ':id/edit',
name: 'admin.comercial-classifications.edit',
component: () => import('@Pages/ComercialClassifications/Edit.vue'),
meta: {
title: 'Editar',
icon: 'edit',
},
}
]
},
{
path: 'products',
name: 'admin.products',
meta: {
title: 'Productos',
icon: 'inventory',
},
redirect: '/admin/products',
children: [
{
path: '',
name: 'admin.products.index',
component: () => import('@Pages/Products/Index.vue'),
},
{
path: 'create',
name: 'admin.products.create',
component: () => import('@Pages/Products/Create.vue'),
meta: {
title: 'Crear',
icon: 'add',
}
}
/*
{
path: ':id/edit',
name: 'admin.products.edit',
component: () => import('@Pages/Products/Edit.vue'),
meta: {
title: 'Editar',
icon: 'edit',
},
} */
]
},
{
path: 'pos',
name: 'admin.pos',
meta: {
title: 'Punto de Venta',
icon: 'point_of_sale',
},
redirect: '/admin/pos',
children: [
{
path: '',
name: 'admin.pos.index',
component: () => import('@Pages/Pos/Index.vue'),
},
]
},
{
path: 'roles',
name: 'admin.roles',
meta: {
title: 'Roles',
icon: 'license',
},
redirect: '/admin/roles',
children: [
{
path: '',
name: 'admin.roles.index',
component: () => import('@Pages/Admin/Roles/Index.vue'),
},
{
path: 'create',
name: 'admin.roles.create',
component: () => import('@Pages/Admin/Roles/Create.vue'),
meta: {
title: 'Crear',
icon: 'add',
},
}, {
path: ':id/edit',
name: 'admin.roles.edit',
component: () => import('@Pages/Admin/Roles/Edit.vue'),
meta: {
title: 'Editar',
icon: 'edit',
},
}
]
},
{
path: 'activities',
name: 'admin.activities',
meta: {
title: 'Historial de acciones',
icon: 'event',
},
redirect: '/admin/activities',
children: [
{
path: '',
name: 'admin.activities.index',
beforeEnter: (to, from, next) => can(next, 'activities.index'),
component: () => import('@Pages/Admin/Activities/Index.vue')
}
]
},
{
path: 'documentation',
name: 'admin.documentation',
meta: {
title: 'Maquetador de Documentos',
icon: 'documents',
},
redirect: '/admin/documentation',
children: [
{
path: '',
name: 'admin.maquetador.index',
component: () => import('@Pages/Maquetador/Index.vue'),
},
]
},
]
},
{
path: '/changelogs',
component: () => import('@Layouts/AppLayout.vue'),
children: [
{
path: '',
name: 'changelogs.app',
component: () => import('@Pages/Changelogs/App.vue')
},
{
path: 'core',
name: 'changelogs.core',
component: () => import('@Pages/Changelogs/Core.vue')
}
]
},
{
path: '/auth',
component: () => import('@Holos/Layout/Auth.vue'),
children: [
{
path: '',
name: 'auth.index',
component: () => import('@Pages/Auth/Login.vue')
},
{
path: 'forgot-password',
name: 'auth.forgot-password',
component: () => import('@Pages/Auth/ForgotPassword.vue')
},
{
path: 'reset-password',
name: 'auth.reset-password',
component: () => import('@Pages/Auth/ResetPassword.vue')
}
]
},
{
path: '/:pathMatch(.*)*',
name: '404',
component: () => import('@Pages/Errors/404.vue')
},
...examples,
]
})
export default router