mirror of
https://dev.azure.com/hugendubel/ISA/_git/ISA-Frontend
synced 2025-12-28 22:42:11 +01:00
Compare commits
1 Commits
4323-WBS-F
...
fix/3265-W
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
41b985c8ee |
@@ -23,9 +23,6 @@ export class CanActivateGoodsOutGuard implements CanActivate {
|
||||
await this._applicationService.getLastActivatedProcessWithSectionAndType$('customer', 'goods-out').pipe(first()).toPromise()
|
||||
)?.id;
|
||||
|
||||
console.log(processesIds);
|
||||
|
||||
// if (!lastActivatedProcessId) {
|
||||
lastActivatedProcessId = Date.now();
|
||||
await this._applicationService.createProcess({
|
||||
id: lastActivatedProcessId,
|
||||
@@ -33,7 +30,6 @@ export class CanActivateGoodsOutGuard implements CanActivate {
|
||||
section: 'customer',
|
||||
name: `Warenausgabe ${Math.max(...processesIds, 0) + 1}`,
|
||||
});
|
||||
// }
|
||||
|
||||
await this._router.navigate(this.getUrlFromSnapshot(route, ['/kunde', String(lastActivatedProcessId)]));
|
||||
return false;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { Component, ChangeDetectionStrategy, Output, EventEmitter, ChangeDetectorRef, OnInit, OnDestroy, Input } from '@angular/core';
|
||||
import { Router } from '@angular/router';
|
||||
import { BreadcrumbService } from '@core/breadcrumb';
|
||||
import { Config } from '@core/config';
|
||||
import { OrderItemListItemDTO } from '@swagger/oms';
|
||||
import { UiFilter } from '@ui/filter';
|
||||
import { Observable, Subject } from 'rxjs';
|
||||
@@ -33,8 +32,7 @@ export class GoodsOutSearchFilterComponent implements OnInit, OnDestroy {
|
||||
private _goodsOutSearchStore: GoodsOutSearchStore,
|
||||
private _breadcrumb: BreadcrumbService,
|
||||
private _cdr: ChangeDetectorRef,
|
||||
private _router: Router,
|
||||
private readonly _config: Config
|
||||
private _router: Router
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
@@ -91,7 +89,7 @@ export class GoodsOutSearchFilterComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
});
|
||||
|
||||
this._goodsOutSearchStore.search({});
|
||||
this._goodsOutSearchStore.search();
|
||||
}
|
||||
|
||||
async updateBreadcrumb() {
|
||||
|
||||
@@ -6,7 +6,7 @@ import { ComponentStore, tapResponse } from '@ngrx/component-store';
|
||||
import { ListResponseArgsOfOrderItemListItemDTO, OrderItemListItemDTO, QuerySettingsDTO } from '@swagger/oms';
|
||||
import { UiFilter } from '@ui/filter';
|
||||
import { isResponseArgs } from '@utils/object';
|
||||
import { Observable, Subject } from 'rxjs';
|
||||
import { Subject } from 'rxjs';
|
||||
import { switchMap, mergeMap, withLatestFrom, filter, take, tap } from 'rxjs/operators';
|
||||
|
||||
export interface GoodsOutSearchState {
|
||||
@@ -143,61 +143,39 @@ export class GoodsOutSearchStore extends ComponentStore<GoodsOutSearchState> {
|
||||
}
|
||||
}
|
||||
|
||||
searchRequest(options?: { take?: number; skip?: number; reload?: boolean }) {
|
||||
searchRequest(options?: { take?: number; skip?: number }) {
|
||||
return this.filter$.pipe(
|
||||
filter((f) => f instanceof UiFilter),
|
||||
take(1),
|
||||
mergeMap((filter) =>
|
||||
this._domainGoodsInService.searchWarenausgabe({
|
||||
...filter.getQueryToken(),
|
||||
skip: options.reload ? 0 : options?.skip ?? this.results.length,
|
||||
take: options.reload ? this.results.length : options?.take ?? 50,
|
||||
skip: options?.skip ?? this.results.length,
|
||||
take: options?.take ?? 50,
|
||||
})
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
search = this.effect((options$: Observable<{ siletReload?: boolean }>) =>
|
||||
options$.pipe(
|
||||
tap((options) => {
|
||||
if (!options?.siletReload) {
|
||||
this.patchState({ fetching: true });
|
||||
}
|
||||
search = this.effect(($) =>
|
||||
$.pipe(
|
||||
tap(() => {
|
||||
this.patchState({ fetching: true });
|
||||
}),
|
||||
withLatestFrom(this.results$),
|
||||
switchMap(([_options, _results]) => {
|
||||
const queryToken = this.filter?.getQueryToken();
|
||||
|
||||
if (queryToken && this._cache.get(queryToken)) {
|
||||
const cached = this._cache.get(queryToken);
|
||||
|
||||
this.patchState(cached);
|
||||
}
|
||||
|
||||
return this.searchRequest({ ...this.searchOptions, reload: _options.siletReload }).pipe(
|
||||
return this.searchRequest({ ...this.searchOptions }).pipe(
|
||||
tapResponse(
|
||||
(res) => {
|
||||
let results: OrderItemListItemDTO[] = [];
|
||||
if (_options.siletReload) {
|
||||
results = res.result;
|
||||
} else {
|
||||
results = [...(_results ?? []), ...(res.result ?? [])];
|
||||
}
|
||||
|
||||
results = [...(_results ?? []), ...(res.result ?? [])];
|
||||
|
||||
this.patchState({
|
||||
hits: res.hits,
|
||||
results,
|
||||
fetching: false,
|
||||
});
|
||||
|
||||
if (queryToken) {
|
||||
this._cache.set(queryToken, {
|
||||
hits: res.hits,
|
||||
results,
|
||||
fetching: false,
|
||||
});
|
||||
}
|
||||
|
||||
this._searchResultSubject.next(res);
|
||||
},
|
||||
(err: Error) => {
|
||||
|
||||
@@ -102,9 +102,7 @@ export class GoodsOutSearchMainComponent implements OnInit, OnDestroy {
|
||||
|
||||
this._cdr.markForCheck();
|
||||
});
|
||||
|
||||
this._goodsOutSearchStore.searchOptions = { take: 50, skip: 0 };
|
||||
this._goodsOutSearchStore.search({});
|
||||
this._goodsOutSearchStore.search();
|
||||
}
|
||||
|
||||
async updateBreadcrumb(processId: number, params: Record<string, string>) {
|
||||
|
||||
@@ -68,8 +68,6 @@ export class GoodsOutSearchResultsComponent extends ComponentStore<GoodsOutSearc
|
||||
|
||||
processId$ = this._activatedRoute.parent.data.pipe(map((data) => +data.processId));
|
||||
|
||||
previousProcessId: undefined | number;
|
||||
|
||||
private _onDestroy$ = new Subject();
|
||||
|
||||
trackByFn = (item: OrderItemListItemDTO) => `${item.orderId}${item.orderItemId}${item.orderItemSubsetId}`;
|
||||
@@ -91,29 +89,26 @@ export class GoodsOutSearchResultsComponent extends ComponentStore<GoodsOutSearc
|
||||
this.processId$
|
||||
.pipe(takeUntil(this._onDestroy$), debounceTime(1), withLatestFrom(this._activatedRoute.queryParams))
|
||||
.subscribe(([processId, params]) => {
|
||||
console.log(params);
|
||||
this._goodsOutSearchStore.setQueryParams(params);
|
||||
this.updateBreadcrumb(processId, params);
|
||||
|
||||
this._goodsOutSearchStore.clearResults();
|
||||
this.initInitialSearch(processId, params);
|
||||
this.createBreadcrumb(processId, params);
|
||||
this.removeBreadcrumbs(processId);
|
||||
|
||||
if (this.previousProcessId && processId !== this.previousProcessId) {
|
||||
this._goodsOutSearchStore.clearResults();
|
||||
this._goodsOutSearchStore.search({ siletReload: true });
|
||||
}
|
||||
|
||||
this.previousProcessId = processId;
|
||||
});
|
||||
|
||||
this._goodsOutSearchStore.searchResultCleared.pipe(takeUntil(this._onDestroy$)).subscribe((_) => this.clearSelectedItems());
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
async ngOnDestroy() {
|
||||
this._onDestroy$.next();
|
||||
this._onDestroy$.complete();
|
||||
|
||||
// this.updateBreadcrumb(this._goodsOutSearchStore.filter?.getQueryParams());
|
||||
const processId = await this.processId$.pipe(first()).toPromise();
|
||||
const queryParams = await this._activatedRoute.queryParams.pipe(first()).toPromise();
|
||||
this.updateBreadcrumb(processId, queryParams);
|
||||
}
|
||||
|
||||
async removeBreadcrumbs(processId: number) {
|
||||
@@ -188,7 +183,7 @@ export class GoodsOutSearchResultsComponent extends ComponentStore<GoodsOutSearc
|
||||
}
|
||||
}
|
||||
});
|
||||
this._goodsOutSearchStore.search({});
|
||||
this._goodsOutSearchStore.search();
|
||||
}
|
||||
|
||||
const { scroll_position, take } = this._goodsOutSearchStore.queryParams;
|
||||
@@ -199,7 +194,7 @@ export class GoodsOutSearchResultsComponent extends ComponentStore<GoodsOutSearc
|
||||
|
||||
async loadMore() {
|
||||
if (this._goodsOutSearchStore.hits > this._goodsOutSearchStore.results.length && !this._goodsOutSearchStore.fetching) {
|
||||
this._goodsOutSearchStore.search({});
|
||||
this._goodsOutSearchStore.search();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user