Merged PR 730: #1944 Kundendetails Bestellungen Breadcrumb

#1944 Kundendetails Bestellungen Breadcrumb

Related work items: #1944
This commit is contained in:
Andreas Schickinger
2021-06-30 08:26:21 +00:00
committed by Lorenz Hilpert
parent 43876e2ceb
commit b0bb686a35
2 changed files with 33 additions and 1 deletions

View File

@@ -170,6 +170,8 @@ export class CustomerDetailsComponent implements OnInit {
path: `/customer/${customerId}`,
tags: ['customer', 'details'],
});
this.breadcrumb.removeBreadcrumbsAfter(this.currentBreadcrumb.id, ['customer']);
}
updateBreadcrumbName(customer: CustomerDTO) {

View File

@@ -8,6 +8,8 @@ import { OrderListItemDTO } from '@swagger/oms';
import { OmsService } from '@domain/oms';
import { Observable } from 'rxjs/internal/Observable';
import { BehaviorSubject, combineLatest, Subscription } from 'rxjs';
import { ApplicationService } from '@core/application';
import { BreadcrumbService } from '@core/breadcrumb';
@Component({
selector: 'page-customer-orders',
@@ -26,7 +28,13 @@ export class CustomerOrdersComponent implements OnInit, OnDestroy {
isLoading: boolean;
hasCustomerCard$: Observable<boolean>;
constructor(private activatedRoute: ActivatedRoute, private customerDetailsService: CrmCustomerService, private omsService: OmsService) {}
constructor(
private activatedRoute: ActivatedRoute,
private customerDetailsService: CrmCustomerService,
private omsService: OmsService,
private application: ApplicationService,
private breadcrumb: BreadcrumbService
) {}
ngOnInit() {
const customerId$ = this.activatedRoute.params.pipe(map((params) => Number(params['customerId'])));
@@ -53,6 +61,28 @@ export class CustomerOrdersComponent implements OnInit, OnDestroy {
this.isLoading = false;
})
);
this.createBreadcrumb();
}
async createBreadcrumb() {
const customer = await this.customer$?.pipe(first()).toPromise();
this.breadcrumb.addBreadcrumbIfNotExists({
key: this.application.activatedProcessId,
name: 'Bestellungen',
path: `/customer/${customer?.id}/orders`,
tags: ['customer', 'orders'],
params: {},
});
const crumbs = await this.breadcrumb
.getBreadcrumbsByKeyAndTags$(this.application.activatedProcessId, ['customer', 'orders'])
.pipe(first())
.toPromise();
for (const crumb of crumbs) {
this.breadcrumb.removeBreadcrumbsAfter(crumb.id, ['customer']);
}
}
ngOnDestroy() {