#4482 RD // Abholfach - Split-Screen raus bei "Bearbeiten" + ""Historie"

This commit is contained in:
Lorenz Hilpert
2023-11-20 13:38:11 +01:00
parent 80342e61ac
commit 98a331ffe5
5 changed files with 64 additions and 37 deletions

View File

@@ -5,6 +5,8 @@ import { PickupShelfDetailsStore, PickupShelfStore } from './store';
import { ActionHandlerService } from './services/action-handler.service';
import { DBHOrderItemListItemDTO, KeyValueDTOOfStringAndString } from '@swagger/oms';
import { OrderItemsContext } from '@domain/oms';
import { map } from 'rxjs/operators';
import { coerceBooleanProperty } from '@angular/cdk/coercion';
export abstract class PickupShelfDetailsBaseComponent {
protected destroyRef = inject(DestroyRef);
@@ -18,6 +20,12 @@ export abstract class PickupShelfDetailsBaseComponent {
store = inject(PickupShelfDetailsStore);
listStore = inject(PickupShelfStore);
get side() {
return coerceBooleanProperty(this.activatedRoute.snapshot.queryParams.side);
}
side$ = this.activatedRoute.queryParams.pipe(map((params) => coerceBooleanProperty(params.side)));
constructor() {
this.activatedRoute.params.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((params) => {
this.store.fetchOrder({ orderId: Number(params.orderId) });

View File

@@ -208,28 +208,34 @@ export class PickupShelfInDetailsComponent extends PickupShelfDetailsBaseCompone
async navigateToEditPage(orderItem: DBHOrderItemListItemDTO) {
await this.router.navigate(
this._pickupShelfInNavigationService.editRoute({
compartmentCode: orderItem.compartmentCode,
orderId: orderItem.orderId,
orderNumber: orderItem.orderNumber,
processingStatus: orderItem.processingStatus,
orderItemSubsetId: orderItem.orderItemSubsetId,
compartmentInfo: orderItem.compartmentInfo,
}).path,
this._pickupShelfInNavigationService.editRoute(
{
compartmentCode: orderItem.compartmentCode,
orderId: orderItem.orderId,
orderNumber: orderItem.orderNumber,
processingStatus: orderItem.processingStatus,
orderItemSubsetId: orderItem.orderItemSubsetId,
compartmentInfo: orderItem.compartmentInfo,
},
{ side: this.side }
).path,
{ queryParams: { buyerNumber: orderItem?.buyerNumber }, queryParamsHandling: 'merge' }
);
}
async navigateToHistoryPage(orderItem: DBHOrderItemListItemDTO) {
await this.router.navigate(
this._pickupShelfInNavigationService.historyRoute({
compartmentCode: orderItem.compartmentCode,
orderId: orderItem.orderId,
orderNumber: orderItem.orderNumber,
processingStatus: orderItem.processingStatus,
orderItemSubsetId: orderItem.orderItemSubsetId,
compartmentInfo: orderItem.compartmentInfo,
}).path,
this._pickupShelfInNavigationService.historyRoute(
{
compartmentCode: orderItem.compartmentCode,
orderId: orderItem.orderId,
orderNumber: orderItem.orderNumber,
processingStatus: orderItem.processingStatus,
orderItemSubsetId: orderItem.orderItemSubsetId,
compartmentInfo: orderItem.compartmentInfo,
},
{ side: this.side }
).path,
{ queryParams: { orderItemSubsetId: orderItem.orderItemSubsetId }, queryParamsHandling: 'merge' }
);
}
@@ -241,6 +247,7 @@ export class PickupShelfInDetailsComponent extends PickupShelfDetailsBaseCompone
async coverClick(orderItems: DBHOrderItemListItemDTO[]) {
if (orderItems.length === 1) {
const item = orderItems.find((_) => true);
await this.router.navigate(
this._pickupShelfInNavigationService.detailRoute({
item: {
@@ -251,6 +258,7 @@ export class PickupShelfInDetailsComponent extends PickupShelfDetailsBaseCompone
processingStatus: item.processingStatus,
orderItemSubsetId: item.orderItemSubsetId,
},
side: this.side,
}).path,
{ queryParamsHandling: 'preserve' }
);

View File

@@ -40,6 +40,7 @@ export class PickupShelfInEditComponent extends PickupShelfDetailsBaseComponent
compartmentInfo,
orderItemSubsetId: this.store?.selectPreviousSelectedOrderItemSubsetId,
},
side: this.side,
}).path,
{ queryParamsHandling: 'preserve' }
);

View File

@@ -10,6 +10,7 @@ import { DBHOrderItemListItemDTO } from '@swagger/oms';
import { Observable, combineLatest } from 'rxjs';
import { map, shareReplay, switchMap, take } from 'rxjs/operators';
import { PickupShelfStore } from '../../store';
import { coerceBooleanProperty } from '@angular/cdk/coercion';
@Component({
selector: 'page-pickup-shelf-history',
@@ -90,6 +91,7 @@ export class PickUpShelfHistoryComponent {
orderItemSubsetId: item.orderItemSubsetId,
compartmentInfo: item.compartmentInfo,
},
side: coerceBooleanProperty(this._activatedRoute?.snapshot?.queryParams?.side),
}).path,
{ queryParamsHandling: 'preserve' }
);

View File

@@ -104,7 +104,9 @@ export class PickupShelfInNavigationService {
].filter((v) => !!v);
}
const queryParams = {};
const queryParams = {
side: String(side),
};
const urlTree = this._router.createUrlTree(path, { queryParams });
@@ -115,14 +117,17 @@ export class PickupShelfInNavigationService {
};
}
editRoute(item: {
orderId: number;
orderNumber: string;
compartmentCode: string;
processingStatus: OrderItemProcessingStatusValue;
orderItemSubsetId: number;
compartmentInfo: string;
}): NavigationRoute {
editRoute(
item: {
orderId: number;
orderNumber: string;
compartmentCode: string;
processingStatus: OrderItemProcessingStatusValue;
orderItemSubsetId: number;
compartmentInfo: string;
},
{ side }: { side?: boolean } = { side: true }
): NavigationRoute {
let path: any[];
if (!item.orderItemSubsetId) {
@@ -145,7 +150,7 @@ export class PickupShelfInNavigationService {
item.orderItemSubsetId,
'edit',
].filter((v) => !!v),
side: ['list'],
side: side ? ['list'] : null,
},
},
].filter((v) => !!v);
@@ -165,7 +170,7 @@ export class PickupShelfInNavigationService {
item.orderItemSubsetId,
'edit',
].filter((v) => !!v),
side: ['list'],
side: side ? ['list'] : null,
},
},
].filter((v) => !!v);
@@ -182,14 +187,17 @@ export class PickupShelfInNavigationService {
};
}
historyRoute(item: {
orderId: number;
orderNumber: string;
compartmentCode: string;
processingStatus: OrderItemProcessingStatusValue;
orderItemSubsetId: number;
compartmentInfo: string;
}): NavigationRoute {
historyRoute(
item: {
orderId: number;
orderNumber: string;
compartmentCode: string;
processingStatus: OrderItemProcessingStatusValue;
orderItemSubsetId: number;
compartmentInfo: string;
},
{ side }: { side?: boolean } = { side: true }
): NavigationRoute {
let path: any[];
if (!item.orderItemSubsetId) {
@@ -212,7 +220,7 @@ export class PickupShelfInNavigationService {
item.orderItemSubsetId,
'history',
].filter((v) => !!v),
side: ['list'],
side: side ? ['list'] : null,
},
},
].filter((v) => !!v);
@@ -232,7 +240,7 @@ export class PickupShelfInNavigationService {
item.orderItemSubsetId,
'history',
].filter((v) => !!v),
side: ['list'],
side: side ? ['list'] : null,
},
},
].filter((v) => !!v);