mirror of
https://dev.azure.com/hugendubel/ISA/_git/ISA-Frontend
synced 2025-12-31 09:37:15 +01:00
Merged PR 808: #2127 WE Navigation to Goods In Landing Page after Action Arrived got executed
#2127 WE Navigation to Goods In Landing Page after Action Arrived got executed
This commit is contained in:
committed by
Andreas Schickinger
parent
2b500784c4
commit
355be3bddb
@@ -1,4 +1,4 @@
|
||||
<shared-goods-in-out-order-details (actionHandled)="actionHandled($event)">
|
||||
<shared-goods-in-out-order-details (navigateToGoodsInLandingPage)="navigateToLandingPage()" (actionHandled)="actionHandled($event)">
|
||||
<shared-goods-in-out-order-details-header (editClick)="navigateToEditPage($event)"></shared-goods-in-out-order-details-header>
|
||||
<shared-goods-in-out-order-details-item [orderItem]="selectedItem$ | async"></shared-goods-in-out-order-details-item>
|
||||
<shared-goods-in-out-order-details-tags></shared-goods-in-out-order-details-tags>
|
||||
|
||||
@@ -125,8 +125,11 @@ export class GoodsInDetailsComponent extends ComponentStore<GoodsInDetailsCompon
|
||||
)
|
||||
);
|
||||
|
||||
navigateToLandingPage() {
|
||||
this._router.navigate(['/goods/in/']);
|
||||
}
|
||||
|
||||
navigateToEditPage(orderItem: OrderItemListItemDTO) {
|
||||
console.log(orderItem);
|
||||
this._router.navigate([
|
||||
`/goods/in/details/order/${orderItem?.orderNumber}/item/${orderItem?.orderItemId}/${orderItem?.processingStatus}/edit`,
|
||||
]);
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
|
||||
import { ChangeDetectionStrategy, Component, EventEmitter, Input, OnDestroy, Output } from '@angular/core';
|
||||
import { DomainOmsService } from '@domain/oms';
|
||||
import { ComponentStore } from '@ngrx/component-store';
|
||||
import { OrderItemListItemDTO } from '@swagger/oms';
|
||||
import { UiModalService } from '@ui/modal';
|
||||
import { isEqual } from 'lodash';
|
||||
import { first, shareReplay, switchMap } from 'rxjs/operators';
|
||||
import { Subject } from 'rxjs';
|
||||
import { first, shareReplay, switchMap, takeUntil } from 'rxjs/operators';
|
||||
import { GoodsInListReorderModalComponent } from '../goods-in-list-reorder-modal/goods-in-list-reorder-modal.component';
|
||||
|
||||
interface GoodsInListItemComponentState {
|
||||
@@ -22,7 +23,9 @@ interface GoodsInListItemComponentState {
|
||||
styleUrls: ['goods-in-list-item.component.scss'],
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
})
|
||||
export class GoodsInListItemComponent extends ComponentStore<GoodsInListItemComponentState> {
|
||||
export class GoodsInListItemComponent extends ComponentStore<GoodsInListItemComponentState> implements OnDestroy {
|
||||
@Output() refresh = new EventEmitter<void>();
|
||||
|
||||
@Input()
|
||||
get item() {
|
||||
return this.get((s) => s.item);
|
||||
@@ -89,6 +92,8 @@ export class GoodsInListItemComponent extends ComponentStore<GoodsInListItemComp
|
||||
|
||||
readonly statusCodes$ = this.item$.pipe(switchMap((item) => this._omsService.getStockStatusCodes(item.supplierId)));
|
||||
|
||||
private _onDestroy$ = new Subject();
|
||||
|
||||
constructor(private _omsService: DomainOmsService, private _uiModal: UiModalService) {
|
||||
super({
|
||||
item: undefined,
|
||||
@@ -100,6 +105,11 @@ export class GoodsInListItemComponent extends ComponentStore<GoodsInListItemComp
|
||||
});
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this._onDestroy$.next();
|
||||
this._onDestroy$.complete();
|
||||
}
|
||||
|
||||
async sscChange(value: string) {
|
||||
this.ssc = value;
|
||||
this.sscChanged = true;
|
||||
@@ -122,9 +132,14 @@ export class GoodsInListItemComponent extends ComponentStore<GoodsInListItemComp
|
||||
}
|
||||
|
||||
showReorderModal() {
|
||||
this._uiModal.open({
|
||||
const modal = this._uiModal.open({
|
||||
content: GoodsInListReorderModalComponent,
|
||||
data: this.item,
|
||||
});
|
||||
modal.afterClosed$.pipe(takeUntil(this._onDestroy$)).subscribe((modal) => {
|
||||
if (modal?.data?.refresh) {
|
||||
this.refresh.emit();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ export class GoodsInListReorderModalComponent extends ComponentStore<GoodsInList
|
||||
},
|
||||
})
|
||||
.toPromise();
|
||||
this.modalRef.close();
|
||||
this.modalRef.close({ refresh: true });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,6 +108,6 @@ export class GoodsInListReorderModalComponent extends ComponentStore<GoodsInList
|
||||
processingStatus: 4096,
|
||||
})
|
||||
.toPromise();
|
||||
this.modalRef.close();
|
||||
this.modalRef.close({ refresh: true });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ export class GoodsInListService {
|
||||
|
||||
searchResponse$ = new BehaviorSubject<ListResponseArgsOfOrderItemListItemDTO>(undefined);
|
||||
|
||||
private search$ = new Subject<void>();
|
||||
private search$ = new Subject<boolean>();
|
||||
|
||||
constructor(private domainGoodsInService: DomainGoodsService) {
|
||||
this.initSearch();
|
||||
@@ -21,20 +21,24 @@ export class GoodsInListService {
|
||||
.pipe(
|
||||
tap(() => this.loading$.next(true)),
|
||||
withLatestFrom(this.searchResponse$),
|
||||
switchMap(([_, searchResponse]) =>
|
||||
switchMap(([refresh, searchResponse]) =>
|
||||
this.domainGoodsInService
|
||||
.goodsInList({
|
||||
take: 20,
|
||||
skip: searchResponse?.result?.length || 0,
|
||||
take: refresh ? searchResponse?.result?.length || 20 : 20,
|
||||
skip: refresh ? 0 : searchResponse?.result?.length || 0,
|
||||
})
|
||||
.pipe(
|
||||
map((response) => {
|
||||
return searchResponse?.result
|
||||
? ({
|
||||
...response,
|
||||
result: [...searchResponse.result, ...response.result],
|
||||
} as ListResponseArgsOfOrderItemListItemDTO)
|
||||
: response;
|
||||
if (refresh) {
|
||||
return response;
|
||||
} else {
|
||||
return searchResponse?.result
|
||||
? ({
|
||||
...response,
|
||||
result: [...searchResponse.result, ...response.result],
|
||||
} as ListResponseArgsOfOrderItemListItemDTO)
|
||||
: response;
|
||||
}
|
||||
})
|
||||
)
|
||||
),
|
||||
@@ -45,7 +49,7 @@ export class GoodsInListService {
|
||||
.subscribe(this.searchResponse$);
|
||||
}
|
||||
|
||||
search() {
|
||||
this.search$.next();
|
||||
search(refresh?: boolean) {
|
||||
this.search$.next(!!refresh);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,13 +2,16 @@
|
||||
<div class="list-main">
|
||||
<div class="scroll-container">
|
||||
<ng-container *ngFor="let item of items$ | async; let last = last">
|
||||
<goods-in-list-item-loading *ngIf="loading$ | async"></goods-in-list-item-loading>
|
||||
<goods-in-list-item
|
||||
*ngIf="!(loading$ | async)"
|
||||
uiIsInViewport
|
||||
[options]="viewportEnterOptions"
|
||||
(viewportEntered)="checkIfReload($event)"
|
||||
[class.last]="last"
|
||||
[item]="item"
|
||||
[editSsc]="editSsc"
|
||||
(refresh)="refreshList()"
|
||||
></goods-in-list-item>
|
||||
<hr />
|
||||
</ng-container>
|
||||
|
||||
@@ -2,7 +2,7 @@ import { AfterViewInit, ChangeDetectionStrategy, Component, OnDestroy, OnInit, Q
|
||||
import { BreadcrumbService } from '@core/breadcrumb';
|
||||
import { DomainOmsService } from '@domain/oms';
|
||||
import { combineLatest, Observable, Subject } from 'rxjs';
|
||||
import { first, map, takeUntil } from 'rxjs/operators';
|
||||
import { first, map, shareReplay, takeUntil } from 'rxjs/operators';
|
||||
import { GoodsInListItemComponent } from './goods-in-list-item/goods-in-list-item.component';
|
||||
import { GoodsInListService } from './goods-in-list-service';
|
||||
|
||||
@@ -20,7 +20,7 @@ export class GoodsInListComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||
|
||||
hits$ = this._goodsInListService.searchResponse$.pipe(map((res) => res?.hits || 0));
|
||||
|
||||
loading$ = this._goodsInListService.loading$;
|
||||
loading$ = this._goodsInListService.loading$.pipe(shareReplay());
|
||||
|
||||
editSsc: boolean;
|
||||
|
||||
@@ -102,10 +102,15 @@ export class GoodsInListComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||
});
|
||||
}
|
||||
this.listItems.forEach((listItem) => listItem.sscUpdated());
|
||||
this.refreshList();
|
||||
}
|
||||
|
||||
cancelSsc() {
|
||||
this.editSsc = false;
|
||||
this.listItems.forEach((listItem) => listItem.sscUpdated());
|
||||
}
|
||||
|
||||
refreshList() {
|
||||
this._goodsInListService.search(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,6 +43,9 @@ export class SharedGoodsInOutOrderDetailsComponent extends SharedGoodsInOutOrder
|
||||
@Output()
|
||||
actionHandled = new EventEmitter<OrderItemsContext>();
|
||||
|
||||
@Output()
|
||||
navigateToGoodsInLandingPage = new EventEmitter<void>();
|
||||
|
||||
private _orderDetailsItemComponentsChangeSubscription: Subscription;
|
||||
|
||||
constructor(private commandService: CommandService) {
|
||||
@@ -97,5 +100,9 @@ export class SharedGoodsInOutOrderDetailsComponent extends SharedGoodsInOutOrder
|
||||
|
||||
this.patchState({ fetchPartial: false });
|
||||
this.selectedeOrderItemSubsetIds = [];
|
||||
|
||||
if (action.command.includes('ARRIVED')) {
|
||||
this.navigateToGoodsInLandingPage.emit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user