email exit validation added

This commit is contained in:
bitbucket 2023-05-16 12:49:15 +05:30
parent 433f7d4cb4
commit cb618c61a6
3 changed files with 17 additions and 3 deletions

View File

@ -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 };
})
);
}

View File

@ -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}$'

View File

@ -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]