business user and login page issue fix
This commit is contained in:
parent
9571d4c816
commit
2cc34d957b
@ -21,10 +21,10 @@
|
|||||||
<mat-error *ngIf="!form.get('email')?.errors?.required && (form.get('email')?.errors?.pattern)">
|
<mat-error *ngIf="!form.get('email')?.errors?.required && (form.get('email')?.errors?.pattern)">
|
||||||
Please enter a valid email address
|
Please enter a valid email address
|
||||||
</mat-error>
|
</mat-error>
|
||||||
<mat-error *ngIf="myError('email', 'required')">email is required</mat-error>
|
<mat-error *ngIf="myError('email', 'required')">Email is required</mat-error>
|
||||||
<mat-error *ngIf="form.get('email')?.invalid && (form.get('email')?.dirty || form.get('email')?.touched) && form.get('email')?.errors?.required">
|
<!-- <mat-error *ngIf="form.get('email')?.invalid && (form.get('email')?.dirty || form.get('email')?.touched) && form.get('email')?.errors?.required">
|
||||||
Email is required
|
Email is required
|
||||||
</mat-error>
|
</mat-error> -->
|
||||||
<mat-error *ngIf="form.get('email').errors?.usernameTaken && form.get('email').dirty">
|
<mat-error *ngIf="form.get('email').errors?.usernameTaken && form.get('email').dirty">
|
||||||
Email already exists...
|
Email already exists...
|
||||||
</mat-error>
|
</mat-error>
|
||||||
@ -117,6 +117,10 @@
|
|||||||
<img *ngIf="imageViewStatus == true" class="image mb-2" [src]="url" height="150" width="150"><br/>
|
<img *ngIf="imageViewStatus == true" class="image mb-2" [src]="url" height="150" width="150"><br/>
|
||||||
<input type='file'accept="image/*" data-max-size="2048" style="width: 50%;" (change)="onSelectFile($event)" formControlName="logo"><br>
|
<input type='file'accept="image/*" data-max-size="2048" style="width: 50%;" (change)="onSelectFile($event)" formControlName="logo"><br>
|
||||||
<span *ngIf="imageViewStatus != true" class="imgSizeValidation">Upload Below 2MB <br> Supported File (jpg,jpeg and png)</span>
|
<span *ngIf="imageViewStatus != true" class="imgSizeValidation">Upload Below 2MB <br> Supported File (jpg,jpeg and png)</span>
|
||||||
|
<!-- Add mat-error for logo -->
|
||||||
|
<mat-error *ngIf="form.get('logo').hasError('required')">Logo is required</mat-error>
|
||||||
|
<mat-error *ngIf="form.get('logo').hasError('maxSizeExceeded')">File size exceeds 2MB</mat-error>
|
||||||
|
<!-- Add more error conditions if needed -->
|
||||||
</div>
|
</div>
|
||||||
<div fxFlex.xs="30" fxFlex.sm="30" fxFlex.md="30" fxFlex.lg="30" fxFlex.xl="30" fxLayoutAlign="start end">
|
<div fxFlex.xs="30" fxFlex.sm="30" fxFlex.md="30" fxFlex.lg="30" fxFlex.xl="30" fxLayoutAlign="start end">
|
||||||
<mat-checkbox *ngIf="action != 'Update'" class="example-margin mt-2" formControlName="admin_checked" (change)="showOptions($event)">Add Admin</mat-checkbox>
|
<mat-checkbox *ngIf="action != 'Update'" class="example-margin mt-2" formControlName="admin_checked" (change)="showOptions($event)">Add Admin</mat-checkbox>
|
||||||
|
|||||||
@ -81,7 +81,7 @@ input[type=file]::file-selector-button {
|
|||||||
border: 7px solid #16c1a636;
|
border: 7px solid #16c1a636;
|
||||||
}
|
}
|
||||||
.imgSizeValidation{
|
.imgSizeValidation{
|
||||||
color: red;
|
color: blue;
|
||||||
font-family: Didact Gothic, sans serif;
|
font-family: Didact Gothic, sans serif;
|
||||||
}
|
}
|
||||||
.mat-green:disabled {
|
.mat-green:disabled {
|
||||||
|
|||||||
@ -381,6 +381,7 @@ export class AddBusinessComponent implements OnInit {
|
|||||||
});
|
});
|
||||||
this.selectedState = state;
|
this.selectedState = state;
|
||||||
// this.selectedCity = null;
|
// this.selectedCity = null;
|
||||||
|
this.form.controls['city'].setValue('')
|
||||||
}
|
}
|
||||||
|
|
||||||
cityname(city){
|
cityname(city){
|
||||||
|
|||||||
@ -56,9 +56,10 @@
|
|||||||
<mat-error *ngIf="!form.get('email')?.errors?.required && (form.get('email')?.errors?.pattern)">
|
<mat-error *ngIf="!form.get('email')?.errors?.required && (form.get('email')?.errors?.pattern)">
|
||||||
Please enter a valid email address
|
Please enter a valid email address
|
||||||
</mat-error>
|
</mat-error>
|
||||||
<mat-error *ngIf="form.get('email')?.invalid && (form.get('email')?.dirty || form.get('email')?.touched) && form.get('email')?.errors?.required">
|
<mat-error *ngIf="myError('email', 'required')">Email is required</mat-error>
|
||||||
|
<!-- <mat-error *ngIf="form.get('email')?.invalid && (form.get('email')?.dirty || form.get('email')?.touched) && form.get('email')?.errors?.required">
|
||||||
Email is required
|
Email is required
|
||||||
</mat-error>
|
</mat-error> -->
|
||||||
<mat-error *ngIf="form.get('email').errors?.usernameTaken && form.get('email').dirty">
|
<mat-error *ngIf="form.get('email').errors?.usernameTaken && form.get('email').dirty">
|
||||||
Email already exists...
|
Email already exists...
|
||||||
</mat-error>
|
</mat-error>
|
||||||
@ -95,6 +96,10 @@
|
|||||||
<img *ngIf="imageViewStatus == true" class="image mb-2" [src]="url" height="150" width="150"><br/>
|
<img *ngIf="imageViewStatus == true" class="image mb-2" [src]="url" height="150" width="150"><br/>
|
||||||
<input type='file'accept="image/*" data-max-size="2048" style="width: 33%;" (change)="onSelectFile($event)" formControlName="logo"><br>
|
<input type='file'accept="image/*" data-max-size="2048" style="width: 33%;" (change)="onSelectFile($event)" formControlName="logo"><br>
|
||||||
<span *ngIf="imageViewStatus != true" class="imgSizeValidation">Upload Below 2MB <br> Supported File (jpg,jpeg and png)</span>
|
<span *ngIf="imageViewStatus != true" class="imgSizeValidation">Upload Below 2MB <br> Supported File (jpg,jpeg and png)</span>
|
||||||
|
<!-- Add mat-error for logo -->
|
||||||
|
<mat-error *ngIf="form.get('logo').hasError('required')">Logo is required</mat-error>
|
||||||
|
<mat-error *ngIf="form.get('logo').hasError('maxSizeExceeded')">File size exceeds 2MB</mat-error>
|
||||||
|
<!-- Add more error conditions if needed -->
|
||||||
<!-- <mat-form-field appearance="outline" *ngIf="action != 'Delete'; else elseTemplate" class="mat-pane">
|
<!-- <mat-form-field appearance="outline" *ngIf="action != 'Delete'; else elseTemplate" class="mat-pane">
|
||||||
<input placeholder="ConfirmPassword" matInput formControlName="confirmPassword">
|
<input placeholder="ConfirmPassword" matInput formControlName="confirmPassword">
|
||||||
<mat-error *ngIf="myError('confirmPassword', 'required')">confirmPassword is required</mat-error>
|
<mat-error *ngIf="myError('confirmPassword', 'required')">confirmPassword is required</mat-error>
|
||||||
|
|||||||
@ -57,7 +57,7 @@ input[type=file]::file-selector-button {
|
|||||||
border: 7px solid #16c1a636;
|
border: 7px solid #16c1a636;
|
||||||
}
|
}
|
||||||
.imgSizeValidation{
|
.imgSizeValidation{
|
||||||
color: red;
|
color: blue;
|
||||||
font-family: Didact Gothic, sans serif;
|
font-family: Didact Gothic, sans serif;
|
||||||
}
|
}
|
||||||
.user-mate{
|
.user-mate{
|
||||||
|
|||||||
@ -58,12 +58,13 @@ export class AddUserComponent implements OnInit {
|
|||||||
|
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
let valData;
|
// let valData;
|
||||||
if(this.action == 'Add'){
|
// if(this.action == 'Add'){
|
||||||
valData= [this.validateUsernameAvailability.bind(this)]
|
// valData= [this.validateUsernameAvailability.bind(this)]
|
||||||
}else{
|
// }else{
|
||||||
valData = null
|
// valData = null
|
||||||
}
|
// }
|
||||||
|
let valData = [this.validateUsernameAvailability.bind(this)]
|
||||||
this.hide = true;
|
this.hide = true;
|
||||||
this.disableBus = localStorage.getItem('go_admin')
|
this.disableBus = localStorage.getItem('go_admin')
|
||||||
this.userrole = localStorage.getItem('user_role')
|
this.userrole = localStorage.getItem('user_role')
|
||||||
@ -81,7 +82,7 @@ export class AddUserComponent implements OnInit {
|
|||||||
password: new FormControl('', [Validators.required,Validators.pattern(
|
password: new FormControl('', [Validators.required,Validators.pattern(
|
||||||
'^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[!@#$%^&*_=+-]).{8,16}$'
|
'^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[!@#$%^&*_=+-]).{8,16}$'
|
||||||
)]),
|
)]),
|
||||||
logo: new FormControl('', null),
|
logo: new FormControl('', [Validators.required]),
|
||||||
// confirmPassword: new FormControl('', [Validators.required, Validators.minLength(6)]),
|
// confirmPassword: new FormControl('', [Validators.required, Validators.minLength(6)]),
|
||||||
createdBy:new FormControl(this.userrole,null),
|
createdBy:new FormControl(this.userrole,null),
|
||||||
});
|
});
|
||||||
@ -136,13 +137,24 @@ export class AddUserComponent implements OnInit {
|
|||||||
return this.http.post<any[]>(this.apiUrl + "getusers",param)
|
return this.http.post<any[]>(this.apiUrl + "getusers",param)
|
||||||
.pipe(
|
.pipe(
|
||||||
map((response:any) => {
|
map((response:any) => {
|
||||||
|
console.log(response)
|
||||||
|
let apiList
|
||||||
|
if(this.action == 'Add'){
|
||||||
|
console.log('add')
|
||||||
|
apiList = response.data
|
||||||
|
}else{
|
||||||
|
console.log('edit',this.local_data.id)
|
||||||
|
let listData = response.data
|
||||||
|
const newArray = listData.filter(item => item.id !== this.local_data.id);
|
||||||
|
console.log(newArray)
|
||||||
|
apiList = newArray
|
||||||
|
}
|
||||||
|
|
||||||
console.log(response)
|
console.log(response)
|
||||||
let response1 = response.data
|
let response1 = apiList
|
||||||
let tmp=[];
|
let tmp=[];
|
||||||
if(response1 instanceof Array){
|
if(response1 instanceof Array){
|
||||||
|
apiList.forEach(element => {
|
||||||
response.data.forEach(element => {
|
|
||||||
tmp.push(element.email)
|
tmp.push(element.email)
|
||||||
});
|
});
|
||||||
console.log(tmp,`${control.value}`);
|
console.log(tmp,`${control.value}`);
|
||||||
@ -219,6 +231,7 @@ export class AddUserComponent implements OnInit {
|
|||||||
this.form.controls['password'].updateValueAndValidity();
|
this.form.controls['password'].updateValueAndValidity();
|
||||||
}
|
}
|
||||||
if (!this.form.valid) {
|
if (!this.form.valid) {
|
||||||
|
this.notifierService.notify('warning', 'Please fill all the fields');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.isSubmitting = true
|
this.isSubmitting = true
|
||||||
|
|||||||
@ -122,6 +122,8 @@ export class LoginComponent {
|
|||||||
}
|
}
|
||||||
this.router.navigate(['/home'])
|
this.router.navigate(['/home'])
|
||||||
}
|
}
|
||||||
|
}else{
|
||||||
|
this.notifierService.notify('warning', res.message);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user