#1438 Bugfix Notification Channels communicationDetails Error if Process gets Closed

This commit is contained in:
Nino Righi
2021-03-10 14:39:56 +01:00
parent 9c6b142524
commit 706003cce6
3 changed files with 11 additions and 11 deletions

View File

@@ -6,11 +6,11 @@
<div class="notification-wrapper" *ngIf="!ncs.editMode.value">
<div class="notification" *ngIf="notificationChannel$ | async; let notificationChannel">
<ng-container *ngIf="communicationDetails$ | async; let communicationDetails">
<div *ngIf="communicationDetails.email && notificationChannel !== 0" class="notification">
<div *ngIf="communicationDetails?.email && notificationChannel !== 0" class="notification">
<ui-icon class="icon-notification" icon="check"></ui-icon>
<label class="notification-label">Email</label>
</div>
<div *ngIf="communicationDetails.mobile && notificationChannel !== 0" class="notification">
<div *ngIf="communicationDetails?.mobile && notificationChannel !== 0" class="notification">
<ui-icon class="icon-notification" icon="check"></ui-icon>
<label class="notification-label">SMS</label>
</div>

View File

@@ -33,7 +33,7 @@ export class NotificationChannelsComponent {
communicationDetails$: Observable<CommunicationDetailsDTO> = this.applicationService.activatedProcessId$.pipe(
switchMap((processId) => this.domainCheckoutService.getBuyer({ processId })),
tap((buyer) => (this.ncs.buyer = buyer)),
map((buyer) => buyer.communicationDetails)
map((buyer) => buyer?.communicationDetails)
);
constructor(

View File

@@ -29,14 +29,14 @@ export class NotificationEditComponent implements OnInit, OnDestroy {
this.createForm();
this.checkboxSubscription = this.ncs.checkboxes.subscribe((checkboxes) => {
if (!!checkboxes.email && !this.ncs.hasEmail) {
this.control.get('communicationDetails').get('email').enable();
this.control?.get('communicationDetails')?.get('email')?.enable();
} else {
this.control.get('communicationDetails').get('email').disable();
this.control?.get('communicationDetails')?.get('email')?.disable();
}
if (!!checkboxes.sms && !this.ncs.hasMobile) {
this.control.get('communicationDetails').get('mobile').enable();
this.control?.get('communicationDetails')?.get('mobile')?.enable();
} else {
this.control.get('communicationDetails').get('mobile').disable();
this.control?.get('communicationDetails')?.get('mobile')?.disable();
}
});
}
@@ -55,8 +55,8 @@ export class NotificationEditComponent implements OnInit, OnDestroy {
mobile: fb.control(this.ncs.customer?.communicationDetails?.mobile, [Validators.required]),
}),
});
this.control.get('communicationDetails').get('email').disable();
this.control.get('communicationDetails').get('mobile').disable();
this.control?.get('communicationDetails')?.get('email')?.disable();
this.control?.get('communicationDetails')?.get('mobile')?.disable();
this.cdr.markForCheck();
}
@@ -69,8 +69,8 @@ export class NotificationEditComponent implements OnInit, OnDestroy {
try {
const processId = await this.applicationService.activatedProcessId$.pipe(first()).toPromise();
const email = this.control.value.communicationDetails.email;
const mobile = this.control.value.communicationDetails.mobile;
const email = this.control?.value?.communicationDetails?.email;
const mobile = this.control?.value?.communicationDetails?.mobile;
let emailNotification: NotificationChannel;
let smsNotification: NotificationChannel;
if (!this.ncs.hasEmail && !!email) {