mirror of
https://dev.azure.com/hugendubel/ISA/_git/ISA-Frontend
synced 2025-12-31 09:37:15 +01:00
Dasboard Product Navigation
This commit is contained in:
@@ -12,6 +12,7 @@ export class CanActivateProductGuard implements CanActivate {
|
|||||||
let lastActivatedProcessId = (
|
let lastActivatedProcessId = (
|
||||||
await this._applicationService.getLastActivatedProcessWithSectionAndType$('customer', 'cart').pipe(first()).toPromise()
|
await this._applicationService.getLastActivatedProcessWithSectionAndType$('customer', 'cart').pipe(first()).toPromise()
|
||||||
)?.id;
|
)?.id;
|
||||||
|
|
||||||
if (!lastActivatedProcessId) {
|
if (!lastActivatedProcessId) {
|
||||||
lastActivatedProcessId = Date.now();
|
lastActivatedProcessId = Date.now();
|
||||||
await this._applicationService.createProcess({
|
await this._applicationService.createProcess({
|
||||||
@@ -21,7 +22,16 @@ export class CanActivateProductGuard implements CanActivate {
|
|||||||
name: `Vorgang ${processes.length + 1}`,
|
name: `Vorgang ${processes.length + 1}`,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
await this._router.navigate(['/kunde', lastActivatedProcessId, 'product']);
|
|
||||||
|
await this._router.navigate(this.getUrlFromSnapshot(route, ['/kunde', String(lastActivatedProcessId)]));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getUrlFromSnapshot(route: ActivatedRouteSnapshot, url: string[] = []): string[] {
|
||||||
|
url.push(...route.url.map((segment) => segment.path));
|
||||||
|
if (route.firstChild) {
|
||||||
|
return this.getUrlFromSnapshot(route.firstChild, url);
|
||||||
|
}
|
||||||
|
return url.filter((segment) => !!segment);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user