bug list all fix

This commit is contained in:
Surendiran 2023-09-11 18:44:40 +05:30
parent 9d3a83df3f
commit 9571d4c816
14 changed files with 105 additions and 51 deletions

View File

@ -7,20 +7,17 @@
<mat-form-field appearance="outline" class="card-mat-pane"> <mat-form-field appearance="outline" class="card-mat-pane">
<mat-label>Name</mat-label> <mat-label>Name</mat-label>
<input placeholder="Name" formControlName="name" matInput> <input placeholder="Name" formControlName="name" matInput>
<!-- <mat-error *ngIf="myError('cusName', 'required')">Name is required</mat-error> <mat-error *ngIf="myError('name', 'required')">Name is required</mat-error>
<mat-error *ngIf="myError('cusName', 'maxlength')">Limit exceed</mat-error> -->
</mat-form-field> </mat-form-field>
<mat-form-field appearance="outline" class="card-mat-pane"> <mat-form-field appearance="outline" class="card-mat-pane">
<mat-label>Email</mat-label> <mat-label>Email</mat-label>
<input type="email" placeholder="Email" formControlName="email" matInput > <input type="email" placeholder="Email" formControlName="email" matInput >
<!-- <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 *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
</mat-error> --> </mat-error> -->
</mat-form-field> <mat-error *ngIf="myError('email', 'required')">Email is required</mat-error>
<mat-error *ngIf="myError('email', 'email')">Invalid email format</mat-error>
</mat-form-field>
<mat-form-field appearance="outline" class="card-mat-pane"> <mat-form-field appearance="outline" class="card-mat-pane">
<mat-label>Phone</mat-label> <mat-label>Phone</mat-label>
<input placeholder="Mobile No" type="text" appMobileNumberPattern maxlength="10" minlength="10" matInput formControlName="phoneNo"> <input placeholder="Mobile No" type="text" appMobileNumberPattern maxlength="10" minlength="10" matInput formControlName="phoneNo">
@ -33,7 +30,7 @@
<div class="popup-button"> <div class="popup-button">
<!-- <span class="buttons cancel" (click)="close()">Cancel</span> --> <!-- <span class="buttons cancel" (click)="close()">Cancel</span> -->
<button type="button"class="buttons cancel" (click)="close()" >Cancel</button> <button type="button"class="buttons cancel" (click)="close()" >Cancel</button>
<button type="submit"class="buttons add">Save</button> <button type="submit"class="buttons add" [disabled]="submitDisabled">Save</button>
</div> </div>
</form> </form>
</mat-card> </mat-card>

View File

