feat: add phone number validation to employee create form (#2920)

This commit is contained in:
Shubham Kumar
2025-12-20 13:47:17 -06:00
committed by GitHub
parent 54bd154b60
commit 6dff5d9893
2 changed files with 15 additions and 1 deletions
@@ -61,6 +61,15 @@
<mat-form-field>
<mat-label>{{ 'labels.inputs.Mobile Number for SMS' | translate }}</mat-label>
<input matInput formControlName="mobileNo" />
@if (
employeeForm.controls.mobileNo.hasError('pattern') &&
(employeeForm.controls.mobileNo.dirty || employeeForm.controls.mobileNo.touched)
) {
<mat-error>
{{ 'labels.inputs.Mobile Number for SMS' | translate }} {{ 'labels.commons.is' | translate }}
<strong>{{ 'labels.commons.invalid' | translate }}</strong>
</mat-error>
}
</mat-form-field>
<mat-form-field (click)="joiningDatePicker.open()">
@@ -103,7 +103,12 @@ export class CreateEmployeeComponent implements OnInit, AfterViewInit {
]
],
isLoanOfficer: [false],
mobileNo: [''],
mobileNo: [
'',
[
Validators.pattern(/^\+?[0-9. ()-]{0,25}$/)
]
],
joiningDate: [
'',
Validators.required