Merge branch 'master' of bitbucket.org:venbainformationtechnology/appointments_frontend
This commit is contained in:
commit
d7820a45ad
@ -43,7 +43,45 @@
|
||||
<mat-error *ngIf="myError('address', 'required')">Address is required</mat-error>
|
||||
<mat-error *ngIf="myError('address', 'maxlength')">Limit exceed</mat-error>
|
||||
</mat-form-field>
|
||||
<mat-form-field appearance="outline" *ngIf="action != 'Delete'; else elseTemplate" class="mat-pane">
|
||||
|
||||
<mat-form-field appearance="outline" class="mat-pane">
|
||||
<mat-label>Country</mat-label>
|
||||
<mat-select #country
|
||||
name="country"
|
||||
id="country"
|
||||
formControlName="country">
|
||||
<mat-option [value]="null">Select Country</mat-option>
|
||||
<mat-option *ngFor="let country of countries" (click)="countryname(country)" [value]="country.name"> {{ country.flag }} {{ country.name }}</mat-option>
|
||||
<mat-option value="invalid">Invalid option</mat-option>
|
||||
</mat-select>
|
||||
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="outline" class="mat-pane" *ngIf="action != 'Delete'; else elseTemplate" >
|
||||
<mat-label>State</mat-label>
|
||||
<mat-select #state
|
||||
name="state"
|
||||
id="state"
|
||||
formControlName="state">
|
||||
<mat-option [value]="null">-- Select Your State --</mat-option>
|
||||
<mat-option *ngFor="let state of states" (click)="statename(state)" [value]="state.name"> {{ state.name }}</mat-option>
|
||||
<mat-option value="invalid">Invalid option</mat-option>
|
||||
</mat-select>
|
||||
|
||||
</mat-form-field>
|
||||
<mat-form-field appearance="outline" class="mat-pane" *ngIf="action != 'Delete'; else elseTemplate" >
|
||||
<mat-label>City</mat-label>
|
||||
<mat-select #city
|
||||
name="city"
|
||||
id="city"
|
||||
formControlName="city">
|
||||
<mat-option [value]="null">-- Select Your City --</mat-option>
|
||||
<mat-option *ngFor="let city of cities" (click)="cityname(city)" [value]="city.name"> {{ city.name }}</mat-option>
|
||||
<mat-option value="invalid">Invalid option</mat-option>
|
||||
</mat-select>
|
||||
|
||||
</mat-form-field>
|
||||
<!-- <mat-form-field appearance="outline" *ngIf="action != 'Delete'; else elseTemplate" class="mat-pane">
|
||||
<mat-label>State</mat-label>
|
||||
<input placeholder="State" matInput [(ngModel)]="local_data.state" formControlName="state">
|
||||
<mat-error *ngIf="myError('state', 'required')">State is required</mat-error>
|
||||
@ -54,7 +92,7 @@
|
||||
<input placeholder=" City" matInput [(ngModel)]="local_data.city" formControlName="city">
|
||||
<mat-error *ngIf="myError('city', 'required')">City is required</mat-error>
|
||||
<mat-error *ngIf="myError('city', 'maxlength')">Limit exceed</mat-error>
|
||||
</mat-form-field>
|
||||
</mat-form-field> -->
|
||||
<mat-form-field appearance="outline" *ngIf="action != 'Delete'; else elseTemplate" class="mat-pane">
|
||||
<mat-label>Type Of Currency</mat-label>
|
||||
<input placeholder="Type Of Currency" matInput [(ngModel)]="local_data.currency" formControlName="currency">
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { Component, Inject, OnInit, Optional } from '@angular/core';
|
||||
import { ElementRef, VERSION, ViewChild } from '@angular/core';
|
||||
import { FormBuilder, FormControl, FormGroup, Validators } from '@angular/forms';
|
||||
import { MatCheckboxChange } from '@angular/material/checkbox';
|
||||
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
|
||||
@ -7,6 +8,7 @@ import { Router } from '@angular/router';
|
||||
import { NotifierService } from 'angular-notifier';
|
||||
import { environment } from 'environments/environment';
|
||||
import { map } from 'rxjs/internal/operators/map';
|
||||
import { Country, State, City } from 'country-state-city';
|
||||
export interface UsersData {
|
||||
name: string;
|
||||
id: number;
|
||||
@ -18,7 +20,17 @@ export interface UsersData {
|
||||
styleUrls: ['./add-business.component.scss']
|
||||
})
|
||||
export class AddBusinessComponent implements OnInit {
|
||||
@ViewChild('country') country: ElementRef
|
||||
@ViewChild('city') city: ElementRef
|
||||
@ViewChild('state') state: ElementRef
|
||||
name = 'Angular ' + VERSION.major;
|
||||
countries = Country.getAllCountries();
|
||||
states = null;
|
||||
cities = null;
|
||||
|
||||
selectedCountry;
|
||||
selectedState;
|
||||
selectedCity;
|
||||
form: FormGroup;
|
||||
fileToUpload: any;
|
||||
imageUrl: any;
|
||||
@ -29,6 +41,7 @@ export class AddBusinessComponent implements OnInit {
|
||||
formData: any=[];
|
||||
selectedFiles: any;
|
||||
currentFileUpload: any;
|
||||
countryevent:any=[];
|
||||
private apiUrl = environment.apiEndpoint;
|
||||
constructor(private http: HttpClient,private notifierService: NotifierService,private router: Router,private formBuilder: FormBuilder,
|
||||
public dialogRef: MatDialogRef<AddBusinessComponent>,
|
||||
@ -50,6 +63,46 @@ export class AddBusinessComponent implements OnInit {
|
||||
closeDialog(){
|
||||
this.dialogRef.close({event:'Cancel'});
|
||||
}
|
||||
|
||||
onCountryChange($event): void {
|
||||
console.log($event,$event.value)
|
||||
this.countryevent = $event.value
|
||||
this.states = State.getStatesOfCountry(JSON.parse($event.value).isoCode);
|
||||
console.log(JSON.parse($event.value))
|
||||
this.form.controls['currency'].setValue(JSON.parse($event.value).currency)
|
||||
|
||||
this.selectedCountry = JSON.parse($event.value);
|
||||
this.cities = this.selectedState = this.selectedCity = null;
|
||||
}
|
||||
|
||||
onStateChange($event): void {
|
||||
console.log($event,$event.value)
|
||||
this.cities = City.getCitiesOfState( JSON.parse( this.countryevent).isoCode, JSON.parse($event.value).isoCode)
|
||||
console.log(this.cities)
|
||||
this.selectedState = JSON.parse($event.value);
|
||||
this.selectedCity = null;
|
||||
|
||||
}
|
||||
|
||||
onCityChange($event): void {
|
||||
console.log($event,$event.value)
|
||||
this.selectedCity = JSON.parse($event.value)
|
||||
console.log( this.selectedCity )
|
||||
}
|
||||
|
||||
clear(type: string): void {
|
||||
switch(type) {
|
||||
case 'country':
|
||||
this.selectedCountry = this.country.nativeElement.value = this.states = this.cities = this.selectedState = this.selectedCity = null;
|
||||
break;
|
||||
case 'state':
|
||||
this.selectedState = this.state.nativeElement.value = this.cities = this.selectedCity = null;
|
||||
break;
|
||||
case 'city':
|
||||
this.selectedCity = this.city.nativeElement.value = null;
|
||||
break;
|
||||
}
|
||||
}
|
||||
onSelectFile(event) {
|
||||
console.log(event)
|
||||
console.log(event.target.files[0])
|
||||
@ -87,6 +140,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),
|
||||
@ -95,13 +154,29 @@ export class AddBusinessComponent implements OnInit {
|
||||
address: new FormControl('', [Validators.required, Validators.maxLength(100)]),
|
||||
city: new FormControl('', [Validators.required]),
|
||||
currency: new FormControl('',[Validators.required]),
|
||||
country: new FormControl('',[Validators.required]),
|
||||
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]),
|
||||
});
|
||||
|
||||
this.countryname(JSON.parse(this.local_data.country))
|
||||
this.statename(JSON.parse(this.local_data.state))
|
||||
console.log(this.local_data)
|
||||
this.local_data.country = JSON.parse(this.local_data.country).name
|
||||
this.local_data.state = JSON.parse(this.local_data.state).name
|
||||
this.local_data.city = JSON.parse(this.local_data.city).name
|
||||
console.log(this.local_data)
|
||||
this.form.patchValue(this.local_data)
|
||||
setTimeout(() => {
|
||||
|
||||
|
||||
this.form.patchValue(this.local_data)
|
||||
}, 1500);
|
||||
|
||||
|
||||
this.form.patchValue(this.local_data)
|
||||
}
|
||||
@ -122,7 +197,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 };
|
||||
})
|
||||
);
|
||||
}
|
||||
@ -149,8 +224,9 @@ export class AddBusinessComponent implements OnInit {
|
||||
this.formData.append('contactNo', tmp.contactNo);
|
||||
this.formData.append('busName', tmp.busName);
|
||||
this.formData.append('address', tmp.address);
|
||||
this.formData.append('state', tmp.state);
|
||||
this.formData.append('city', tmp.city);
|
||||
this.formData.append('country', JSON.stringify(this.countryevent) );
|
||||
this.formData.append('state', JSON.stringify(this.selectedState));
|
||||
this.formData.append('city', JSON.stringify(this.selectedCity));
|
||||
this.formData.append('currency',tmp.currency)
|
||||
console.log(this.formData)
|
||||
this.dialogRef.close({event:this.action,data:this.formData,admincheck:tmp.admin_checked});
|
||||
@ -162,5 +238,30 @@ export class AddBusinessComponent implements OnInit {
|
||||
|
||||
return this.apiUrl+'imageViewer?img_name='+image;
|
||||
}
|
||||
countryname(country){
|
||||
console.log(country)
|
||||
|
||||
// console.log($event,$event.value)
|
||||
this.countryevent = country
|
||||
this.states = State.getStatesOfCountry(country.isoCode);
|
||||
console.log(country)
|
||||
this.form.controls['currency'].setValue(country.currency)
|
||||
|
||||
this.selectedCountry = country;
|
||||
this.cities = this.selectedState = this.selectedCity = null;
|
||||
}
|
||||
|
||||
statename(state){
|
||||
// console.log($event,$event.value)
|
||||
this.cities = City.getCitiesOfState( this.countryevent.isoCode, state.isoCode)
|
||||
console.log(this.cities)
|
||||
this.selectedState = state;
|
||||
this.selectedCity = null;
|
||||
}
|
||||
|
||||
cityname(city){
|
||||
// console.log($event,$event.value)
|
||||
this.selectedCity = city
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -45,7 +45,7 @@
|
||||
|
||||
<ng-container matColumnDef="address">
|
||||
<th mat-header-cell *matHeaderCellDef class="font-color"> Address </th>
|
||||
<td mat-cell *matCellDef="let row" class="element-spc"> {{row.address}},{{row.city}} , {{row.state}}</td>
|
||||
<td mat-cell *matCellDef="let row" class="element-spc"> {{row.address}} </td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="action">
|
||||
|
||||
@ -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}$'
|
||||
|
||||
@ -18,6 +18,7 @@ export class BookingSummaryComponent implements OnInit {
|
||||
summary:any= false;
|
||||
busName: any;
|
||||
logo: any;
|
||||
currency:any =[];
|
||||
private apiUrl = environment.apiEndpoint;
|
||||
customerBookingDetails: any = [];
|
||||
busCurrency: any = [];
|
||||
@ -42,6 +43,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]
|
||||
|
||||
Loading…
Reference in New Issue
Block a user