mirror of
https://dev.azure.com/hugendubel/ISA/_git/ISA-Frontend
synced 2025-12-28 22:42:11 +01:00
#2274 Mobilnummer Validierung
This commit is contained in:
@@ -5,12 +5,14 @@
|
||||
<ng-container *ngIf="notificationsSent?.NOTIFICATION_EMAIL">
|
||||
<img [uiOverlayTrigger]="emailTooltip" src="/assets/images/email_bookmark.svg" />
|
||||
<ui-tooltip yPosition="above" xPosition="after" [yOffset]="-11" [xOffset]="-8" #emailTooltip [closeable]="true">
|
||||
Per E-Mail benachrichtigt <br />
|
||||
{{ notificationsSent?.NOTIFICATION_EMAIL | date: 'dd.MM.yyyy | HH:mm' }} Uhr
|
||||
</ui-tooltip>
|
||||
</ng-container>
|
||||
<ng-container *ngIf="notificationsSent?.NOTIFICATION_SMS">
|
||||
<img [uiOverlayTrigger]="smsTooltip" src="/assets/images/sms_bookmark.svg" />
|
||||
<ui-tooltip yPosition="above" xPosition="after" [yOffset]="-11" [xOffset]="-8" #smsTooltip [closeable]="true">
|
||||
Per SMS benachrichtigt <br />
|
||||
{{ notificationsSent?.NOTIFICATION_SMS | date: 'dd.MM.yyyy | HH:mm' }} Uhr
|
||||
</ui-tooltip>
|
||||
</ng-container>
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
<input type="tel" name="mobile" id="mobile" [formControl]="mobileControl" placeholder="SMS*" />
|
||||
<ng-container *ngIf="mobileControl.touched && mobileControl?.errors; let errors">
|
||||
<span class="error" *ngIf="errors.required">Das Fehld SMS ist ein Pflichtfeld</span>
|
||||
<span class="error" *ngIf="errors.pattern">Keine gültige Mobilnummer</span>
|
||||
</ng-container>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { AbstractControl, ValidatorFn, Validators } from '@angular/forms';
|
||||
import { UiValidators } from '@ui/validators';
|
||||
|
||||
// RFC 5322 Official Standard
|
||||
const emailRegexPattern = /(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])/;
|
||||
@@ -18,7 +19,7 @@ export const mobileNotificationValidator: ValidatorFn = (control: AbstractContro
|
||||
if (control.parent) {
|
||||
const notificationChannel = control.parent.get('selected').value;
|
||||
if (notificationChannel & 2) {
|
||||
return Validators.required(control);
|
||||
return Validators.required(control) ?? UiValidators.phone(control);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user