mirror of
https://dev.azure.com/hugendubel/ISA/_git/ISA-Frontend
synced 2025-12-28 22:42:11 +01:00
#3673 ArrivalStatus Prüfung
This commit is contained in:
@@ -70,9 +70,9 @@ export class PackageDetailsComponent {
|
||||
this.onNextAction(action);
|
||||
} else {
|
||||
try {
|
||||
await this.changePackageStatus(action.value);
|
||||
const changes = await this.changePackageStatus(action.value);
|
||||
this.updatedToaster();
|
||||
this.navigateToList((+action.value as ArrivalStatus) || 0);
|
||||
this.navigateToList(changes);
|
||||
} catch (error) {
|
||||
this._uiModal.error('Fehler beim Speichern der Daten.', error);
|
||||
}
|
||||
@@ -80,17 +80,28 @@ export class PackageDetailsComponent {
|
||||
this.calculateListHeight();
|
||||
}
|
||||
|
||||
async navigateToList(arrivalStatus: ArrivalStatus) {
|
||||
async navigateToList({
|
||||
previousArrivalStatus,
|
||||
newArrivalStatus,
|
||||
}: {
|
||||
previousArrivalStatus: ArrivalStatus;
|
||||
newArrivalStatus: ArrivalStatus;
|
||||
}) {
|
||||
// Navigiere nur zurück, wenn der Status nicht 4 oder 16 ist (Fehlt)
|
||||
if ([4, 16].includes(previousArrivalStatus)) {
|
||||
this._router.navigate([`/filiale/package-inspection/packages`]);
|
||||
return;
|
||||
}
|
||||
|
||||
const breadcrumb = await this._getListPageBreadcrumb();
|
||||
|
||||
// Navigiere nur zurück, wenn der Status nicht 4 oder 16 ist (Fehlt)
|
||||
if (breadcrumb && ![4, 16].includes(arrivalStatus)) {
|
||||
if (breadcrumb) {
|
||||
const packageId = await this.packageId$.pipe(first()).toPromise();
|
||||
this._router.navigate([breadcrumb.path], {
|
||||
queryParams: {
|
||||
...breadcrumb.params,
|
||||
updated_packageId: packageId,
|
||||
updated_arrivalStatus: arrivalStatus,
|
||||
updated_arrivalStatus: newArrivalStatus,
|
||||
},
|
||||
});
|
||||
} else {
|
||||
@@ -108,9 +119,19 @@ export class PackageDetailsComponent {
|
||||
this.childActionsSubject.next(action.children || undefined);
|
||||
}
|
||||
|
||||
async changePackageStatus(status: string): Promise<void> {
|
||||
async changePackageStatus(
|
||||
status: string
|
||||
): Promise<{
|
||||
previousArrivalStatus: ArrivalStatus;
|
||||
newArrivalStatus: ArrivalStatus;
|
||||
}> {
|
||||
const packageDetails = await this.packageDetails$.pipe(first()).toPromise();
|
||||
await this._packageInspectionService.changePackageStatus(packageDetails.package, status).toPromise();
|
||||
|
||||
return {
|
||||
previousArrivalStatus: packageDetails.package.arrivalStatus,
|
||||
newArrivalStatus: (+status as ArrivalStatus) ?? 0,
|
||||
};
|
||||
}
|
||||
|
||||
async createBreadcrumbIfNotExists(details: PackageDetailResponseDTO): Promise<void> {
|
||||
|
||||
Reference in New Issue
Block a user