edit profile

This commit is contained in:
Fuzi_fauzia 2024-07-11 09:59:06 +07:00
parent a455f43df6
commit 876f039603
2 changed files with 18 additions and 46 deletions

View File

@ -57,9 +57,9 @@ export class AddEditMasterBuildingComponent {
id: this.dataRow.id, id: this.dataRow.id,
name: [this.dataRow.name, Validators.required], name: [this.dataRow.name, Validators.required],
statusId: [this.dataRow.status_id, Validators.required], statusId: [this.dataRow.status_id, Validators.required],
email: [this.dataRow.email, [Validators.required, Validators.email]], email: [this.dataRow.email, [Validators.required, Validators.pattern(/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/)]],
owner: [this.dataRow.owner, Validators.required], owner: [this.dataRow.owner, Validators.required],
address: [this.dataRow.address, Validators.required], address: [this.dataRow.address, [Validators.required, Validators.pattern(/^[0-9]{10,15}$/)]],
phone: [ phone: [
this.dataRow.phone, this.dataRow.phone,
[Validators.required, Validators.pattern("^[0-9]*$")], [Validators.required, Validators.pattern("^[0-9]*$")],

View File

@ -17,19 +17,11 @@
formControlName="firstName" formControlName="firstName"
maxlength="20" maxlength="20"
placeholder="John Vander" placeholder="John Vander"
[ngClass]="{ [ngClass]="{'is-invalid': profilInfo.get('firstName').invalid && profilInfo.get('firstName').touched}"
'is-invalid': submitted && f.firstName.errors
}"
/> />
<small <div *ngIf="profilInfo.get('firstName').invalid && profilInfo.get('firstName').touched" class="text-danger">
class="form-text text-muted danger" First name is required.
*ngIf="submitted && f.firstName.errors" </div>
class="invalid-feedback"
>
<div *ngIf="f.firstName.errors.required">
Full First Name is required
</div>
</small>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="lastName" style="color: #ffffff">Last Name</label> <label for="lastName" style="color: #ffffff">Last Name</label>
@ -40,19 +32,11 @@
formControlName="lastName" formControlName="lastName"
maxlength="20" maxlength="20"
placeholder="John Vander" placeholder="John Vander"
[ngClass]="{ [ngClass]="{'is-invalid': profilInfo.get('lastName').invalid && profilInfo.get('lastName').touched}"
'is-invalid': submitted && f.lastName.errors
}"
/> />
<small <div *ngIf="profilInfo.get('firstName').invalid && profilInfo.get('firstName').touched" class="text-danger">
class="form-text text-muted danger" Last name is required.
*ngIf="submitted && f.lastName.errors" </div>
class="invalid-feedback"
>
<div *ngIf="f.lastName.errors.required">
Full lastName is required
</div>
</small>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="email" style="color: #ffffff">Email</label> <label for="email" style="color: #ffffff">Email</label>
@ -63,17 +47,11 @@
formControlName="email" formControlName="email"
placeholder="email@email.com" placeholder="email@email.com"
maxlength="50" maxlength="50"
[ngClass]="{ [ngClass]="{'is-invalid': profilInfo.get('email').invalid && profilInfo.get('email').touched}"
'is-invalid': submitted && f.email.errors
}"
/> />
<small <div *ngIf="profilInfo.get('email').invalid && profilInfo.get('email').touched" class="text-danger">
class="form-text text-muted danger" Please enter a valid email.
*ngIf="submitted && f.email.errors" </div>
class="invalid-feedback"
>
<div *ngIf="f.email.errors.required">Email is required</div>
</small>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="phone" style="color: #ffffff">Phone</label> <label for="phone" style="color: #ffffff">Phone</label>
@ -85,17 +63,11 @@
maxlength="13" maxlength="13"
placeholder="08**************" placeholder="08**************"
pattern="^[0-9]*$" pattern="^[0-9]*$"
[ngClass]="{ [ngClass]="{'is-invalid': profilInfo.get('phone').invalid && profilInfo.get('phone').touched}"
'is-invalid': submitted && f.phone.errors
}"
/> />
<small <div *ngIf="profilInfo.get('phone').invalid && profilInfo.get('phone').touched" class="text-danger">
class="form-text text-muted danger" Please enter a valid phone number.
*ngIf="submitted && f.phone.errors" </div>
class="invalid-feedback"
>
<div *ngIf="f.phone.errors.required">Phone is required</div>
</small>
</div> </div>
</div> </div>
<div class="col-md-4 d-flex justify-content-center align-items-center"> <div class="col-md-4 d-flex justify-content-center align-items-center">