mirror of
https://dev.azure.com/hugendubel/ISA/_git/ISA-Frontend
synced 2025-12-31 09:37:15 +01:00
Merged PR 1606: #4172 Kundensuche "Keine Suchergebnisse"
#4172 Kundensuche "Keine Suchergebnisse"
This commit is contained in:
committed by
Lorenz Hilpert
parent
dba0b1b3c7
commit
64da928c36
@@ -20,7 +20,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="px-3 bg-surface text-surface-content">
|
||||
<shared-filter [filter]="filter" [loading]="fetching$ | async" (search)="search(filter)"></shared-filter>
|
||||
<shared-filter [filter]="filter" [loading]="fetching$ | async" (search)="search(filter)" [hint]="message$ | async"></shared-filter>
|
||||
</div>
|
||||
|
||||
<div class="grid grid-flow-col gap-6 items-center justify-center mt-6">
|
||||
|
||||
@@ -32,6 +32,8 @@ export class CustomerFilterMainViewComponent {
|
||||
})
|
||||
);
|
||||
|
||||
message$ = this._store.message$;
|
||||
|
||||
constructor(
|
||||
private _store: CustomerSearchStore,
|
||||
private _activatedRoute: ActivatedRoute,
|
||||
|
||||
@@ -14,5 +14,6 @@
|
||||
[inputGroup]="filter?.input | group: 'main'"
|
||||
(search)="search(filter)"
|
||||
[loading]="fetching$ | async"
|
||||
[hint]="message$ | async"
|
||||
></shared-filter-input-group-main>
|
||||
</div>
|
||||
|
||||
@@ -24,6 +24,8 @@ export class MainSideViewComponent {
|
||||
return this._navigation.defaultRoute({ processId: this.processId });
|
||||
}
|
||||
|
||||
message$ = this._store.message$;
|
||||
|
||||
filter$ = this._store.filter$;
|
||||
|
||||
fetching$ = this._store.fetchingCustomerList$;
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
<div class="customer-result-list-header bg-surface-2 text-surface-2-content flex flex-row justify-between pb-4">
|
||||
<div class="grid grid-flow-col gap-3 items-center justify-start grow-0">
|
||||
<shared-filter-input-group-main
|
||||
class="w-[20.892rem]"
|
||||
class="w-[23.5rem]"
|
||||
*ngIf="filter$ | async; let filter"
|
||||
[inputGroup]="filter?.input | group: 'main'"
|
||||
(search)="search(filter)"
|
||||
[hint]="message$ | async"
|
||||
[loading]="fetching$ | async"
|
||||
></shared-filter-input-group-main>
|
||||
<a
|
||||
|
||||
@@ -55,6 +55,8 @@ export class CustomerResultsMainViewComponent implements OnInit, OnDestroy, Afte
|
||||
|
||||
isTablet$ = this._environment.matchTablet$;
|
||||
|
||||
message$ = this._store.message$;
|
||||
|
||||
private _onDestroy$ = new Subject<void>();
|
||||
|
||||
constructor(
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
<div class="customer-result-list-header bg-surface-2 text-surface-2-content flex flex-col justify-between pb-4">
|
||||
<div class="grid grid-flow-col gap-3 items-center justify-start grow-0">
|
||||
<shared-filter-input-group-main
|
||||
class="w-[20.892rem]"
|
||||
class="w-[23.5rem]"
|
||||
*ngIf="filter$ | async; let filter"
|
||||
[inputGroup]="filter?.input | group: 'main'"
|
||||
(search)="search(filter)"
|
||||
[hint]="message$ | async"
|
||||
[loading]="fetching$ | async"
|
||||
></shared-filter-input-group-main>
|
||||
<a
|
||||
|
||||
@@ -43,6 +43,8 @@ export class CustomerResultsSideViewComponent implements OnInit, OnDestroy {
|
||||
|
||||
filter$ = this._store.filter$;
|
||||
|
||||
message$ = this._store.message$;
|
||||
|
||||
fetching$ = this._store.fetchingCustomerList$;
|
||||
|
||||
hits$ = this._store.customerListCount$;
|
||||
|
||||
@@ -13,6 +13,8 @@ export interface CustomerSearchState {
|
||||
customerListCount: number;
|
||||
fetchingCustomerList?: boolean;
|
||||
|
||||
message?: string;
|
||||
|
||||
customerOrders?: OrderListItemDTO[];
|
||||
fetchingCustomerOrders?: boolean;
|
||||
|
||||
|
||||
@@ -3,28 +3,15 @@ import { CustomerSearchState } from './customer-search.state';
|
||||
import * as S from './selectors';
|
||||
import { Injectable, OnDestroy } from '@angular/core';
|
||||
import { Observable, Subject } from 'rxjs';
|
||||
import {
|
||||
distinctUntilChanged,
|
||||
filter,
|
||||
switchMap,
|
||||
takeUntil,
|
||||
tap,
|
||||
withLatestFrom,
|
||||
delayWhen,
|
||||
delay,
|
||||
debounceTime,
|
||||
take,
|
||||
first,
|
||||
map,
|
||||
} from 'rxjs/operators';
|
||||
import { distinctUntilChanged, filter, switchMap, takeUntil, tap, withLatestFrom, delayWhen, first, map } from 'rxjs/operators';
|
||||
import { CrmCustomerService } from '@domain/crm';
|
||||
import { Result } from '@domain/defs';
|
||||
import { CustomerDTO, ListResponseArgsOfCustomerInfoDTO, QuerySettingsDTO } from '@swagger/crm';
|
||||
import { Filter } from '@shared/components/filter';
|
||||
import { isEmpty } from 'lodash';
|
||||
import { DomainOmsService } from '@domain/oms';
|
||||
import { OrderDTO, OrderItemDTO, OrderListItemDTO } from '@swagger/oms';
|
||||
import { hash, log } from '@utils/common';
|
||||
import { OrderDTO, OrderListItemDTO } from '@swagger/oms';
|
||||
import { hash } from '@utils/common';
|
||||
|
||||
@Injectable()
|
||||
export class CustomerSearchStore extends ComponentStore<CustomerSearchState> implements OnStoreInit, OnDestroy {
|
||||
@@ -54,6 +41,12 @@ export class CustomerSearchStore extends ComponentStore<CustomerSearchState> imp
|
||||
|
||||
customer$ = this.select(S.selectCustomer);
|
||||
|
||||
get message() {
|
||||
return this.get(S.selectMessage);
|
||||
}
|
||||
|
||||
message$ = this.select(S.selectMessage);
|
||||
|
||||
get isBestellungOhneKonto() {
|
||||
return this.get(S.selectIsBestellungOhneKonto);
|
||||
}
|
||||
@@ -306,7 +299,7 @@ export class CustomerSearchStore extends ComponentStore<CustomerSearchState> imp
|
||||
),
|
||||
withLatestFrom(this.filter$, this.processId$),
|
||||
map(([a1, a2, a3]) => {
|
||||
this.patchState({ fetchingCustomerList: true, customerList: [], customerListCount: 0 });
|
||||
this.patchState({ fetchingCustomerList: true, customerList: [], customerListCount: 0, message: '' });
|
||||
|
||||
if (a1.ignoreRestore) {
|
||||
this.resetScrollIndex();
|
||||
@@ -333,7 +326,11 @@ export class CustomerSearchStore extends ComponentStore<CustomerSearchState> imp
|
||||
);
|
||||
|
||||
handleSearchResponse = (filter: Filter, processId: number, restored: boolean) => (result: ListResponseArgsOfCustomerInfoDTO) => {
|
||||
this.patchState({ customerList: result.result, customerListCount: result.hits });
|
||||
this.patchState({
|
||||
customerList: result.result,
|
||||
customerListCount: result.hits,
|
||||
message: result?.hits > 0 ? '' : 'Keine Suchergebnisse',
|
||||
});
|
||||
this._customerListResponse.next([result, filter, processId, restored]);
|
||||
this.cacheSearchResult();
|
||||
};
|
||||
|
||||
@@ -15,6 +15,10 @@ export function selectCustomer(s: CustomerSearchState) {
|
||||
return s.customer;
|
||||
}
|
||||
|
||||
export function selectMessage(s: CustomerSearchState) {
|
||||
return s.message;
|
||||
}
|
||||
|
||||
export function selectCustomerId(s: CustomerSearchState) {
|
||||
return +selectCustomer(s)?.id;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user