diff --git a/apps/red-ui/src/app/app-routing.module.ts b/apps/red-ui/src/app/app-routing.module.ts
index 8bf52eec7..92a08b043 100644
--- a/apps/red-ui/src/app/app-routing.module.ts
+++ b/apps/red-ui/src/app/app-routing.module.ts
@@ -6,11 +6,12 @@ import { BaseScreenComponent } from '@components/base-screen/base-screen.compone
import { RouteReuseStrategy, RouterModule, Routes } from '@angular/router';
import { NgModule } from '@angular/core';
import { DownloadsListScreenComponent } from '@components/downloads-list-screen/downloads-list-screen.component';
-import { DossierTemplatesGuard } from '@guards/dossier-templates.guard';
import { DossiersGuard } from '@guards/dossiers.guard';
import { ACTIVE_DOSSIERS_SERVICE, ARCHIVED_DOSSIERS_SERVICE } from './tokens';
import { FeaturesGuard } from '@guards/features-guard.service';
-import { DOSSIERS_ARCHIVE } from '@utils/constants';
+import { DOSSIER_TEMPLATE_ID, DOSSIERS_ARCHIVE } from '@utils/constants';
+import { DossierTemplatesGuard } from '@guards/dossier-templates.guard';
+import { DossierTemplateExistsGuard } from '@guards/dossier-template-exists.guard';
const routes: Routes = [
{
@@ -18,81 +19,85 @@ const routes: Routes = [
redirectTo: 'main/dashboard',
pathMatch: 'full',
},
+ {
+ path: 'main',
+ component: BaseScreenComponent,
+ children: [
+ {
+ path: '',
+ redirectTo: 'dashboard',
+ pathMatch: 'full',
+ },
+ {
+ path: 'account',
+ loadChildren: () => import('./modules/account/account.module').then(m => m.AccountModule),
+ },
+ {
+ path: 'admin',
+ loadChildren: () => import('./modules/admin/admin.module').then(m => m.AdminModule),
+ },
+ {
+ path: 'dashboard',
+ loadChildren: () => import('./modules/dashboard/dashboard.module').then(m => m.DashboardModule),
+ canActivate: [CompositeRouteGuard],
+ data: {
+ routeGuards: [AuthGuard, RedRoleGuard],
+ requiredRoles: ['RED_USER', 'RED_MANAGER'],
+ },
+ },
+ {
+ path: `:${DOSSIER_TEMPLATE_ID}/dossiers`,
+ loadChildren: () => import('./modules/dossier/dossiers.module').then(m => m.DossiersModule),
+ canActivate: [CompositeRouteGuard],
+ data: {
+ routeGuards: [AuthGuard, RedRoleGuard, DossierTemplatesGuard, DossierTemplateExistsGuard, DossiersGuard],
+ requiredRoles: ['RED_USER', 'RED_MANAGER'],
+ dossiersService: ACTIVE_DOSSIERS_SERVICE,
+ },
+ },
+ {
+ path: `:${DOSSIER_TEMPLATE_ID}/archive`,
+ loadChildren: () => import('./modules/archive/archive.module').then(m => m.ArchiveModule),
+ canActivate: [CompositeRouteGuard],
+ data: {
+ routeGuards: [FeaturesGuard, AuthGuard, RedRoleGuard, DossierTemplatesGuard, DossierTemplateExistsGuard, DossiersGuard],
+ requiredRoles: ['RED_USER', 'RED_MANAGER'],
+ dossiersService: ARCHIVED_DOSSIERS_SERVICE,
+ features: [DOSSIERS_ARCHIVE],
+ },
+ },
+ {
+ path: 'downloads',
+ component: DownloadsListScreenComponent,
+ canActivate: [CompositeRouteGuard],
+ data: {
+ routeGuards: [AuthGuard, RedRoleGuard],
+ },
+ },
+ {
+ path: 'search',
+ loadChildren: () => import('./modules/search/search.module').then(m => m.SearchModule),
+ canActivate: [CompositeRouteGuard],
+ data: {
+ routeGuards: [AuthGuard, RedRoleGuard, DossiersGuard],
+ requiredRoles: ['RED_USER', 'RED_MANAGER'],
+ },
+ },
+ {
+ path: `:${DOSSIER_TEMPLATE_ID}`,
+ redirectTo: `:${DOSSIER_TEMPLATE_ID}/dossiers`,
+ pathMatch: 'full',
+ },
+ ],
+ },
{
path: 'auth-error',
component: AuthErrorComponent,
canActivate: [AuthGuard],
},
- {
- path: 'main/account',
- component: BaseScreenComponent,
- loadChildren: () => import('./modules/account/account.module').then(m => m.AccountModule),
- },
- {
- path: 'main/admin',
- component: BaseScreenComponent,
- loadChildren: () => import('./modules/admin/admin.module').then(m => m.AdminModule),
- },
- {
- path: 'main/dashboard',
- component: BaseScreenComponent,
- loadChildren: () => import('./modules/dashboard/dashboard.module').then(m => m.DashboardModule),
- canActivate: [CompositeRouteGuard],
- data: {
- routeGuards: [AuthGuard, RedRoleGuard],
- requiredRoles: ['RED_USER', 'RED_MANAGER'],
- },
- },
- {
- path: 'main/dossiers',
- component: BaseScreenComponent,
- loadChildren: () => import('./modules/dossier/dossiers.module').then(m => m.DossiersModule),
- canActivate: [CompositeRouteGuard],
- data: {
- routeGuards: [AuthGuard, RedRoleGuard, DossierTemplatesGuard, DossiersGuard],
- requiredRoles: ['RED_USER', 'RED_MANAGER'],
- dossiersService: ACTIVE_DOSSIERS_SERVICE,
- },
- },
- {
- path: 'main/archive',
- component: BaseScreenComponent,
- loadChildren: () => import('./modules/archive/archive.module').then(m => m.ArchiveModule),
- canActivate: [CompositeRouteGuard],
- data: {
- routeGuards: [FeaturesGuard, AuthGuard, RedRoleGuard, DossierTemplatesGuard, DossiersGuard],
- requiredRoles: ['RED_USER', 'RED_MANAGER'],
- dossiersService: ARCHIVED_DOSSIERS_SERVICE,
- features: [DOSSIERS_ARCHIVE],
- },
- },
- {
- path: 'main/downloads',
- component: BaseScreenComponent,
- children: [
- {
- path: '',
- component: DownloadsListScreenComponent,
- },
- ],
- canActivate: [CompositeRouteGuard],
- data: {
- routeGuards: [AuthGuard, RedRoleGuard],
- },
- },
- {
- path: 'main/search',
- component: BaseScreenComponent,
- loadChildren: () => import('./modules/search/search.module').then(m => m.SearchModule),
- canActivate: [CompositeRouteGuard],
- data: {
- routeGuards: [AuthGuard, RedRoleGuard, DossiersGuard],
- requiredRoles: ['RED_USER', 'RED_MANAGER'],
- },
- },
{
path: '**',
- redirectTo: 'main/dossiers',
+ redirectTo: 'main/dashboard',
pathMatch: 'full',
},
];
diff --git a/apps/red-ui/src/app/components/base-screen/base-screen.component.html b/apps/red-ui/src/app/components/base-screen/base-screen.component.html
index 7040eba5c..2f6675b9e 100644
--- a/apps/red-ui/src/app/components/base-screen/base-screen.component.html
+++ b/apps/red-ui/src/app/components/base-screen/base-screen.component.html
@@ -7,12 +7,12 @@