mirror of
https://dev.azure.com/hugendubel/ISA/_git/ISA-Frontend
synced 2025-12-31 09:37:15 +01:00
Compare commits
1 Commits
release/4.
...
fix/4544-H
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
793a345b57 |
@@ -5,7 +5,6 @@ import { CustomerOrderSearchComponent } from './customer-order-search.component'
|
|||||||
import { CustomerOrderSearchFilterComponent, OrderBranchIdInputComponent } from './customer-order-search-filter';
|
import { CustomerOrderSearchFilterComponent, OrderBranchIdInputComponent } from './customer-order-search-filter';
|
||||||
import { RouterModule } from '@angular/router';
|
import { RouterModule } from '@angular/router';
|
||||||
import { UiSpinnerModule } from '@ui/spinner';
|
import { UiSpinnerModule } from '@ui/spinner';
|
||||||
import { CustomerOrderSearchStore } from './customer-order-search.store';
|
|
||||||
import { IconComponent, IconModule } from '@shared/components/icon';
|
import { IconComponent, IconModule } from '@shared/components/icon';
|
||||||
import { FilterModule } from '@shared/components/filter';
|
import { FilterModule } from '@shared/components/filter';
|
||||||
import { CustomerOrderSearchMainModule } from './search-main';
|
import { CustomerOrderSearchMainModule } from './search-main';
|
||||||
@@ -22,7 +21,6 @@ import { CustomerOrderSearchMainModule } from './search-main';
|
|||||||
CustomerOrderSearchMainModule,
|
CustomerOrderSearchMainModule,
|
||||||
],
|
],
|
||||||
exports: [CustomerOrderSearchComponent],
|
exports: [CustomerOrderSearchComponent],
|
||||||
providers: [CustomerOrderSearchStore],
|
|
||||||
declarations: [CustomerOrderSearchComponent, CustomerOrderSearchFilterComponent],
|
declarations: [CustomerOrderSearchComponent, CustomerOrderSearchFilterComponent],
|
||||||
})
|
})
|
||||||
export class CustomerOrderSearchModule {}
|
export class CustomerOrderSearchModule {}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import { Filter } from '@shared/components/filter';
|
|||||||
import { BranchDTO, ListResponseArgsOfOrderItemListItemDTO, OrderItemListItemDTO, QuerySettingsDTO } from '@swagger/oms';
|
import { BranchDTO, ListResponseArgsOfOrderItemListItemDTO, OrderItemListItemDTO, QuerySettingsDTO } from '@swagger/oms';
|
||||||
import { isResponseArgs } from '@utils/object';
|
import { isResponseArgs } from '@utils/object';
|
||||||
import { Observable, Subject } from 'rxjs';
|
import { Observable, Subject } from 'rxjs';
|
||||||
import { switchMap, tap, withLatestFrom } from 'rxjs/operators';
|
import { switchMap, takeUntil, tap, withLatestFrom } from 'rxjs/operators';
|
||||||
|
|
||||||
export interface CustomerOrderSearchState {
|
export interface CustomerOrderSearchState {
|
||||||
defaultSettings?: QuerySettingsDTO;
|
defaultSettings?: QuerySettingsDTO;
|
||||||
@@ -125,6 +125,8 @@ export class CustomerOrderSearchStore extends ComponentStore<CustomerOrderSearch
|
|||||||
|
|
||||||
searchStarted = new Subject<{ clear?: boolean; silentReload?: boolean }>();
|
searchStarted = new Subject<{ clear?: boolean; silentReload?: boolean }>();
|
||||||
|
|
||||||
|
cancelSearch$ = new Subject<void>();
|
||||||
|
|
||||||
constructor(private _domainGoodsInService: DomainCustomerOrderService, private _cache: CacheService) {
|
constructor(private _domainGoodsInService: DomainCustomerOrderService, private _cache: CacheService) {
|
||||||
super({
|
super({
|
||||||
fetching: false,
|
fetching: false,
|
||||||
@@ -192,6 +194,11 @@ export class CustomerOrderSearchStore extends ComponentStore<CustomerOrderSearch
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cancelSearchRequest() {
|
||||||
|
this.cancelSearch$.next();
|
||||||
|
this.patchState({ fetching: false, silentFetching: false });
|
||||||
|
}
|
||||||
|
|
||||||
search = this.effect((options$: Observable<{ clear?: boolean; siletReload?: boolean }>) =>
|
search = this.effect((options$: Observable<{ clear?: boolean; siletReload?: boolean }>) =>
|
||||||
options$.pipe(
|
options$.pipe(
|
||||||
tap((_) => {
|
tap((_) => {
|
||||||
@@ -238,6 +245,7 @@ export class CustomerOrderSearchStore extends ComponentStore<CustomerOrderSearch
|
|||||||
}
|
}
|
||||||
|
|
||||||
return this._domainGoodsInService.search(queryToken).pipe(
|
return this._domainGoodsInService.search(queryToken).pipe(
|
||||||
|
takeUntil(this.cancelSearch$),
|
||||||
tapResponse(
|
tapResponse(
|
||||||
(res) => {
|
(res) => {
|
||||||
let _results: OrderItemListItemDTO[] = [];
|
let _results: OrderItemListItemDTO[] = [];
|
||||||
|
|||||||
@@ -17,10 +17,7 @@ import { ApplicationService } from '@core/application';
|
|||||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||||
})
|
})
|
||||||
export class CustomerOrderSearchMainComponent implements OnInit, OnDestroy {
|
export class CustomerOrderSearchMainComponent implements OnInit, OnDestroy {
|
||||||
filter$ = this._customerOrderSearchStore.filter$.pipe(
|
filter$ = this._customerOrderSearchStore.filter$.pipe(filter((f) => !!f));
|
||||||
filter((f) => !!f),
|
|
||||||
take(1)
|
|
||||||
);
|
|
||||||
|
|
||||||
loading$ = this._customerOrderSearchStore.fetching$;
|
loading$ = this._customerOrderSearchStore.fetching$;
|
||||||
|
|
||||||
|
|||||||
@@ -9,12 +9,14 @@ import { BranchDTO } from '@swagger/checkout';
|
|||||||
import { UiErrorModalComponent, UiModalService } from '@ui/modal';
|
import { UiErrorModalComponent, UiModalService } from '@ui/modal';
|
||||||
import { Observable, Subject, fromEvent } from 'rxjs';
|
import { Observable, Subject, fromEvent } from 'rxjs';
|
||||||
import { first, map, switchMap, takeUntil, withLatestFrom } from 'rxjs/operators';
|
import { first, map, switchMap, takeUntil, withLatestFrom } from 'rxjs/operators';
|
||||||
|
import { CustomerOrderSearchStore } from './customer-order-search';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'page-customer-order',
|
selector: 'page-customer-order',
|
||||||
templateUrl: 'customer-order.component.html',
|
templateUrl: 'customer-order.component.html',
|
||||||
styleUrls: ['customer-order.component.scss'],
|
styleUrls: ['customer-order.component.scss'],
|
||||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||||
|
providers: [CustomerOrderSearchStore],
|
||||||
})
|
})
|
||||||
export class CustomerOrderComponent implements OnInit {
|
export class CustomerOrderComponent implements OnInit {
|
||||||
@ViewChild(BreadcrumbComponent, { read: ElementRef }) breadcrumbRef: ElementRef<HTMLElement>;
|
@ViewChild(BreadcrumbComponent, { read: ElementRef }) breadcrumbRef: ElementRef<HTMLElement>;
|
||||||
@@ -39,13 +41,24 @@ export class CustomerOrderComponent implements OnInit {
|
|||||||
private _uiModal: UiModalService,
|
private _uiModal: UiModalService,
|
||||||
private _renderer: Renderer2,
|
private _renderer: Renderer2,
|
||||||
private _environmentService: EnvironmentService,
|
private _environmentService: EnvironmentService,
|
||||||
public auth: AuthService
|
public auth: AuthService,
|
||||||
|
private _store: CustomerOrderSearchStore
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.selectedBranch$ = this.application.activatedProcessId$.pipe(
|
this.selectedBranch$ = this.application.activatedProcessId$.pipe(
|
||||||
switchMap((processId) => this.application.getSelectedBranch$(Number(processId)))
|
switchMap((processId) => this.application.getSelectedBranch$(Number(processId)))
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/* Ticket #4544 - Suchrequest abbrechen bei Prozesswechsel
|
||||||
|
/ um zu verhindern, dass die Suche in einen anderen Kundenbestellungen Prozess übernommen wird
|
||||||
|
/ bei Prozesswechsel zwischen 2 Kundenbestellungen Prozessen
|
||||||
|
*/
|
||||||
|
this.processId$.pipe(takeUntil(this._onDestroy$)).subscribe((processId) => {
|
||||||
|
if (Number(processId) !== this._store.processId) {
|
||||||
|
this._store.cancelSearchRequest();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
ngAfterViewInit(): void {
|
ngAfterViewInit(): void {
|
||||||
|
|||||||
Reference in New Issue
Block a user