mirror of
https://dev.azure.com/hugendubel/ISA/_git/ISA-Frontend
synced 2025-12-28 22:42:11 +01:00
147 lines
5.4 KiB
TypeScript
147 lines
5.4 KiB
TypeScript
import { isDevMode, NgModule } from '@angular/core';
|
|
import { RouterModule, Routes } from '@angular/router';
|
|
import {
|
|
CanActivateCartGuard,
|
|
CanActivateCartWithProcessIdGuard,
|
|
CanActivateCustomerGuard,
|
|
CanActivateCustomerWithProcessIdGuard,
|
|
CanActivateGoodsInGuard,
|
|
CanActivateGoodsOutGuard,
|
|
CanActivateGoodsOutWithProcessIdGuard,
|
|
CanActivateProductGuard,
|
|
CanActivateProductWithProcessIdGuard,
|
|
CanActivateRemissionGuard,
|
|
CanActivateTaskCalendarGuard,
|
|
IsAuthenticatedGuard,
|
|
} from './guards';
|
|
import { CanActivateAssortmentGuard } from './guards/can-activate-assortment.guard';
|
|
import { CanActivatePackageInspectionGuard } from './guards/can-activate-package-inspection.guard';
|
|
import { PreviewComponent } from './preview';
|
|
import { BranchSectionResolver, CustomerSectionResolver, ProcessIdResolver } from './resolvers';
|
|
import { ShellComponent, ShellModule } from './shell';
|
|
import { TokenLoginComponent, TokenLoginModule } from './token-login';
|
|
|
|
const routes: Routes = [
|
|
{
|
|
path: 'login',
|
|
children: [
|
|
{ path: ':token', component: TokenLoginComponent },
|
|
{ path: '**', redirectTo: 'kunde', pathMatch: 'full' },
|
|
],
|
|
},
|
|
{
|
|
path: '',
|
|
canActivate: [IsAuthenticatedGuard],
|
|
children: [
|
|
{
|
|
path: '',
|
|
canActivate: [],
|
|
children: [
|
|
{
|
|
path: 'kunde',
|
|
component: ShellComponent,
|
|
children: [
|
|
{
|
|
path: 'dashboard',
|
|
loadChildren: () => import('@page/dashboard').then((m) => m.DashboardModule),
|
|
},
|
|
{
|
|
path: 'product',
|
|
loadChildren: () => import('@page/catalog').then((m) => m.PageCatalogModule),
|
|
canActivate: [CanActivateProductGuard],
|
|
},
|
|
{
|
|
path: ':processId/product',
|
|
loadChildren: () => import('@page/catalog').then((m) => m.PageCatalogModule),
|
|
canActivate: [CanActivateProductWithProcessIdGuard],
|
|
resolve: { processId: ProcessIdResolver },
|
|
},
|
|
{
|
|
path: 'customer',
|
|
loadChildren: () => import('@page/customer').then((m) => m.PageCustomerModule),
|
|
canActivate: [CanActivateCustomerGuard],
|
|
},
|
|
{
|
|
path: ':processId/customer',
|
|
loadChildren: () => import('@page/customer').then((m) => m.PageCustomerModule),
|
|
canActivate: [CanActivateCustomerWithProcessIdGuard],
|
|
resolve: { processId: ProcessIdResolver },
|
|
},
|
|
{
|
|
path: 'cart',
|
|
loadChildren: () => import('@page/checkout').then((m) => m.PageCheckoutModule),
|
|
canActivate: [CanActivateCartGuard],
|
|
},
|
|
{
|
|
path: ':processId/cart',
|
|
loadChildren: () => import('@page/checkout').then((m) => m.PageCheckoutModule),
|
|
canActivate: [CanActivateCartWithProcessIdGuard],
|
|
},
|
|
{
|
|
path: 'goods/out',
|
|
loadChildren: () => import('@page/goods-out').then((m) => m.GoodsOutModule),
|
|
canActivate: [CanActivateGoodsOutGuard],
|
|
},
|
|
{
|
|
path: ':processId/goods/out',
|
|
loadChildren: () => import('@page/goods-out').then((m) => m.GoodsOutModule),
|
|
canActivate: [CanActivateGoodsOutWithProcessIdGuard],
|
|
resolve: { processId: ProcessIdResolver },
|
|
},
|
|
{ path: '**', redirectTo: 'dashboard', pathMatch: 'full' },
|
|
],
|
|
resolve: { section: CustomerSectionResolver },
|
|
},
|
|
{
|
|
path: 'filiale',
|
|
component: ShellComponent,
|
|
children: [
|
|
{
|
|
path: 'task-calendar',
|
|
loadChildren: () => import('@page/task-calendar').then((m) => m.PageTaskCalendarModule),
|
|
canActivate: [CanActivateTaskCalendarGuard],
|
|
},
|
|
{
|
|
path: 'goods/in',
|
|
loadChildren: () => import('@page/goods-in').then((m) => m.GoodsInModule),
|
|
canActivate: [CanActivateGoodsInGuard],
|
|
},
|
|
{
|
|
path: 'remission',
|
|
loadChildren: () => import('@page/remission').then((m) => m.PageRemissionModule),
|
|
canActivate: [CanActivateRemissionGuard],
|
|
},
|
|
{
|
|
path: 'package-inspection',
|
|
loadChildren: () => import('@page/package-inspection').then((m) => m.PackageInspectionModule),
|
|
canActivate: [CanActivatePackageInspectionGuard],
|
|
},
|
|
{
|
|
path: 'assortment',
|
|
loadChildren: () => import('@page/assortment').then((m) => m.AssortmentModule),
|
|
canActivate: [CanActivateAssortmentGuard],
|
|
},
|
|
{ path: '**', redirectTo: 'task-calendar', pathMatch: 'full' },
|
|
],
|
|
resolve: { section: BranchSectionResolver },
|
|
},
|
|
{ path: '**', redirectTo: 'kunde', pathMatch: 'full' },
|
|
],
|
|
},
|
|
],
|
|
},
|
|
];
|
|
|
|
if (isDevMode()) {
|
|
routes.unshift({
|
|
path: 'preview',
|
|
component: PreviewComponent,
|
|
});
|
|
}
|
|
|
|
@NgModule({
|
|
imports: [RouterModule.forRoot(routes), ShellModule, TokenLoginModule],
|
|
exports: [RouterModule],
|
|
})
|
|
export class AppRoutingModule {}
|