Merged PR 1348: #3267 Checkout Cart Notification Disable Order Button if Checkbox is Active b...

#3267 Checkout Cart Notification Disable Order Button if Checkbox is Active but E-Mail or Mobilenumber is missing
This commit is contained in:
Nino Righi
2022-07-26 11:09:43 +00:00
committed by Lorenz Hilpert
parent 3e534029a0
commit 0e1422c2c4
3 changed files with 17 additions and 2 deletions

View File

@@ -176,7 +176,11 @@
</strong>
<span class="shipping-cost-info">ohne Versandkosten</span>
</div>
<button class="cta-primary" (click)="order()" [disabled]="showOrderButtonSpinner">
<button
class="cta-primary"
(click)="order()"
[disabled]="showOrderButtonSpinner || ((primaryCtaLabel$ | async) === 'Bestellen' && !(checkNotificationChannelControl$ | async))"
>
<ui-spinner [show]="showOrderButtonSpinner">
{{ primaryCtaLabel$ | async }}
</ui-spinner>

View File

@@ -70,7 +70,7 @@ button {
@apply bg-brand text-white font-bold text-lg outline-none border-brand border-solid border-2 rounded-full px-6 py-3;
&:disabled {
@apply bg-inactive-customer border-none;
@apply bg-inactive-customer border-solid border-inactive-customer cursor-not-allowed;
}
}

View File

@@ -37,6 +37,8 @@ export interface CheckoutReviewComponentState {
export class CheckoutReviewComponent extends ComponentStore<CheckoutReviewComponentState> implements OnInit {
private _orderCompleted = new Subject<void>();
checkNotificationChannelControl$ = new BehaviorSubject<boolean>(true);
get shoppingCart() {
return this.get((s) => s.shoppingCart);
}
@@ -336,6 +338,15 @@ export class CheckoutReviewComponent extends ComponentStore<CheckoutReviewCompon
const email = control?.notificationChannel?.email;
const mobile = control?.notificationChannel?.mobile;
// Check if E-Mail and Mobilnumber is available if E-Mail or SMS checkbox is active
if (notificationChannel > 0 && !email) {
this.checkNotificationChannelControl$.next(false);
} else if (notificationChannel >= 2 && !mobile) {
this.checkNotificationChannelControl$.next(false);
} else {
this.checkNotificationChannelControl$.next(true);
}
// NotificationChannel nur speichern, wenn Haken und Value gesetzt
let setNotificationChannel = 0;
if ((notificationChannel & 1) === 1 && email) {