mirror of
https://dev.azure.com/hugendubel/ISA/_git/ISA-Frontend
synced 2025-12-31 09:37:15 +01:00
#4244 Kundenkarten-Ansicht wirf Fehler
This commit is contained in:
@@ -9,10 +9,13 @@
|
||||
</a>
|
||||
</div>
|
||||
<h1 class="text-center text-2xl font-bold">Kundenkarte</h1>
|
||||
<p class="text-center text-xl">
|
||||
<p class="text-center text-xl" *ngIf="!(noDataFound$ | async)">
|
||||
Alle Infos zu Ihrer Kundenkarte <br />
|
||||
und allen Partnerkarten.
|
||||
</p>
|
||||
<p class="text-center text-xl" *ngIf="noDataFound$ | async">
|
||||
Keine Kundenkarte gefunden.
|
||||
</p>
|
||||
<page-customer-kundenkarte
|
||||
class="justify-self-center"
|
||||
*ngFor="let karte of primaryKundenkarte$ | async"
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
import { Component, ChangeDetectionStrategy, OnInit, OnDestroy } from '@angular/core';
|
||||
import { CustomerSearchStore } from '../store';
|
||||
import { ActivatedRoute, RouterLink } from '@angular/router';
|
||||
import { Subject, combineLatest } from 'rxjs';
|
||||
import { map, share, switchMap } from 'rxjs/operators';
|
||||
import { Subject, combineLatest, of } from 'rxjs';
|
||||
import { catchError, map, share, switchMap } from 'rxjs/operators';
|
||||
import { CrmCustomerService } from '@domain/crm';
|
||||
import { KundenkarteComponent } from '../../components/kundenkarte';
|
||||
import { AsyncPipe, NgFor, NgIf } from '@angular/common';
|
||||
import { IconComponent } from '@shared/components/icon';
|
||||
import { CustomerSearchNavigation } from '../../navigations';
|
||||
import { BonusCardInfoDTO } from '@swagger/crm';
|
||||
|
||||
@Component({
|
||||
selector: 'page-customer-kundenkarte-main-view',
|
||||
@@ -25,11 +26,16 @@ export class KundenkarteMainViewComponent implements OnInit, OnDestroy {
|
||||
|
||||
kundenkarte$ = this.customerId$.pipe(
|
||||
switchMap((customerId) =>
|
||||
this._customerService.getCustomerCard(customerId).pipe(map((response) => response.result?.filter((f) => f.isActive)))
|
||||
this._customerService.getCustomerCard(customerId).pipe(
|
||||
map((response) => response.result?.filter((f) => f.isActive)),
|
||||
catchError(() => of<BonusCardInfoDTO[]>([]))
|
||||
)
|
||||
),
|
||||
share()
|
||||
);
|
||||
|
||||
noDataFound$ = this.kundenkarte$.pipe(map((kundenkarte) => kundenkarte?.length == 0));
|
||||
|
||||
primaryKundenkarte$ = this.kundenkarte$.pipe(map((kundenkarte) => kundenkarte?.filter((k) => k.isPrimary)));
|
||||
|
||||
partnerKundenkarte$ = this.kundenkarte$.pipe(map((kundenkarte) => kundenkarte?.filter((k) => !k.isPrimary)));
|
||||
|
||||
Reference in New Issue
Block a user