#1320 bugfix remove disabled features from customer details view

This commit is contained in:
Nino Righi
2021-01-15 16:55:17 +01:00
parent d3719daa47
commit 82b931e064
2 changed files with 6 additions and 4 deletions

View File

@@ -12,7 +12,7 @@
</div>
<p class="info">Sind Ihre {{ (customerType$ | async) === 'b2b' ? 'Firmendaten' : 'Kundendaten' }} korrekt?</p>
<div class="tags">
<div class="tag" *ngFor="let feature of customer.features">
<div class="tag" *ngFor="let feature of customerFeatures$ | async">
<ui-icon icon="check" size="15px"></ui-icon>
{{ feature.description }}
</div>

View File

@@ -5,9 +5,9 @@ import { Breadcrumb, BreadcrumbService } from '@core/breadcrumb';
import { CartService } from '@domain/cart';
import { CheckoutService } from '@domain/checkout';
import { AddressHelper, AssignedPayerHelper, CrmCustomerService } from '@domain/crm';
import { CustomerDTO } from '@swagger/crm';
import { CustomerDTO, KeyValueDTOOfStringAndString } from '@swagger/crm';
import { ShippingAddressHelper } from 'apps/domain/crm/src/lib/helpers/shipping-address.helper';
import { Observable } from 'rxjs';
import { Observable, of } from 'rxjs';
import { first, map, shareReplay, switchMap, tap } from 'rxjs/operators';
@Component({
@@ -20,6 +20,7 @@ export class CustomerDetailsComponent implements OnInit {
customerId$: Observable<number>;
customer$: Observable<CustomerDTO>;
cartExists: boolean;
customerFeatures$: Observable<KeyValueDTOOfStringAndString[]>;
customerType$: Observable<'store' | 'b2b' | 'onlineshop' | 'guestaccount'>;
@@ -83,8 +84,9 @@ export class CustomerDetailsComponent implements OnInit {
);
this.customerType$ = this.customer$.pipe(
map((customer) => {
map((customer: CustomerDTO) => {
const features = Object.values(customer.features).filter((f) => f.enabled);
this.customerFeatures$ = of(features);
return features[0].key as 'store' | 'onlineshop' | 'b2b' | 'guestaccount';
})
);