2026-10-13 19:18:05 -05:00
|
|
|
import type { Routes } from '@angular/router';
|
|
|
|
|
import { MENU } from '@basic-erp/sap-types';
|
|
|
|
|
import { authGuard, guestGuard, menuLoadedGuard, permissionGuard } from './core/auth/guards';
|
2026-10-13 19:11:05 -05:00
|
|
|
|
2026-10-13 19:18:05 -05:00
|
|
|
/** Una ruta por pantalla del menú; las que aún no existen muestran "no disponible". */
|
|
|
|
|
const screens: Routes = MENU.flatMap((m) => m.items).map((item) => ({
|
|
|
|
|
path: item.path.slice(1),
|
|
|
|
|
canActivate: [permissionGuard],
|
|
|
|
|
data: { path: item.path, title: item.label },
|
|
|
|
|
loadComponent: () => import('./features/shared/coming-soon.page').then((m) => m.ComingSoonPage),
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
export const routes: Routes = [
|
|
|
|
|
{
|
|
|
|
|
path: 'login',
|
|
|
|
|
canActivate: [guestGuard],
|
|
|
|
|
loadComponent: () => import('./features/login/login.page').then((m) => m.LoginPage),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
path: '',
|
|
|
|
|
canActivate: [authGuard, menuLoadedGuard],
|
|
|
|
|
loadComponent: () => import('./layout/main-layout').then((m) => m.MainLayout),
|
|
|
|
|
children: [
|
|
|
|
|
{ path: '', pathMatch: 'full', loadComponent: () => import('./features/home/home.page').then((m) => m.HomePage) },
|
|
|
|
|
{
|
|
|
|
|
path: 'sin-acceso',
|
|
|
|
|
loadComponent: () => import('./features/shared/no-access.page').then((m) => m.NoAccessPage),
|
|
|
|
|
},
|
|
|
|
|
...screens,
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
{ path: '**', redirectTo: '' },
|
|
|
|
|
];
|