2022-03-11 10:53:32 -08:00
|
|
|
import { NgModule } from '@angular/core'
|
|
|
|
|
import { Routes, RouterModule } from '@angular/router'
|
|
|
|
|
import { AppFrameComponent } from './components/app-frame/app-frame.component'
|
|
|
|
|
import { DashboardComponent } from './components/dashboard/dashboard.component'
|
|
|
|
|
import { DocumentDetailComponent } from './components/document-detail/document-detail.component'
|
|
|
|
|
import { DocumentListComponent } from './components/document-list/document-list.component'
|
|
|
|
|
import { CorrespondentListComponent } from './components/manage/correspondent-list/correspondent-list.component'
|
|
|
|
|
import { DocumentTypeListComponent } from './components/manage/document-type-list/document-type-list.component'
|
2023-09-24 19:24:28 -07:00
|
|
|
import { LogsComponent } from './components/admin/logs/logs.component'
|
|
|
|
|
import { SettingsComponent } from './components/admin/settings/settings.component'
|
2022-03-11 10:53:32 -08:00
|
|
|
import { TagListComponent } from './components/manage/tag-list/tag-list.component'
|
|
|
|
|
import { NotFoundComponent } from './components/not-found/not-found.component'
|
|
|
|
|
import { DocumentAsnComponent } from './components/document-asn/document-asn.component'
|
|
|
|
|
import { DirtyFormGuard } from './guards/dirty-form.guard'
|
2022-05-19 23:42:25 +02:00
|
|
|
import { StoragePathListComponent } from './components/manage/storage-path-list/storage-path-list.component'
|
2023-09-24 19:24:28 -07:00
|
|
|
import { TasksComponent } from './components/admin/tasks/tasks.component'
|
2022-11-12 04:03:35 -08:00
|
|
|
import { PermissionsGuard } from './guards/permissions.guard'
|
2022-08-06 19:30:39 -07:00
|
|
|
import { DirtyDocGuard } from './guards/dirty-doc.guard'
|
2022-10-29 23:14:33 -07:00
|
|
|
import { DirtySavedViewGuard } from './guards/dirty-saved-view.guard'
|
2022-11-12 04:03:35 -08:00
|
|
|
import {
|
|
|
|
|
PermissionAction,
|
|
|
|
|
PermissionType,
|
|
|
|
|
} from './services/permissions.service'
|
2024-01-03 00:19:19 -08:00
|
|
|
import { WorkflowsComponent } from './components/manage/workflows/workflows.component'
|
2023-09-24 19:24:28 -07:00
|
|
|
import { MailComponent } from './components/manage/mail/mail.component'
|
|
|
|
|
import { UsersAndGroupsComponent } from './components/admin/users-groups/users-groups.component'
|
2023-11-05 17:26:51 -08:00
|
|
|
import { CustomFieldsComponent } from './components/manage/custom-fields/custom-fields.component'
|
2023-12-29 15:42:56 -08:00
|
|
|
import { ConfigComponent } from './components/admin/config/config.component'
|
2024-06-17 08:07:08 -07:00
|
|
|
import { TrashComponent } from './components/admin/trash/trash.component'
|
2024-12-03 11:09:02 -08:00
|
|
|
import { SavedViewsComponent } from './components/manage/saved-views/saved-views.component'
|
2020-10-27 01:10:18 +01:00
|
|
|
|
2023-05-23 15:02:54 -07:00
|
|
|
export const routes: Routes = [
|
2022-03-11 10:53:32 -08:00
|
|
|
{ path: '', redirectTo: 'dashboard', pathMatch: 'full' },
|
|
|
|
|
{
|
|
|
|
|
path: '',
|
|
|
|
|
component: AppFrameComponent,
|
2022-08-06 19:30:39 -07:00
|
|
|
canDeactivate: [DirtyDocGuard],
|
2022-03-11 10:53:32 -08:00
|
|
|
children: [
|
|
|
|
|
{ path: 'dashboard', component: DashboardComponent },
|
2022-10-29 23:14:33 -07:00
|
|
|
{
|
|
|
|
|
path: 'documents',
|
|
|
|
|
component: DocumentListComponent,
|
|
|
|
|
canDeactivate: [DirtySavedViewGuard],
|
2022-11-12 04:03:35 -08:00
|
|
|
canActivate: [PermissionsGuard],
|
|
|
|
|
data: {
|
|
|
|
|
requiredPermission: {
|
|
|
|
|
action: PermissionAction.View,
|
|
|
|
|
type: PermissionType.Document,
|
|
|
|
|
},
|
|
|
|
|
},
|
2022-10-29 23:14:33 -07:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
path: 'view/:id',
|
|
|
|
|
component: DocumentListComponent,
|
|
|
|
|
canDeactivate: [DirtySavedViewGuard],
|
2022-11-12 04:03:35 -08:00
|
|
|
canActivate: [PermissionsGuard],
|
|
|
|
|
data: {
|
|
|
|
|
requiredPermission: {
|
|
|
|
|
action: PermissionAction.View,
|
|
|
|
|
type: PermissionType.SavedView,
|
|
|
|
|
},
|
|
|
|
|
},
|
2022-11-11 18:33:04 +00:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
path: 'documents/:id',
|
|
|
|
|
component: DocumentDetailComponent,
|
2022-11-12 04:03:35 -08:00
|
|
|
canActivate: [PermissionsGuard],
|
|
|
|
|
data: {
|
|
|
|
|
requiredPermission: {
|
|
|
|
|
action: PermissionAction.View,
|
|
|
|
|
type: PermissionType.Document,
|
|
|
|
|
},
|
|
|
|
|
},
|
2022-11-11 18:33:04 +00:00
|
|
|
},
|
2023-03-16 23:18:16 -07:00
|
|
|
{
|
|
|
|
|
path: 'documents/:id/:section',
|
|
|
|
|
component: DocumentDetailComponent,
|
|
|
|
|
canActivate: [PermissionsGuard],
|
|
|
|
|
data: {
|
|
|
|
|
requiredPermission: {
|
|
|
|
|
action: PermissionAction.View,
|
|
|
|
|
type: PermissionType.Document,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
2022-11-11 18:33:04 +00:00
|
|
|
{
|
|
|
|
|
path: 'asn/:id',
|
|
|
|
|
component: DocumentAsnComponent,
|
2022-11-12 04:03:35 -08:00
|
|
|
canActivate: [PermissionsGuard],
|
|
|
|
|
data: {
|
|
|
|
|
requiredPermission: {
|
|
|
|
|
action: PermissionAction.View,
|
|
|
|
|
type: PermissionType.Document,
|
|
|
|
|
},
|
|
|
|
|
},
|
2022-11-11 18:33:04 +00:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
path: 'tags',
|
|
|
|
|
component: TagListComponent,
|
2022-11-12 04:03:35 -08:00
|
|
|
canActivate: [PermissionsGuard],
|
|
|
|
|
data: {
|
|
|
|
|
requiredPermission: {
|
|
|
|
|
action: PermissionAction.View,
|
|
|
|
|
type: PermissionType.Tag,
|
|
|
|
|
},
|
|
|
|
|
},
|
2022-11-11 18:33:04 +00:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
path: 'documenttypes',
|
|
|
|
|
component: DocumentTypeListComponent,
|
2022-11-12 04:03:35 -08:00
|
|
|
canActivate: [PermissionsGuard],
|
|
|
|
|
data: {
|
|
|
|
|
requiredPermission: {
|
|
|
|
|
action: PermissionAction.View,
|
|
|
|
|
type: PermissionType.DocumentType,
|
|
|
|
|
},
|
|
|
|
|
},
|
2022-11-11 18:33:04 +00:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
path: 'correspondents',
|
|
|
|
|
component: CorrespondentListComponent,
|
2022-11-12 04:03:35 -08:00
|
|
|
canActivate: [PermissionsGuard],
|
|
|
|
|
data: {
|
|
|
|
|
requiredPermission: {
|
|
|
|
|
action: PermissionAction.View,
|
|
|
|
|
type: PermissionType.Correspondent,
|
|
|
|
|
},
|
|
|
|
|
},
|
2022-11-11 18:33:04 +00:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
path: 'storagepaths',
|
|
|
|
|
component: StoragePathListComponent,
|
2022-11-12 04:03:35 -08:00
|
|
|
canActivate: [PermissionsGuard],
|
|
|
|
|
data: {
|
|
|
|
|
requiredPermission: {
|
|
|
|
|
action: PermissionAction.View,
|
|
|
|
|
type: PermissionType.StoragePath,
|
|
|
|
|
},
|
|
|
|
|
},
|
2022-11-11 18:33:04 +00:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
path: 'logs',
|
|
|
|
|
component: LogsComponent,
|
2022-11-12 04:03:35 -08:00
|
|
|
canActivate: [PermissionsGuard],
|
|
|
|
|
data: {
|
2024-04-13 17:35:34 -07:00
|
|
|
requireAdmin: true,
|
2022-11-12 04:03:35 -08:00
|
|
|
},
|
2022-10-29 23:14:33 -07:00
|
|
|
},
|
2024-06-17 08:07:08 -07:00
|
|
|
{
|
|
|
|
|
path: 'trash',
|
|
|
|
|
component: TrashComponent,
|
|
|
|
|
canActivate: [PermissionsGuard],
|
|
|
|
|
data: {
|
2024-06-18 20:14:38 -07:00
|
|
|
requiredPermission: {
|
|
|
|
|
action: PermissionAction.Delete,
|
|
|
|
|
type: PermissionType.Document,
|
|
|
|
|
},
|
2024-06-17 08:07:08 -07:00
|
|
|
},
|
|
|
|
|
},
|
2023-09-24 19:24:28 -07:00
|
|
|
// redirect old paths
|
|
|
|
|
{
|
|
|
|
|
path: 'settings/mail',
|
|
|
|
|
redirectTo: '/mail',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
path: 'settings/usersgroups',
|
|
|
|
|
redirectTo: '/usersgroups',
|
|
|
|
|
},
|
2024-12-03 11:09:02 -08:00
|
|
|
{
|
|
|
|
|
path: 'settings/savedviews',
|
|
|
|
|
redirectTo: '/savedviews',
|
|
|
|
|
},
|
2022-03-11 10:53:32 -08:00
|
|
|
{
|
|
|
|
|
path: 'settings',
|
|
|
|
|
component: SettingsComponent,
|
|
|
|
|
canDeactivate: [DirtyFormGuard],
|
2022-11-12 04:03:35 -08:00
|
|
|
canActivate: [PermissionsGuard],
|
|
|
|
|
data: {
|
|
|
|
|
requiredPermission: {
|
2024-02-26 12:19:31 -08:00
|
|
|
action: PermissionAction.Change,
|
2022-11-12 04:03:35 -08:00
|
|
|
type: PermissionType.UISettings,
|
|
|
|
|
},
|
|
|
|
|
},
|
2022-11-11 18:33:04 +00:00
|
|
|
},
|
|
|
|
|
{
|
2023-03-16 23:18:16 -07:00
|
|
|
path: 'settings/:section',
|
|
|
|
|
component: SettingsComponent,
|
|
|
|
|
canDeactivate: [DirtyFormGuard],
|
2022-11-12 04:03:35 -08:00
|
|
|
canActivate: [PermissionsGuard],
|
|
|
|
|
data: {
|
|
|
|
|
requiredPermission: {
|
|
|
|
|
action: PermissionAction.View,
|
2023-03-16 23:18:16 -07:00
|
|
|
type: PermissionType.UISettings,
|
2022-11-12 04:03:35 -08:00
|
|
|
},
|
|
|
|
|
},
|
2022-03-11 10:53:32 -08:00
|
|
|
},
|
2023-12-29 15:42:56 -08:00
|
|
|
{
|
|
|
|
|
path: 'config',
|
|
|
|
|
component: ConfigComponent,
|
|
|
|
|
canActivate: [PermissionsGuard],
|
|
|
|
|
data: {
|
|
|
|
|
requiredPermission: {
|
2024-01-23 12:23:15 -08:00
|
|
|
action: PermissionAction.Change,
|
|
|
|
|
type: PermissionType.AppConfig,
|
2023-12-29 15:42:56 -08:00
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
2023-03-16 23:18:16 -07:00
|
|
|
{
|
|
|
|
|
path: 'tasks',
|
|
|
|
|
component: TasksComponent,
|
2022-12-05 12:28:44 -08:00
|
|
|
canActivate: [PermissionsGuard],
|
|
|
|
|
data: {
|
|
|
|
|
requiredPermission: {
|
|
|
|
|
action: PermissionAction.View,
|
2023-03-16 23:18:16 -07:00
|
|
|
type: PermissionType.PaperlessTask,
|
2022-12-05 12:28:44 -08:00
|
|
|
},
|
|
|
|
|
},
|
2022-12-05 01:25:11 -08:00
|
|
|
},
|
2023-11-05 17:26:51 -08:00
|
|
|
{
|
|
|
|
|
path: 'customfields',
|
|
|
|
|
component: CustomFieldsComponent,
|
|
|
|
|
canActivate: [PermissionsGuard],
|
|
|
|
|
data: {
|
|
|
|
|
requiredPermission: {
|
|
|
|
|
action: PermissionAction.View,
|
|
|
|
|
type: PermissionType.CustomField,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
2023-09-22 16:53:13 -07:00
|
|
|
{
|
2024-01-03 00:19:19 -08:00
|
|
|
path: 'workflows',
|
|
|
|
|
component: WorkflowsComponent,
|
2023-09-22 16:53:13 -07:00
|
|
|
canActivate: [PermissionsGuard],
|
|
|
|
|
data: {
|
|
|
|
|
requiredPermission: {
|
|
|
|
|
action: PermissionAction.View,
|
2024-01-03 00:19:19 -08:00
|
|
|
type: PermissionType.Workflow,
|
2023-09-22 16:53:13 -07:00
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
2023-09-24 19:24:28 -07:00
|
|
|
{
|
|
|
|
|
path: 'mail',
|
|
|
|
|
component: MailComponent,
|
|
|
|
|
canActivate: [PermissionsGuard],
|
|
|
|
|
data: {
|
|
|
|
|
requiredPermission: {
|
|
|
|
|
action: PermissionAction.View,
|
|
|
|
|
type: PermissionType.MailAccount,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
path: 'usersgroups',
|
|
|
|
|
component: UsersAndGroupsComponent,
|
|
|
|
|
canActivate: [PermissionsGuard],
|
|
|
|
|
data: {
|
|
|
|
|
requiredPermission: {
|
|
|
|
|
action: PermissionAction.View,
|
|
|
|
|
type: PermissionType.User,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
2024-12-03 11:09:02 -08:00
|
|
|
{
|
|
|
|
|
path: 'savedviews',
|
|
|
|
|
component: SavedViewsComponent,
|
|
|
|
|
canActivate: [PermissionsGuard],
|
|
|
|
|
data: {
|
|
|
|
|
requiredPermission: {
|
|
|
|
|
action: PermissionAction.View,
|
|
|
|
|
type: PermissionType.SavedView,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
2022-03-11 10:53:32 -08:00
|
|
|
],
|
|
|
|
|
},
|
2020-10-27 01:10:18 +01:00
|
|
|
|
2022-03-11 10:53:32 -08:00
|
|
|
{ path: '404', component: NotFoundComponent },
|
|
|
|
|
{ path: '**', redirectTo: '/404', pathMatch: 'full' },
|
|
|
|
|
]
|
2020-10-27 01:10:18 +01:00
|
|
|
|
|
|
|
|
@NgModule({
|
2023-01-11 23:10:16 -08:00
|
|
|
imports: [RouterModule.forRoot(routes)],
|
2022-03-11 10:53:32 -08:00
|
|
|
exports: [RouterModule],
|
2020-10-27 01:10:18 +01:00
|
|
|
})
|
2022-03-11 10:53:32 -08:00
|
|
|
export class AppRoutingModule {}
|