From cb618c61a63ca156e8b67dd66912bd6709129178 Mon Sep 17 00:00:00 2001 From: bitbucket Date: Tue, 16 May 2023 12:49:15 +0530 Subject: [PATCH] email exit validation added --- .../business/add-business/add-business.component.ts | 10 ++++++++-- .../app/appoinment/user/add-user/add-user.component.ts | 8 +++++++- .../booking-summary/booking-summary.component.ts | 2 ++ 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/ng-seed/src/app/appoinment/business/add-business/add-business.component.ts b/ng-seed/src/app/appoinment/business/add-business/add-business.component.ts index f897d46..c05a766 100644 --- a/ng-seed/src/app/appoinment/business/add-business/add-business.component.ts +++ b/ng-seed/src/app/appoinment/business/add-business/add-business.component.ts @@ -87,6 +87,12 @@ export class AddBusinessComponent implements OnInit { this.dialogRef.close(); } ngOnInit() { + let valData; + if(this.action == 'Add'){ + valData= [this.validateUsernameAvailability.bind(this)] + }else{ + valData = null + } let userrole = localStorage.getItem('user_role') this.form = new FormGroup({ admin_checked: new FormControl('',null), @@ -98,7 +104,7 @@ export class AddBusinessComponent implements OnInit { state: new FormControl('', [Validators.required]), email: new FormControl('', [Validators.required, Validators.email,Validators.pattern( '[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+.[a-zA-Z]{2,63}$', - ),],[this.validateUsernameAvailability.bind(this)]), + ),],valData), contactNo: new FormControl('', [Validators.required, Validators.minLength(10),Validators.maxLength(10)]), createdBy:new FormControl(userrole,[Validators.required]), }); @@ -122,7 +128,7 @@ export class AddBusinessComponent implements OnInit { tmp.push(element.email) }); console.log(tmp,`${control.value}`); - return !tmp.includes(`${control.value}` && this.action == 'add') ? null : { usernameTaken: true }; + return !tmp.includes(`${control.value}`) ? null : { usernameTaken: true }; }) ); } diff --git a/ng-seed/src/app/appoinment/user/add-user/add-user.component.ts b/ng-seed/src/app/appoinment/user/add-user/add-user.component.ts index 5ad0a01..76474e9 100644 --- a/ng-seed/src/app/appoinment/user/add-user/add-user.component.ts +++ b/ng-seed/src/app/appoinment/user/add-user/add-user.component.ts @@ -57,6 +57,12 @@ export class AddUserComponent implements OnInit { ngOnInit() { + let valData; + if(this.action == 'Add'){ + valData= [this.validateUsernameAvailability.bind(this)] + }else{ + valData = null + } this.hide = true; this.disableBus = localStorage.getItem('go_admin') this.userrole = localStorage.getItem('user_role') @@ -69,7 +75,7 @@ export class AddUserComponent implements OnInit { // lastName: new FormControl('', [Validators.required, Validators.maxLength(20)]), email: new FormControl('', [Validators.required, Validators.email,Validators.pattern( '[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+.[a-zA-Z]{2,63}$', - ),],[this.validateUsernameAvailability.bind(this)]), + ),],valData), // password: new FormControl('', [Validators.required, Validators.minLength(6)]), password: new FormControl('', [Validators.required,Validators.pattern( '^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[!@#$%^&*_=+-]).{8,12}$' diff --git a/ng-seed/src/app/end-user/booking-summary/booking-summary.component.ts b/ng-seed/src/app/end-user/booking-summary/booking-summary.component.ts index 851e34f..444440e 100644 --- a/ng-seed/src/app/end-user/booking-summary/booking-summary.component.ts +++ b/ng-seed/src/app/end-user/booking-summary/booking-summary.component.ts @@ -18,6 +18,7 @@ export class BookingSummaryComponent implements OnInit { summary:any= false; busName: any; logo: any; + currency:any =[]; private apiUrl = environment.apiEndpoint; customerBookingDetails: any = []; constructor(public end_user:EndUserService,private router:Router,) { @@ -41,6 +42,7 @@ export class BookingSummaryComponent implements OnInit { } ngOnInit() { + this.currency = localStorage.getItem('currency') this.end_user.summmarylist_observable$.subscribe((res) => { console.log('booked2', res); this.customerBookingDetails = res[0].customer[0]