Skip to content

Commit

Permalink
US standard wise contact validation
Browse files Browse the repository at this point in the history
  • Loading branch information
aniketeknathjadhav committed Feb 11, 2021
1 parent dd78571 commit 8bac783
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 110 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export class Practice {
practiceId: number;
name: string = "";
address: string = "";
contactNumber: number;
contactNumber: string;
description: string = "";
callingPlatform: string;
url: any = "";
Expand Down Expand Up @@ -35,7 +35,7 @@ export class Provider {
email: string = "";
designation: string = "";
medicalDegree: string = "";
mobileNumber: number;
mobileNumber: string;
clinic: string = "";
image: string = "";
roomName: string = "";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,14 @@ <h1>Update Practice Configuration</h1>
<div class="col-12 col-md-6">
<div class="form-group">
<label>Practice Contact No.<span class="red-text">*</span></label>
<input type="text" placeholder="Enter Contact No." class="form-control" name="hospital_contact" formControlName="hospital_contact">
<input type="text" maxlength="14" placeholder="eg:- (999) 999-9999" class="form-control" name="hospital_contact" formControlName="hospital_contact">
<!-- <div *ngIf="practiceConfigForm.controls['hospital_contact'].hasError('pattern')"style="color: red;">Enter 10 digit Contact No.</div> -->
<div *ngIf="practiceFormControls.hospital_contact.touched && practiceFormControls.hospital_contact.invalid" style="color: red;">
<div *ngIf="practiceFormControls.hospital_contact.errors.required">
Practice contact is required.
</div>
<div *ngIf="practiceFormControls.hospital_contact.errors.pattern">
Invalid contact no.
Invalid contact number.
</div>
</div>
</div>
Expand Down Expand Up @@ -223,15 +223,12 @@ <h1>Add Provider</h1>
<div class="col-12 col-md-4">
<div class="form-group">
<label>User Email<span class="red-text">*</span></label>
<input type="text" placeholder="User Email" class="form-control"
name="email" formControlName="email">
<div *ngIf="addProviderFormControls.email.touched && addProviderFormControls.email.invalid"
style="color: red;">
<div *ngIf="addProviderFormControls.email.errors.required">User Email is
required.
<input type="text" placeholder="User Email" class="form-control" name="email" formControlName="email">
<div *ngIf="addProviderFormControls.email.touched && addProviderFormControls.email.invalid" style="color: red;">
<div *ngIf="addProviderFormControls.email.errors.required">User Email is required.
</div>
<div *ngIf="addProviderFormControls.email.errors.pattern">Invalid email address.
</div>
<div *ngIf="addProviderFormControls.email.errors.pattern">Invalid email
address.</div>
</div>
</div>
</div>
Expand All @@ -245,7 +242,7 @@ <h1>Add Provider</h1>
</div>
</div>
</div>
</div>
</div>

<div class="row">
<div class="col-12 col-md-6">
Expand All @@ -254,10 +251,8 @@ <h1>Add Provider</h1>
<div class="col-12 col-md-6 text-right">
<ul>
<li><button type="submit" (click)="resetAddProviderForm()" class="cancelBtn">Reset</button></li>
<li><button type="submit" [disabled]="!addProviderForm.valid"
(click)="addProvider()" class="saveBtn">Save</button></li>&nbsp;&nbsp;
<li><button type="submit" [disabled]="!addProviderForm.valid"
(click)="editProvider()" class="saveBtn">Update</button></li>
<li><button type="submit" [disabled]="!addProviderForm.valid" (click)="addProvider()" class="saveBtn">Save</button></li>&nbsp;&nbsp;
<li><button type="submit" [disabled]="!addProviderForm.valid" (click)="editProvider()" class="saveBtn">Update</button></li>
</ul>
</div>
</div>
Expand Down Expand Up @@ -288,16 +283,14 @@ <h1 style="text-align: left; display: inline;">Providers List</h1>
<td>{{array.password}}</td>
<td>
<a (click)="edit(array)" href="javascript:;">
<svg fill="#000000" xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24" width="28px" height="28px">
<svg fill="#000000" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="28px" height="28px">
<path
d="M14.5 5.5L3 17 3 21 7 21 18.5 9.5zM21.707 4.879l-2.586-2.586c-.391-.391-1.024-.391-1.414 0L16 4l4 4 1.707-1.707C22.098 5.902 22.098 5.269 21.707 4.879z" />
</svg>
</a>
&nbsp;&nbsp;
<a (click)="removeProvider(array.userName)" href="javascript:;">
<svg fill="#000000" xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24" width="28px" height="28px">
<svg fill="#000000" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="28px" height="28px">
<path
d="M 10 2 L 9 3 L 4 3 L 4 5 L 20 5 L 20 3 L 15 3 L 14 2 L 10 2 z M 5 7 L 5 20 C 5 21.1 5.9 22 7 22 L 17 22 C 18.1 22 19 21.1 19 20 L 19 7 L 5 7 z M 8 9 L 10 9 L 10 20 L 8 20 L 8 9 z M 14 9 L 16 9 L 16 20 L 14 20 L 14 9 z" />
</svg>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ export class AdminSettingComponent implements OnInit {
this.practiceConfigForm = this.fb.group({
hospital_name: ['', [Validators.required]],
hospital_email: ['', [Validators.required, Validators.pattern("^[a-z0-9._%+-]+@[a-z0-9.-]+\\.[a-z]{2,4}$")]],
hospital_contact: ['', [Validators.required, Validators.pattern("^\\+?[0-9]{3}[0-9]{0,9}$")]],
hospital_contact: ['', [Validators.required, Validators.pattern("^\\([0-9]{3}\\)\\s[0-9]{3}-[0-9]{4}$")]],
hospital_logo: [''],
hospital_description: new FormControl(" "),
//addContent: new FormControl(" "),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ <h1>Contact US</h1>
<input type="text" class="form-control" placeholder="" formControlName="first_name">
<div *ngIf="contactUsFormControls.first_name.touched && contactUsFormControls.first_name.invalid" style="color: red;">
<small *ngIf="contactUsFormControls.first_name.errors.required">First name is required.</small>
</div>
</div>
</div>
</div>
<div class="col-12 col-md-6">
Expand All @@ -352,19 +352,19 @@ <h1>Contact US</h1>
<div *ngIf="contactUsFormControls.email.touched && contactUsFormControls.email.invalid" style="color: red;">
<small *ngIf="contactUsFormControls.email.errors.required">Email name is required.</small>
<small *ngIf="contactUsFormControls.email.errors.pattern">Invalid email Address </small>
</div>
</div>
</div>
</div>
<div class="col-12 col-md-6">
<div class="form-group">
<label>Phone</label>
<input type="text" class="form-control" placeholder="" formControlName="phone_number">
<input maxlength="14" placeholder="eg:- (999) 999-9999" type="text" class="form-control" formControlName="phone_number">
<!-- <input type="text" class="form-control" placeholder="" formControlName="phone_number" ng2TelInput (ng2TelOutput)="getNumber($event)" (intlTelInputObject)="telInputObject($event)"
(countryChange)="onCountryChange($event)"> -->
<div *ngIf="contactUsFormControls.phone_number.touched && contactUsFormControls.phone_number.invalid" style="color: red;">
<small *ngIf="contactUsFormControls.phone_number.errors.required">Phone number is required.</small>
<!-- <small *ngIf="contactUsFormControls.phone_number.errors.validPhoneNumber">Invalid phone number</small> -->
</div>
<small *ngIf="contactUsFormControls.phone_number.errors.pattern">Invalid contact number</small>
</div>
</div>
</div>
</div>
Expand All @@ -375,9 +375,9 @@ <h1>Contact US</h1>
<textarea name="" id="" class="form-control" rows="2" formControlName="message"></textarea>
<div *ngIf="contactUsFormControls.message.touched && contactUsFormControls.message.invalid" style="color: red;">
<small *ngIf="contactUsFormControls.message.errors.required">Message name is required.</small>
</div>
</div>
</div>

</div>
</div>
<div class="row">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ showViewMoreInfo = false;
first_name: ['', [Validators.required]],
last_name: ['', [Validators.nullValidator]],
email: ['', [Validators.required, Validators.pattern("^[a-z0-9._%+-]+@[a-z0-9.-]+\\.[a-z]{2,4}$")]],
phone_number: ['', [Validators.required]],
phone_number: ['', [Validators.required,Validators.pattern("^\\([0-9]{3}\\)\\s[0-9]{3}-[0-9]{4}$")]],
message: ['', [Validators.required]]
})
}
Expand Down
Loading

0 comments on commit 8bac783

Please sign in to comment.