Fixed breadcrumbs for reporting pages

This commit is contained in:
Erik Tiekstra
2021-10-06 08:38:42 +02:00
parent 5cee96951a
commit cc0a9aae7f
2 changed files with 17 additions and 2 deletions

View File

@@ -1,3 +1,9 @@
export const DELTAGARE_REPORTING_ROUTES = {
'gemensam-planering': 'Gemensam planering',
'periodisk-redovisning': 'Periodisk redovisning',
avvikelserapport: 'Avvikelserapport',
};
export const NAVIGATION = {
administration: 'Administration',
personal: 'Hantera personalkonton',
@@ -9,4 +15,5 @@ export const NAVIGATION = {
'skapa-personalkonto': 'Skapa personalkonto',
obehorig: 'Saknar behörigheter',
tillganglighet: 'Tillgänglighetsredogörelse',
...DELTAGARE_REPORTING_ROUTES,
};

View File

@@ -1,4 +1,5 @@
import { NavigationBreadcrumbsItem } from '@af/digi-ng/_navigation/navigation-breadcrumbs';
import { DELTAGARE_REPORTING_ROUTES } from '@msfa-constants/navigation';
import { mapPathToPageName } from './map-path-to-page-name.util';
export function mapPathsToBreadcrumbs(
@@ -21,9 +22,12 @@ export function mapPathsToBreadcrumbs(
routerLink: '/administration/personal',
};
breadcrumbs[breadcrumbs.length - 1].text = 'Redigera personalkonto';
} else if (isParticipantCardRoute(paths)) {
} else if (isDeltagareCardRoute(paths)) {
breadcrumbs[breadcrumbs.length - 1].text = 'Deltagarinformation';
} else if (isDeltagareReportingRoute(paths)) {
breadcrumbs[breadcrumbs.length - 2].text = 'Deltagarinformation';
}
return breadcrumbs;
}
@@ -35,6 +39,10 @@ function isEmployeeEditRoute(paths: string[]): boolean {
return paths.length === 3 && paths[1] === 'redigera-personalkonto';
}
function isParticipantCardRoute(paths: string[]): boolean {
function isDeltagareCardRoute(paths: string[]): boolean {
return paths.length === 2 && paths[0] === 'deltagare';
}
function isDeltagareReportingRoute(paths: string[]): boolean {
return paths.length === 3 && paths[0] === 'deltagare' && paths[2] in DELTAGARE_REPORTING_ROUTES;
}