@ -11,15 +11,19 @@ import { CustomersService } from 'app/appoinment/customers/customers-service/cus
export class AppointmentAddcustomerComponent implements OnInit { export class AppointmentAddcustomerComponent implements OnInit {
form: FormGroup; form: FormGroup;
@Output() childButtonEvent = new EventEmitter(); @Output() childButtonEvent = new EventEmitter();
submitDisabled: boolean = true;
constructor(public _app:AppointmentsService,public _cus:CustomersService) { } constructor(public _app:AppointmentsService,public _cus:CustomersService) { }
ngOnInit(): void { ngOnInit(): void {
this.form = new FormGroup({ this.form = new FormGroup({
name: new FormControl('', [Validators.required]), name: new FormControl('', [Validators.required]),
email: new FormControl('', [Validators.required]), email: new FormControl('', [Validators.required, Validators.email]),
phoneNo: new FormControl('', [Validators.required,Validators.minLength(10),Validators.maxLength(10)]), phoneNo: new FormControl('', [Validators.required, Validators.minLength(10), Validators.maxLength(10)]),
});
this.form.valueChanges.subscribe(() => {
this.submitDisabled = !this.form.valid;
}); });
} }
public myError = (controlName: string, errorName: string) =>{ public myError = (controlName: string, errorName: string) =>{

View File

@ -147,10 +147,13 @@
</mat-form-field> </mat-form-field>
<div style="margin-top: 5px;margin-bottom: 15px;"> <div style="margin-top: 5px;margin-bottom: 15px;">
<div><mat-label>Payment Status</mat-label></div>
<mat-radio-group aria-label="Select an option" formControlName="paymentStatus" required> <mat-radio-group aria-label="Select an option" formControlName="paymentStatus" required>
<mat-radio-button value="0">Paid</mat-radio-button> <mat-radio-button value="0">Paid</mat-radio-button>
<mat-radio-button value="1" style="margin-left: 10px;">Not Paid</mat-radio-button> <mat-radio-button value="1" style="margin-left: 10px;">Not Paid</mat-radio-button>
</mat-radio-group> </mat-radio-group>
<mat-error *ngIf="form.get('paymentStatus').hasError('required')">Payment status is required</mat-error>
<!-- <mat-error *ngIf="paymentStatus.hasError('invalidValue')">Please choose any other</mat-error> -->
</div> </div>
<mat-form-field appearance="outline" class="mat-pane" *ngIf="form.get('paymentStatus').value == 0"> <mat-form-field appearance="outline" class="mat-pane" *ngIf="form.get('paymentStatus').value == 0">
@ -160,7 +163,8 @@
<mat-option value="UPI">UPI</mat-option> <mat-option value="UPI">UPI</mat-option>
<mat-option value="Card">Card</mat-option> <mat-option value="Card">Card</mat-option>
</mat-select> </mat-select>
</mat-form-field> <mat-error *ngIf="form.get('paymentMode').hasError('required')">Payment mode is required</mat-error>
</mat-form-field>
<!-- <div class="notes"> <!-- <div class="notes">
<input type="checkbox" id="scales" name="scales" checked> <input type="checkbox" id="scales" name="scales" checked>
<label for="scales">Send notifications for customer</label> <label for="scales">Send notifications for customer</label>

View File

@ -437,19 +437,20 @@ export class DialogBoxComponent implements OnInit {
// console.log(this.form.value,this.slotsResult,this.days[this.clicks]); // console.log(this.form.value,this.slotsResult,this.days[this.clicks]);
// if(this.slotsResult == undefined){ // if(this.slotsResult == undefined){
// } // }
if(this.form.value.paymentStatus == 0){ if(this.form.value.paymentStatus == 1){
// console.log('paymentmode') console.log('paymentmode')
this.form.controls['paymentMode'].clearValidators(); this.form.controls['paymentMode'].clearValidators();
this.form.controls['paymentMode'].updateValueAndValidity(); this.form.controls['paymentMode'].updateValueAndValidity();
} }
if(this.slotsResult.length == 0){ if(this.slotsResult.length == 0){
// console.log(this.slotsResult.length == 0) console.log(this.slotsResult.length == 0)
this.notifierService.notify('warning', 'Please Select Slots'); this.notifierService.notify('warning', 'Please Select Slots');
this.form.controls['appoinmentSlots'].clearValidators(); this.form.controls['appoinmentSlots'].clearValidators();
this.form.controls['appoinmentSlots'].updateValueAndValidity(); this.form.controls['appoinmentSlots'].updateValueAndValidity();
}else { }else {
if (!this.form.valid) { if (!this.form.valid) {
return; this.notifierService.notify('warning', 'Please Fill all the Fields');
return;
} }
this.isSubmitting = true; this.isSubmitting = true;

View File

@ -51,12 +51,12 @@
id="country" id="country"
formControlName="country" noEntriesFoundLabel="'no matching country found'" #singleSelect> formControlName="country" noEntriesFoundLabel="'no matching country found'" #singleSelect>
<mat-option> <mat-option>
<ngx-mat-select-search [formControl]="countrySearchCtrl" ></ngx-mat-select-search> <ngx-mat-select-search [formControl]="countrySearchCtrl" placeholderLabel="Search Country"></ngx-mat-select-search>
</mat-option> </mat-option>
<mat-option *ngFor="let country of filteredCountries | async" (click)="countryname(country)" [value]="country.name"> {{ country.flag }}&nbsp;&nbsp; {{ country.name }}</mat-option> <mat-option *ngFor="let country of filteredCountries | async" (click)="countryname(country)" [value]="country.name"> {{ country.flag }}&nbsp;&nbsp; {{ country.name }}</mat-option>
<mat-option value="invalid">Invalid option</mat-option> <mat-option value="invalid">Invalid option</mat-option>
</mat-select> </mat-select>
<mat-error *ngIf="myError('country', 'required')">Country is required</mat-error> <mat-error *ngIf="form.get('country').hasError('required')">Country is required</mat-error>
</mat-form-field> </mat-form-field>
<mat-form-field appearance="outline" class="mat-pane" *ngIf="action != 'Delete'; else elseTemplate" > <mat-form-field appearance="outline" class="mat-pane" *ngIf="action != 'Delete'; else elseTemplate" >
@ -64,29 +64,29 @@
<mat-select #state <mat-select #state
name="state" name="state"
id="state" id="state"
formControlName="state" #singleSelect> formControlName="state" #singleSelect required>
<mat-option> <mat-option>
<ngx-mat-select-search [formControl]="stateSearchCtrl" ></ngx-mat-select-search> <ngx-mat-select-search [formControl]="stateSearchCtrl" placeholderLabel="Search State"></ngx-mat-select-search>
</mat-option> </mat-option>
<!-- <mat-option [value]="null">-- Select Your State --</mat-option> --> <!-- <mat-option [value]="null">-- Select Your State --</mat-option> -->
<mat-option *ngFor="let state of filteredStates | async" (click)="statename(state)" [value]="state.name"> {{ state.name }}</mat-option> <mat-option *ngFor="let state of filteredStates | async" (click)="statename(state)" [value]="state.name"> {{ state.name }}</mat-option>
<mat-option value="invalid">Invalid option</mat-option> <mat-option value="invalid">Invalid option</mat-option>
</mat-select> </mat-select>
<mat-error *ngIf="myError('state', 'required')">State is required</mat-error> <mat-error *ngIf="form.get('state').hasError('required')">Country is required</mat-error>
</mat-form-field> </mat-form-field>
<mat-form-field appearance="outline" class="mat-pane" *ngIf="action != 'Delete'; else elseTemplate" > <mat-form-field appearance="outline" class="mat-pane" *ngIf="action != 'Delete'; else elseTemplate" >
<mat-label>City</mat-label> <mat-label>City</mat-label>
<mat-select #city <mat-select #city
name="city" name="city"
id="city" id="city"
formControlName="city" #singleSelect> formControlName="city" #singleSelect required>
<mat-option> <mat-option>
<ngx-mat-select-search [formControl]="citySearchCtrl" ></ngx-mat-select-search> <ngx-mat-select-search [formControl]="citySearchCtrl" placeholderLabel="Search City"></ngx-mat-select-search>
</mat-option> </mat-option>
<mat-option *ngFor="let city of filteredCities | async" (click)="cityname(city)" [value]="city.name"> {{ city.name }}</mat-option> <mat-option *ngFor="let city of filteredCities | async" (click)="cityname(city)" [value]="city.name"> {{ city.name }}</mat-option>
<mat-option value="invalid">Invalid option</mat-option> <mat-option value="invalid">Invalid option</mat-option>
</mat-select> </mat-select>
<mat-error *ngIf="myError('city', 'required')">City is required</mat-error> <mat-error *ngIf="form.get('city').hasError('required')">Country is required</mat-error>
</mat-form-field> </mat-form-field>
<!-- <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">
<mat-label>State</mat-label> <mat-label>State</mat-label>
@ -102,7 +102,7 @@
</mat-form-field> --> </mat-form-field> -->
<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">
<mat-label>Type Of Currency</mat-label> <mat-label>Type Of Currency</mat-label>
<input placeholder="Type Of Currency" matInput [(ngModel)]="local_data.currency" formControlName="currency"> <input placeholder="Type Of Currency" matInput [(ngModel)]="local_data.currency" formControlName="currency" readonly>
<mat-error *ngIf="myError('currency', 'required')">currency is required</mat-error> <mat-error *ngIf="myError('currency', 'required')">currency is required</mat-error>
<!-- <mat-error *ngIf="myError('currency', 'maxlength')">Limit exceed</mat-error> --> <!-- <mat-error *ngIf="myError('currency', 'maxlength')">Limit exceed</mat-error> -->
</mat-form-field> </mat-form-field>

View File

@ -76,6 +76,7 @@ export class AddBusinessComponent implements OnInit {
console.log(this.local_data) console.log(this.local_data)
this.action = this.local_data.action; this.action = this.local_data.action;
this.formData= new FormData(); this.formData= new FormData();
console.log(this.action)
@ -185,16 +186,17 @@ export class AddBusinessComponent implements OnInit {
// } // }
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)]
let userrole = localStorage.getItem('user_role') let userrole = localStorage.getItem('user_role')
this.form = new FormGroup({ this.form = new FormGroup({
admin_checked: new FormControl('',null), admin_checked: new FormControl('',null),
logo: new FormControl('', null), logo: new FormControl('', [Validators.required]),
busName: new FormControl('', [Validators.required]), busName: new FormControl('', [Validators.required]),
address: new FormControl('', [Validators.required, Validators.maxLength(100)]), address: new FormControl('', [Validators.required, Validators.maxLength(100)]),
city: new FormControl('', [Validators.required]), city: new FormControl('', [Validators.required]),
@ -270,13 +272,24 @@ export class AddBusinessComponent implements OnInit {
return this.http.get<any[]>(this.apiUrl + "businessDetailList") return this.http.get<any[]>(this.apiUrl + "businessDetailList")
.pipe( .pipe(
map((response:any) => { map((response:any) => {
let apiList
console.log(response) if(this.action == 'Add'){
let response1 = response.data console.log('add')
apiList = response.data
}else{
console.log('edit',this.local_data.busId)
let listData = response.data
const newArray = listData.filter(item => item.busId !== this.local_data.busId);
console.log(newArray)
apiList = newArray
}
// console.log(response)
let response1 = apiList
let tmp=[]; let tmp=[];
if(response1 instanceof Array){ if(response1 instanceof Array){
response.data.forEach(element => { apiList.forEach(element => {
tmp.push(element.email) tmp.push(element.email)
}); });
console.log(tmp,`${control.value}`); console.log(tmp,`${control.value}`);
@ -293,9 +306,15 @@ export class AddBusinessComponent implements OnInit {
let tmp = this.form.value let tmp = this.form.value
tmp.id = this.local_data.id tmp.id = this.local_data.id
console.log(tmp,this.form) console.log(tmp,this.form)
if(this.action == 'Update'){
this.form.controls['admin_checked'].clearValidators();
this.form.controls['admin_checked'].updateValueAndValidity();
console.log(this.form.value)
}
if (!this.form.valid) { if (!this.form.valid) {
console.log("check") console.log("check")
this.notifierService.notify('warning', 'Please fill all the fields');
return; return;
} }
this.isSubmitting = true this.isSubmitting = true
@ -343,6 +362,10 @@ export class AddBusinessComponent implements OnInit {
this.form.controls['currency'].setValue(country.currency) this.form.controls['currency'].setValue(country.currency)
this.selectedCountry = country; this.selectedCountry = country;
// if(this.action == 'Update'){
this.form.controls['state'].setValue('')
this.form.controls['city'].setValue('')
// }
this.cities = this.selectedState = this.selectedCity = null; this.cities = this.selectedState = this.selectedCity = null;
} }

View File

@ -101,10 +101,13 @@
</mat-expansion-panel> --> </mat-expansion-panel> -->
</mat-accordion> </mat-accordion>
<mat-card-content *ngIf="recordStatus"> <!-- Show "No Data Available" or "No matching data found" text -->
<h5 align="center" style="font-weight: bold; <mat-card-content *ngIf="recordStatus && businessListSource.filteredData.length === 0">
color: brown;">No Data Available</h5> <h5 align="center" style="font-weight: bold; color: brown;">No Data Available</h5>
</mat-card-content> </mat-card-content>
<mat-card-content *ngIf="!recordStatus && businessListSource.filteredData.length === 0">
<h5 align="center" style="font-weight: bold; color: brown;">No matching data found</h5>
</mat-card-content>
</div> </div>
</div> </div>
</div> </div>

View File

@ -54,6 +54,11 @@ export class BusinessListComponent implements OnInit {
filterValue = filterValue.trim(); // Remove whitespace filterValue = filterValue.trim(); // Remove whitespace
filterValue = filterValue.toLowerCase(); // Datasource defaults to lowercase matches filterValue = filterValue.toLowerCase(); // Datasource defaults to lowercase matches
this.businessListSource.filter = filterValue; this.businessListSource.filter = filterValue;
this.checkRecordStatus();
}
checkRecordStatus() {
this.recordStatus = this.businessListSource.filteredData.length === 0;
} }
isactive(value: any) { isactive(value: any) {
@ -127,6 +132,7 @@ export class BusinessListComponent implements OnInit {
} }
console.log(this.businessListSource) console.log(this.businessListSource)
// this.recordStatus=false; // this.recordStatus=false;
this.checkRecordStatus();
} }
else{ else{
this.isLoading = false this.isLoading = false
@ -134,6 +140,7 @@ export class BusinessListComponent implements OnInit {
this.businessList=[]; this.businessList=[];
this.businessListLength= null; this.businessListLength= null;
this.recordStatus=true; this.recordStatus=true;
this.checkRecordStatus();
} }
}, error => this.isLoading = false); }, error => this.isLoading = false);
} }

View File

@ -11,6 +11,7 @@ import { NgScrollbarModule } from 'ngx-scrollbar';
import { AddBusinessComponent } from './add-business/add-business.component'; import { AddBusinessComponent } from './add-business/add-business.component';
import { NotifierModule, NotifierOptions } from 'angular-notifier'; import { NotifierModule, NotifierOptions } from 'angular-notifier';
import { NgxMatSelectSearchModule } from 'ngx-mat-select-search'; import { NgxMatSelectSearchModule } from 'ngx-mat-select-search';
import { ReactiveFormsModule } from '@angular/forms';
const customNotifierOptions: NotifierOptions = { const customNotifierOptions: NotifierOptions = {
@ -61,6 +62,7 @@ const customNotifierOptions: NotifierOptions = {
], ],
imports: [ imports: [
ReactiveFormsModule,
DemoMaterialModule, DemoMaterialModule,
CommonModule, CommonModule,
BusinessRoutingModule, BusinessRoutingModule,

View File

@ -149,10 +149,12 @@
</mat-expansion-panel> --> </mat-expansion-panel> -->
</mat-accordion> </mat-accordion>
<mat-card-content *ngIf="recordStatus"> <mat-card-content *ngIf="recordStatus && usersList.filteredData.length === 0">
<h5 align="center" style="font-weight: bold; <h5 align="center" style="font-weight: bold; color: brown;">No Data Available</h5>
color: brown;">No Data Available</h5> </mat-card-content>
</mat-card-content> <mat-card-content *ngIf="!recordStatus && usersList.filteredData.length === 0">
<h5 align="center" style="font-weight: bold; color: brown;">No matching data found</h5>
</mat-card-content>
</div> </div>
</div> </div>
</div> </div>

View File

@ -97,7 +97,12 @@ export class UserListComponent implements OnInit {
this.usersList.filter = filterValue; this.usersList.filter = filterValue;
console.log(this.usersList) console.log(this.usersList)
} this.checkRecordStatus();
}
checkRecordStatus() {
this.recordStatus = this.usersList.filteredData.length === 0;
}
isactive(value: any) { isactive(value: any) {
console.log(value) console.log(value)

View File

@ -28,7 +28,7 @@
</mat-error> </mat-error>
</mat-form-field> </mat-form-field>
<!-- <button class="mt-2 mb-1" [disabled]="!loginForm.valid" mat-raised-button color="primary" mat-button>Sign In</button> --> <!-- <button class="mt-2 mb-1" [disabled]="!loginForm.valid" mat-raised-button color="primary" mat-button>Sign In</button> -->
<button class="mt-2 mb-1" mat-raised-button color="primary" mat-button>Sign In</button> <button class="mt-2 mb-1" mat-raised-button color="primary" [disabled]="!loginForm.valid || isFormEmpty()" mat-button>Sign In</button>
<a class="mat-text-warn mb-0" (click)="openForgot()">Forgot password?</a> <a class="mat-text-warn mb-0" (click)="openForgot()">Forgot password?</a>
<!-- <p class="mb-0">Don't have an account? <a [routerLink]="['/authentication/register']" class="mat-text-primary">Register Here</a></p> --> <!-- <p class="mb-0">Don't have an account? <a [routerLink]="['/authentication/register']" class="mat-text-primary">Register Here</a></p> -->
</div> </div>

View File

@ -145,6 +145,12 @@ export class LoginComponent {
this.router.navigate(['authentication/forgot-password']) this.router.navigate(['authentication/forgot-password'])
// this.router.navigate(['/home']) // this.router.navigate(['/home'])
} }
isFormEmpty(): boolean {
const email = this.loginForm.get('email').value;
const password = this.loginForm.get('password').value;
return !email && !password;
}
} }

View File

@ -7,8 +7,8 @@ export const environment = {
production: false, production: false,
environmentName: 'Testing Environment',//Localhost Environment. environmentName: 'Testing Environment',//Localhost Environment.
// apiEndpoint:'http://venbainfotech.com:5000/api/', // apiEndpoint:'http://venbainfotech.com:5000/api/',
apiEndpoint:'http://192.168.1.29:8080/api/', // apiEndpoint:'http://192.168.1.29:8080/api/',
// apiEndpoint:'https://dev.venbait.in/appointments/api/', apiEndpoint:'https://dev.venbait.in/appointments/api/',
//EndUser URL //EndUser URL
endUserUrl: window.location.origin+'/#/booking/', endUserUrl: window.location.origin+'/#/booking/',