mirror of
https://dev.azure.com/hugendubel/ISA/_git/ISA-Frontend
synced 2025-12-31 09:37:15 +01:00
#2162 - WA - Auf der Details Seite werden nur items mit dem gleichen Kunden angezeigt.
This commit is contained in:
@@ -10,6 +10,7 @@ import { debounceTime, filter, first, map, shareReplay, switchMap, takeUntil, ta
|
||||
export interface GoodsOutDetailsComponentState {
|
||||
fetching: boolean;
|
||||
orderNumber?: string;
|
||||
buyerNumber?: string;
|
||||
processingStatus?: OrderItemProcessingStatusValue;
|
||||
compartmentCode?: string;
|
||||
items?: OrderItemListItemDTO[];
|
||||
@@ -25,6 +26,8 @@ export interface GoodsOutDetailsComponentState {
|
||||
export class GoodsOutDetailsComponent extends ComponentStore<GoodsOutDetailsComponentState> implements OnInit, OnDestroy {
|
||||
orderNumber$ = this.select((s) => decodeURIComponent(s.orderNumber ?? '') || undefined);
|
||||
|
||||
buyerNumber$ = this.select((s) => s.buyerNumber);
|
||||
|
||||
compartmentCode$ = this.select((s) => decodeURIComponent(s.compartmentCode ?? '') || undefined);
|
||||
|
||||
processingStatus$ = this.select((s) => s.processingStatus);
|
||||
@@ -37,8 +40,10 @@ export class GoodsOutDetailsComponent extends ComponentStore<GoodsOutDetailsComp
|
||||
return this.get((s) => s.items);
|
||||
}
|
||||
|
||||
itemsWithProcessingStatus$ = combineLatest([this.items$, this.processingStatus$]).pipe(
|
||||
map(([items, processingStatus]) => items.filter((item) => item.processingStatus === processingStatus))
|
||||
itemsWithProcessingStatus$ = combineLatest([this.items$, this.processingStatus$, this.buyerNumber$]).pipe(
|
||||
map(([items, processingStatus, buyerNumber]) => {
|
||||
return items.filter((item) => item.processingStatus === processingStatus && item.buyerNumber === buyerNumber);
|
||||
})
|
||||
);
|
||||
|
||||
order$ = this.orderId$.pipe(
|
||||
@@ -68,6 +73,11 @@ export class GoodsOutDetailsComponent extends ComponentStore<GoodsOutDetailsComp
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this._activatedRoute.queryParams.pipe(takeUntil(this._onDestroy$)).subscribe((params) => {
|
||||
const buyerNumber: string = decodeURIComponent(params.buyerNumber ?? '');
|
||||
this.patchState({ buyerNumber });
|
||||
});
|
||||
|
||||
this._activatedRoute.params.pipe(takeUntil(this._onDestroy$)).subscribe(async (params) => {
|
||||
const orderNumber: string = params?.orderNumber;
|
||||
const compartmentCode = params?.compartmentCode;
|
||||
@@ -92,6 +102,9 @@ export class GoodsOutDetailsComponent extends ComponentStore<GoodsOutDetailsComp
|
||||
key: this.processId,
|
||||
name: item?.compartmentCode || item?.orderNumber,
|
||||
path: this.getDetailsPath(item),
|
||||
params: {
|
||||
buyerNumber: item.buyerNumber,
|
||||
},
|
||||
section: 'customer',
|
||||
tags: ['goods-out', 'details', item?.compartmentCode || item?.orderNumber],
|
||||
});
|
||||
@@ -122,8 +135,8 @@ export class GoodsOutDetailsComponent extends ComponentStore<GoodsOutDetailsComp
|
||||
$.pipe(
|
||||
tap(() => this.patchState({ fetching: false })),
|
||||
debounceTime(500),
|
||||
withLatestFrom(this.orderNumber$, this.compartmentCode$, this.processingStatus$),
|
||||
switchMap(([_, orderNumber, compartmentCode, processingStatus]) => {
|
||||
withLatestFrom(this.orderNumber$, this.compartmentCode$, this.processingStatus$, this.buyerNumber$),
|
||||
switchMap(([_, orderNumber, compartmentCode, processingStatus, buyerNumber]) => {
|
||||
let request$: Observable<ListResponseArgsOfOrderItemListItemDTO>;
|
||||
if (compartmentCode) {
|
||||
request$ = this._domainGoodsInService.getWarenausgabeItemByCompartment(compartmentCode);
|
||||
@@ -138,7 +151,9 @@ export class GoodsOutDetailsComponent extends ComponentStore<GoodsOutDetailsComp
|
||||
items: res.result,
|
||||
orderId: res.result[0].orderId,
|
||||
});
|
||||
this.updateBreadcrumb(res.result.find((item) => item.processingStatus === processingStatus));
|
||||
this.updateBreadcrumb(
|
||||
res.result.find((item) => item.processingStatus === processingStatus && item.buyerNumber === buyerNumber)
|
||||
);
|
||||
},
|
||||
(err) => {},
|
||||
() => {
|
||||
|
||||
@@ -258,9 +258,14 @@ export class GoodsOutSearchResultsComponent extends ComponentStore<GoodsOutSearc
|
||||
const compartmentCode = orderItem.compartmentCode;
|
||||
|
||||
if (compartmentCode) {
|
||||
this._router.navigate([
|
||||
`/kunde/${processId}/goods/out/details/compartment/${encodeURIComponent(compartmentCode)}/${processingStatus}`,
|
||||
]);
|
||||
this._router.navigate(
|
||||
[`/kunde/${processId}/goods/out/details/compartment/${encodeURIComponent(compartmentCode)}/${processingStatus}`],
|
||||
{
|
||||
queryParams: {
|
||||
buyerNumber: orderItem.buyerNumber,
|
||||
},
|
||||
}
|
||||
);
|
||||
} else {
|
||||
this._router.navigate([`/kunde/${processId}/goods/out/details/order/${encodeURIComponent(orderNumber)}/${processingStatus}`]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user