Merged PR 459: #1356 Gastbesteller können nicht mehr Hinzufügen oder Bearbeiten, Onlinekunde...

#1356 Gastbesteller können nicht mehr Hinzufügen oder Bearbeiten, Onlinekunden können nur noch Hinzufügen
This commit is contained in:
Andreas Schickinger
2021-02-01 14:45:24 +00:00
committed by Lorenz Hilpert
2 changed files with 7 additions and 7 deletions

View File

@@ -55,7 +55,7 @@
<div class="card-section-title">
<h3>Rechnungsadresse</h3>
<a
*ngIf="(isB2b$ | async) === false && (canEdit$ | async) === true"
*ngIf="(isB2b$ | async) === false && (canAdd$ | async) === true"
class="button-add-address"
[routerLink]="['/customer', customerId$ | async, 'payer', 'create', 'b2c']"
>Hinzufügen</a
@@ -90,7 +90,7 @@
<div class="card-section-title">
<h3>Lieferadresse</h3>
<a
*ngIf="(canEdit$ | async) === true"
*ngIf="(canAdd$ | async) === true"
class="button-add-address"
[routerLink]="['/customer', customerId$ | async, 'shipping', 'create', (isB2b$ | async) ? 'b2b' : 'b2c']"
>Hinzufügen</a

View File

@@ -24,8 +24,9 @@ export class CustomerDetailsComponent implements OnInit {
customer$: Observable<CustomerDTO>;
customerFeatures$: Observable<KeyValueDTOOfStringAndString[]>;
customerType$: Observable<'store' | 'b2b' | 'onlineshop' | 'guestaccount'>;
customerType$: Observable<'store' | 'b2b' | 'webshop' | 'guest'>;
canAdd$: Observable<boolean>;
canEdit$: Observable<boolean>;
selectedPayer?: number = undefined;
@@ -89,18 +90,17 @@ export class CustomerDetailsComponent implements OnInit {
);
this.customerFeatures$ = this.customer$.pipe(map((customer: CustomerDTO) => Object.values(customer.features).filter((f) => f.enabled)));
this.hasCustomerCard$ = this.customerFeatures$.pipe(
map((features) => !!features.find((feature) => feature.description === 'Kundenkarte'))
);
this.customerType$ = this.customerFeatures$.pipe(
map((features: KeyValueDTOOfStringAndString[]) => features[0].key as 'store' | 'onlineshop' | 'b2b' | 'guestaccount')
map((features: KeyValueDTOOfStringAndString[]) => features[0].key as 'store' | 'webshop' | 'b2b' | 'guest')
);
this.isB2b$ = this.customerType$.pipe(map((type) => type === 'b2b'));
this.canEdit$ = this.customerType$.pipe(map((type) => type !== 'onlineshop' && type !== 'guestaccount'));
this.canAdd$ = this.customerFeatures$.pipe(map((features) => !features.find((f) => f.key === 'guest')));
this.canEdit$ = this.customerFeatures$.pipe(map((features) => !features.find((f) => f.key === 'guest' || f.key === 'webshop')));
this.createBreadcrumb();
}