Commit ccd20313 authored by Hamza HRAMCHI's avatar Hamza HRAMCHI
Browse files

FEAT #16956 TIME 0:30 modify regex phone + set roles as radio group

parent 1a75ed7f
......@@ -15,11 +15,11 @@
</mat-form-field>
<mat-form-field appearance="fill">
<mat-label>{{'lang.firstname' | translate}}</mat-label>
<input matInput #firstname type="text" [(ngModel)]="userOTP.firstname" required>
<input matInput #firstname type="text" maxlength="128" [(ngModel)]="userOTP.firstname" required>
</mat-form-field>
<mat-form-field appearance="fill">
<mat-label>{{'lang.lastname' | translate}}</mat-label>
<input matInput #lastname type="text" [(ngModel)]="userOTP.lastname" required>
<input matInput #lastname type="text" maxlength="128" [(ngModel)]="userOTP.lastname" required>
</mat-form-field>
<mat-form-field appearance="fill">
<mat-label>{{'lang.phoneNumber' | translate}}</mat-label>
......@@ -30,14 +30,6 @@
<mat-label>{{'lang.email' | translate}}</mat-label>
<input matInput #email type="email" [(ngModel)]="userOTP.email" pattern="(^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$)" required>
</mat-form-field>
<mat-form-field appearance="fill">
<mat-label>{{'lang.role' | translate}}</mat-label>
<mat-select #role [(ngModel)]="userOTP.role" required>
<mat-option *ngFor="let role of roles" [value]="role.id" >
{{ role.label }}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field *ngIf="currentSource.length > 1" appearance="fill">
<mat-label>{{ 'lang.securityMode' | translate }}</mat-label>
<mat-select #securityMode [(ngModel)]="userOTP.security"required>
......@@ -46,7 +38,15 @@
</mat-option>
</mat-select>
</mat-form-field>
<span class="divider-modal"></span>
<mat-label>{{'lang.role' | translate}}</mat-label>
<mat-form-field>
<input matInput style="display: none;">
<mat-radio-group #role style="display: inline-flex;flex-direction: row;" [(ngModel)]="userOTP.role" required>
<mat-radio-button *ngFor="let role of roles" [value]="role.id" style="margin-left: 10px;">
{{ role.label }}
</mat-radio-button>
</mat-radio-group >
</mat-form-field>
<app-maarch-message *ngIf="userOTP.security" [mode]="'info'" [content]="'lang.securityModeInfo' | translate : {mode: userOTP.security}"></app-maarch-message>
</div>
</div>
......
......@@ -96,7 +96,7 @@ export class CreateUserOtpComponent implements OnInit {
}
validFormat() {
const phoneRegex = /^(\+33)[1-9]{9}$/;
const phoneRegex = /^((\+)33)[1-9](\d{2}){4}$/;
const emailReegex = /^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$/;
return (this.userOTP.phone.length > 1 && this.userOTP.phone.trim().match(phoneRegex) !== null) && (this.userOTP.email.length > 1 && this.userOTP.email.trim().match(emailReegex) !== null);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment