Commit 15e12da4 authored by Guillaume Heurtier's avatar Guillaume Heurtier
Browse files

Merge branch 'fix/16956/develop' into 'develop'

FIX #16956 TIME 0:05 phone auto-replacement

See merge request maarch/MaarchCourrier!303
parents 103985f7 294148ec
......@@ -64,7 +64,7 @@
<mat-form-field appearance="fill">
<mat-label>{{'lang.phoneNumber' | translate}}</mat-label>
<input matInput #phoneNumber type="text" [(ngModel)]="userOTP.phone" placeholder="Exemple: +33621235684"
[pattern]="getRegexPhone()" required>
[pattern]="getRegexPhone()" (keyup)="formatPhone()" required>
<mat-hint align="start">{{ 'lang.frFormatPhone' | translate }}</mat-hint>
</mat-form-field>
<mat-form-field appearance="fill">
......
......@@ -158,8 +158,8 @@ export class CreateExternalUserComponent implements OnInit {
}
}
formatPhone(item: any) {
if (item.length > 1 && item[0] === '0') {
formatPhone() {
if (this.userOTP.phone.length > 1 && this.userOTP.phone[0] === '0') {
this.userOTP.phone = this.userOTP.phone.replace('0', '+33');
}
}
......@@ -230,6 +230,7 @@ export class CreateExternalUserComponent implements OnInit {
this.userOTP.lastname = item.lastname;
this.userOTP.email = item.email;
this.userOTP.phone = item.phone;
this.formatPhone();
}
getRegexPhone() {
......
Markdown is supported
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