All files / projects/organization-management/src/app/pages organization-management-routing.module.ts

18.75% Statements 9/48
100% Branches 0/0
0% Functions 0/39
36.36% Lines 8/22

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 12528x 28x   28x 28x   28x 28x             28x                                                                                                                                                                                                                         28x  
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
 
import { authorizationToggleGuard } from 'ish-core/authorization-toggle.module';
import { featureToggleGuard } from 'ish-core/feature-toggle.module';
 
import { fetchUsersGuard } from '../guards/fetch-users.guard';
import { redirectFirstToParentGuard } from '../guards/redirect-first-to-parent.guard';
 
/**
 * routes for the organization management
 *
 * visible for testing
 */
export const routes: Routes = [
  { path: '', redirectTo: 'cost-centers', pathMatch: 'full' },
  {
    path: 'settings',
    loadChildren: () =>
      import('./organization-settings/organization-settings-page.module').then(m => m.OrganizationSettingsPageModule),
    data: {
      meta: {
        title: 'account.organization.org_settings',
        robots: 'noindex, nofollow',
      },
      permission: 'APP_B2B_MANAGE_USERS',
    },
    canActivate: [authorizationToggleGuard],
  },
  {
    path: 'settings/company',
    loadChildren: () =>
      import('./organization-settings-company/organization-settings-company-page.module').then(
        m => m.OrganizationSettingsCompanyPageModule
      ),
    data: { permission: 'APP_B2B_MANAGE_USERS' },
    canActivate: [authorizationToggleGuard],
  },
  {
    path: 'users',
    loadChildren: () => import('./users/users-page.module').then(m => m.UsersPageModule),
    data: {
      meta: {
        title: 'account.organization.user_management',
        robots: 'noindex, nofollow',
      },
      permission: 'APP_B2B_MANAGE_USERS',
    },
    canActivate: [fetchUsersGuard, authorizationToggleGuard],
  },
  {
    path: 'users/create',
    loadChildren: () => import('./user-create/user-create-page.module').then(m => m.UserCreatePageModule),
    data: { permission: 'APP_B2B_MANAGE_USERS' },
    canActivate: [redirectFirstToParentGuard, authorizationToggleGuard],
  },
  {
    path: 'users/:B2BCustomerLogin',
    loadChildren: () => import('./user-detail/user-detail-page.module').then(m => m.UserDetailPageModule),
    canActivate: [fetchUsersGuard, authorizationToggleGuard],
    data: {
      onlyInitialUsers: true,
      permission: 'APP_B2B_MANAGE_USERS',
    },
  },
  {
    path: 'users/:B2BCustomerLogin/profile',
    loadChildren: () =>
      import('./user-edit-profile/user-edit-profile-page.module').then(m => m.UserEditProfilePageModule),
    canActivate: [redirectFirstToParentGuard, authorizationToggleGuard],
    data: { permission: 'APP_B2B_MANAGE_USERS' },
  },
  {
    path: 'users/:B2BCustomerLogin/roles',
    loadChildren: () => import('./user-edit-roles/user-edit-roles-page.module').then(m => m.UserEditRolesPageModule),
    canActivate: [redirectFirstToParentGuard, authorizationToggleGuard],
    data: { permission: 'APP_B2B_MANAGE_USERS' },
  },
  {
    path: 'users/:B2BCustomerLogin/budget',
    loadChildren: () => import('./user-edit-budget/user-edit-budget-page.module').then(m => m.UserEditBudgetPageModule),
    canActivate: [redirectFirstToParentGuard, authorizationToggleGuard],
    data: { permission: 'APP_B2B_MANAGE_USERS' },
  },
  {
    path: 'cost-centers',
    canActivate: [featureToggleGuard],
    data: {
      meta: {
        title: 'account.organization.cost_center_management',
        robots: 'noindex, nofollow',
      },
      feature: 'costCenters',
    },
    loadChildren: () => import('./cost-centers/cost-centers-page.module').then(m => m.CostCentersPageModule),
  },
  {
    path: 'cost-centers/create',
    loadChildren: () =>
      import('./cost-center-create/cost-center-create-page.module').then(m => m.CostCenterCreatePageModule),
    canActivate: [redirectFirstToParentGuard],
  },
  {
    path: 'cost-centers/:CostCenterId',
    loadChildren: () =>
      import('./cost-center-detail/cost-center-detail-page.module').then(m => m.CostCenterDetailPageModule),
  },
  {
    path: 'cost-centers/:CostCenterId/edit',
    loadChildren: () => import('./cost-center-edit/cost-center-edit-page.module').then(m => m.CostCenterEditPageModule),
    canActivate: [redirectFirstToParentGuard],
  },
  {
    path: 'cost-centers/:CostCenterId/buyers',
    loadChildren: () =>
      import('./cost-center-buyers/cost-center-buyers-page.module').then(m => m.CostCenterBuyersPageModule),
    canActivate: [redirectFirstToParentGuard, fetchUsersGuard],
  },
];
 
@NgModule({
  imports: [RouterModule.forChild(routes)],
})
export class OrganizationManagementRoutingModule {}