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 | 26x 26x 26x 26x 26x 26x 26x 26x 16x 16x 16x 15x 12x 1x 11x 1x 10x 1x 9x 4x 4x 5x 1x 4x 3x 3x 1x | import { Injectable } from '@angular/core'; import { TranslateService } from '@ngx-translate/core'; import { EMPTY, Observable, of } from 'rxjs'; import { map, switchMap, withLatestFrom } from 'rxjs/operators'; import { AppFacade } from 'ish-core/facades/app.facade'; import { BreadcrumbItem } from 'ish-core/models/breadcrumb-item/breadcrumb-item.interface'; import { whenFalsy, whenTruthy } from 'ish-core/utils/operators'; import { OrganizationManagementFacade } from '../../facades/organization-management.facade'; @Injectable({ providedIn: 'root' }) export class OrganizationManagementBreadcrumbService { constructor( private appFacade: AppFacade, private organizationManagementFacade: OrganizationManagementFacade, private translateService: TranslateService ) {} breadcrumb$(prefix: string): Observable<BreadcrumbItem[]> { return this.appFacade.routingInProgress$.pipe( whenFalsy(), withLatestFrom(this.appFacade.path$.pipe(whenTruthy())), switchMap(([, path]) => { if (path.endsWith('users')) { return of([{ key: 'account.organization.user_management' }]); } else if (path.endsWith('cost-centers')) { return of([{ key: 'account.organization.cost_center_management' }]); } else if (path.endsWith('users/create')) { return of([ { key: 'account.organization.user_management', link: `${prefix}/users` }, { key: 'account.user.breadcrumbs.new_user.text' }, ]); } else if (/users\/:B2BCustomerLogin(\/(profile|roles|budget))?$/.test(path)) { return this.organizationManagementFacade.selectedUser$.pipe( whenTruthy(), withLatestFrom(this.translateService.get('account.organization.user_management.user_detail.breadcrumb')), map(([user, translation]) => path.endsWith('profile') || path.endsWith('roles') || path.endsWith('budget') ? // edit user detail [ { key: 'account.organization.user_management', link: `${prefix}/users` }, { text: `${translation} - ${user.firstName} ${user.lastName}`, link: `${prefix}/users/${user.login}`, }, { key: `account.user.update_${path.substring(path.lastIndexOf('/') + 1)}.heading`, }, ] : // user detail [ { key: 'account.organization.user_management', link: `${prefix}/users` }, { text: `${translation} - ${user.firstName} ${user.lastName}` }, ] ) ); } else if (path.endsWith('cost-centers/create')) { return of([ { key: 'account.organization.cost_center_management', link: `${prefix}/cost-centers` }, { key: 'account.costcenter.create.heading' }, ]); } else if (/cost-centers\/:CostCenterId(\/(edit|buyers))?$/.test(path)) { return this.organizationManagementFacade.selectedCostCenter$.pipe( whenTruthy(), map(cc => path.endsWith('edit') || path.endsWith('buyers') ? [ { key: 'account.organization.cost_center_management', link: `${prefix}/cost-centers` }, { text: `${cc.name}`, link: `${prefix}/cost-centers/${cc.id}`, }, { key: `account.costcenter.details.${path.substring(path.lastIndexOf('/') + 1)}.heading`, }, ] : [ { key: 'account.organization.cost_center_management', link: `${prefix}/cost-centers` }, { text: cc.name }, ] ) ); } return EMPTY; }) ); } } |