Edit Business in setting page
This commit is contained in:
parent
fc3c328574
commit
2aa7e53ef6
@ -42,6 +42,14 @@ export class ConsultantService {
|
||||
return this._http.post<any[]>(this.apiUrl + "getPractitionerInfo",param)
|
||||
}
|
||||
|
||||
addFormDetails(addParams:any): Observable<any> {
|
||||
|
||||
return this._http.post(this.apiUrl + 'createBusinessDetails', addParams)
|
||||
// .pipe(
|
||||
// catchError(this.handleError('role', []))
|
||||
// )
|
||||
}
|
||||
|
||||
handleError(arg0: string, arg1: undefined[]): (err: any, caught: Observable<any>) => import("rxjs").ObservableInput<any> {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
|
||||
@ -570,16 +570,148 @@
|
||||
</div>
|
||||
</div>
|
||||
</mat-tab>
|
||||
<!-- <mat-tab *ngIf="userRole == 'BIZADMIN'">
|
||||
<mat-tab *ngIf="userRole == 'BIZADMIN'">
|
||||
<ng-template mat-tab-label>
|
||||
<i class="material-icons icons"></i>Edit Business
|
||||
</ng-template>
|
||||
|
||||
<form [formGroup]="businessDetails" (ngSubmit)="submit()">
|
||||
<div class="staff" >
|
||||
<span class="staff-title">
|
||||
Edit Business
|
||||
</span>
|
||||
<button mat-icon-button matTooltip="Edit" style="padding: 4px 20px;" *ngIf="isEditableBusiness == false" (click)="edit_tableBusiness(isEditableBusiness)" fileName="customers"><mat-icon >edit</mat-icon></button>
|
||||
<!-- <button mat-icon-button *ngIf="table[0].statement == statement_item && table[0].statement != 'Cash Flow Statement'" color="accent" matTooltip="Edit" matTooltipPosition="right" (click)="editandcancel(true,table[0].section)" ><mat-icon>edit</mat-icon></button> -->
|
||||
<button mat-icon-button color="accent" *ngIf="isEditableBusiness == true" (click)="edit_tableBusiness(isEditableBusiness)" matTooltip="Cancel" matTooltipPosition="right" ><mat-icon class="tabIcon2">cancel_presentation</mat-icon></button>
|
||||
<button mat-icon-button color="accent" type="submit" *ngIf="isEditableBusiness == true" matTooltip="Submit" matTooltipPosition="right" ><mat-icon class="tabIcon">done</mat-icon></button>
|
||||
</div>
|
||||
</mat-tab> -->
|
||||
<div mat-dialog-content class="my-table">
|
||||
<ng-scrollbar class="scrollHVBusiness">
|
||||
<div class="form-group label-container">
|
||||
<label *ngIf="isEditableBusiness == false">Business Name</label>
|
||||
<a style="padding: 10px;" *ngIf="isEditableBusiness == false"><span class="line">-</span> {{BusinessDetailsdata.busName}}</a>
|
||||
<mat-form-field class="mat-pane" *ngIf="isEditableBusiness == true">
|
||||
<mat-label>Business Name</mat-label>
|
||||
<input placeholder="Business Name" matInput formControlName="busName">
|
||||
<mat-error *ngIf="myErrorBusiness('busName', 'required')">Name is required</mat-error>
|
||||
<mat-error *ngIf="myErrorBusiness('busName', 'maxlength')">Limit exceed</mat-error>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
|
||||
<div class="form-group label-container">
|
||||
<label *ngIf="isEditableBusiness == false">Email</label>
|
||||
<a style="padding: 10px;" *ngIf="isEditableBusiness == false"><span class="line">-</span> {{BusinessDetailsdata.email}}</a>
|
||||
<mat-form-field class="mat-pane" *ngIf="isEditableBusiness == true">
|
||||
<mat-label>Email</mat-label>
|
||||
<input type="email" placeholder="Email" matInput formControlName="email">
|
||||
<!-- <mat-error *ngIf="!form.get('email')?.errors?.required && (form.get('email')?.errors?.pattern)">
|
||||
Please enter a valid email address
|
||||
</mat-error>
|
||||
<mat-error *ngIf="myErrorBusiness('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 *ngIf="form.get('email').errors?.usernameTaken && form.get('email').dirty">
|
||||
Email already exists...
|
||||
</mat-error> -->
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div class="form-group label-container">
|
||||
<label *ngIf="isEditableBusiness == false">Mobile No</label>
|
||||
<a style="padding: 10px;" *ngIf="isEditableBusiness == false"><span class="line">-</span> {{BusinessDetailsdata.contactNo}}</a>
|
||||
<mat-form-field class="mat-pane" *ngIf="isEditableBusiness == true">
|
||||
<mat-label>Mobile No</mat-label>
|
||||
<input type="text" appMobileNumberPattern maxlength="10" minlength="10" placeholder="Mobile No" matInput formControlName="contactNo">
|
||||
<mat-error *ngIf="myErrorBusiness('contactNo', 'required')">Contact No is required</mat-error>
|
||||
<mat-error *ngIf="myErrorBusiness('contactNo', 'pattern')">Invalid Contact No </mat-error>
|
||||
<mat-error *ngIf="myErrorBusiness('contactNo', 'minlength')"> Contact No must be at least 10 characters</mat-error>
|
||||
<mat-error *ngIf="myErrorBusiness('contactNo', 'maxlength')">Limit exceed</mat-error>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div class="form-group label-container">
|
||||
<label *ngIf="isEditableBusiness == false">Address</label>
|
||||
<a style="padding: 10px;" *ngIf="isEditableBusiness == false"><span class="line">-</span> {{BusinessDetailsdata.address}}</a>
|
||||
<mat-form-field class="mat-pane" *ngIf="isEditableBusiness == true">
|
||||
<mat-label>Address</mat-label>
|
||||
<input placeholder="Address" matInput formControlName="address">
|
||||
<mat-error *ngIf="myErrorBusiness('address', 'required')">Address is required</mat-error>
|
||||
<mat-error *ngIf="myErrorBusiness('address', 'maxlength')">Limit exceed</mat-error>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div class="form-group label-container">
|
||||
<label *ngIf="isEditableBusiness == false">Country</label>
|
||||
<a style="padding: 10px;" *ngIf="isEditableBusiness == false"><span class="line">-</span> {{BusinessDetailsdata.country}}</a>
|
||||
<mat-form-field class="mat-pane" *ngIf="isEditableBusiness == true">
|
||||
<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-error *ngIf="myErrorBusiness('country', 'required')">Country is required</mat-error>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div class="form-group label-container">
|
||||
<label *ngIf="isEditableBusiness == false">State</label>
|
||||
<a style="padding: 10px;" *ngIf="isEditableBusiness == false"><span class="line" >-</span> {{BusinessDetailsdata.state}}</a>
|
||||
<mat-form-field class="mat-pane" *ngIf="isEditableBusiness == true">
|
||||
<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-error *ngIf="myErrorBusiness('state', 'required')">State is required</mat-error>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div class="form-group label-container">
|
||||
<label *ngIf="isEditableBusiness == false">City</label>
|
||||
<a style="padding: 10px;" *ngIf="isEditableBusiness == false"><span class="line">-</span> {{BusinessDetailsdata.city}}</a>
|
||||
<mat-form-field class="mat-pane" *ngIf="isEditableBusiness == true">
|
||||
<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-error *ngIf="myErrorBusiness('city', 'required')">City is required</mat-error>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div class="form-group label-container">
|
||||
<label *ngIf="isEditableBusiness == false">Type Of Currency</label>
|
||||
<a style="padding: 10px;" *ngIf="isEditableBusiness == false"><span class="line">-</span> {{BusinessDetailsdata.currency}}</a>
|
||||
<mat-form-field class="mat-pane" *ngIf="isEditableBusiness == true">
|
||||
<mat-label>Type Of Currency</mat-label>
|
||||
<input placeholder="Type Of Currency" matInput formControlName="currency">
|
||||
<mat-error *ngIf="myErrorBusiness('currency', 'required')">currency is required</mat-error>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div fxLayout="row wrap">
|
||||
<div fxFlex.xs="70" fxFlex.sm="70" fxFlex.md="70" fxFlex.lg="70" fxFlex.xl="70">
|
||||
<img *ngIf="imageViewStatus != true" class="image mb-2" [src]="image_view(BusinessDetailsdata.logo)" height="150" width="150"/>
|
||||
<img *ngIf="imageViewStatus == true" class="image mb-2" [src]="url" height="150" width="150"><br/>
|
||||
<input *ngIf="isEditableBusiness == true" type='file' accept="image/*" data-max-size="2048" style="width: 50%;" (change)="onSelectFile($event)" formControlName="logo"><br>
|
||||
<span *ngIf="imageViewStatus != true && isEditableBusiness == true" class="imgSizeValidation">Upload Below 2MB <br> Supported File (jpg,jpeg and png)</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!--
|
||||
|
||||
<div mat-dialog-actions>
|
||||
<button mat-button type="submit" [disabled]="isSubmitting" class="mat-green" mat-raised-button >
|
||||
<span *ngIf="!isSubmitting">{{action}}</span>
|
||||
<span *ngIf="isSubmitting">Loading...</span>
|
||||
</button>
|
||||
<button mat-button type="button" (click)="close()" >Cancel</button>
|
||||
</div> -->
|
||||
</ng-scrollbar>
|
||||
|
||||
|
||||
</div>
|
||||
</form>
|
||||
</mat-tab>
|
||||
<mat-tab>
|
||||
<ng-template mat-tab-label>
|
||||
<i class="material-icons icons"></i> Appointment Booking Link
|
||||
@ -590,15 +722,15 @@
|
||||
</span>
|
||||
</div>
|
||||
<div class="booking-url">
|
||||
<p class="booking-para">Here's your personal booking page. share this link with customers so they can book your Services directly.</p>
|
||||
<span class="underline-title full-width">Appointment booking URL</span>
|
||||
<p class="booking-para">Here's your personal booking page. Edit and share this link with customers so they can book your Services directly.</p>
|
||||
<span class="underline-title full-width">Appoinment booking domain</span>
|
||||
</div>
|
||||
<div class="boxmiddle fl boxsize mt20">
|
||||
<div class="booking-urls">
|
||||
<div class="url-generate mb20">
|
||||
<div class="url-link dis-flex">
|
||||
<span class="url field-center boxsize">
|
||||
<input type="text" placeholder=" {{endUserURL}}" class="booking-url-input boxsize text-ellipsis cn ember-text-field ember-view" readonly>
|
||||
<input type="text" placeholder=" {{endUserURL}}" class="booking-url-input boxsize text-ellipsis cn ember-text-field ember-view">
|
||||
</span>
|
||||
<!-- <span id="zb-mb-BookingPageUrlCustomize" class="customize-link field-center cp ml10 mt0 mr10" data-ember-action="" data-ember-action-813="813">Customize</span> -->
|
||||
<span class="url-button field-center boxsize pb1" *ngIf="copiedKey == 0"><button (click)="copyToClipBoard(endUserURL)" class="copy-button boxsize cp">Copy</button></span>
|
||||
|
||||
@ -652,4 +652,31 @@ content: "\20B9";
|
||||
}
|
||||
.tabIcon2{
|
||||
color: red;
|
||||
}
|
||||
.scrollHVBusiness{
|
||||
height: calc(100vh - 230px) !important;
|
||||
}
|
||||
|
||||
.imgSizeValidation{
|
||||
color: red;
|
||||
font-family: Didact Gothic, sans serif;
|
||||
}
|
||||
|
||||
.image{
|
||||
border: 7px solid #16c1a636;
|
||||
}
|
||||
|
||||
input[type=file]::file-selector-button {
|
||||
margin-right: 20px;
|
||||
border: none;
|
||||
background: #084cdf;
|
||||
padding: 10px 20px;
|
||||
border-radius: 10px;
|
||||
color: #fff;
|
||||
cursor: pointer;
|
||||
transition: background .2s ease-in-out;
|
||||
}
|
||||
|
||||
input[type=file]::file-selector-button:hover {
|
||||
background: #0d45a5;
|
||||
}
|
||||
@ -1,6 +1,6 @@
|
||||
import { LocationStrategy } from '@angular/common';
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { AbstractControl, FormArray, FormBuilder, FormGroup, Validators } from '@angular/forms';
|
||||
import { Component, ElementRef, OnInit, VERSION, ViewChild } from '@angular/core';
|
||||
import { AbstractControl, FormArray, FormBuilder, FormControl, FormGroup, Validators } from '@angular/forms';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { MatTableDataSource } from '@angular/material/table';
|
||||
import { NotifierService } from 'angular-notifier';
|
||||
@ -13,6 +13,9 @@ import { ExtraWorkingHoursComponent } from '../extra-working-hours/extra-working
|
||||
import { UnavailabilityComponent } from '../unavailability/unavailability.component';
|
||||
import { AddSkillsComponent } from '../add-skills/add-skills.component';
|
||||
import { json } from 'd3';
|
||||
import { City, Country, State } from 'country-state-city';
|
||||
import { map } from 'rxjs/internal/operators/map';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
|
||||
@Component({
|
||||
selector: 'app-consultant-setting',
|
||||
@ -20,8 +23,29 @@ import { json } from 'd3';
|
||||
styleUrls: ['./consultant-setting.component.scss']
|
||||
})
|
||||
export class ConsultantSettingComponent 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;
|
||||
businessDetails: FormGroup;
|
||||
fileToUpload: any;
|
||||
imageUrl: any;
|
||||
action:string;
|
||||
url: string | ArrayBuffer;
|
||||
imageViewStatus: boolean = false;
|
||||
formData: any=[];
|
||||
selectedFiles: any;
|
||||
currentFileUpload: any;
|
||||
countryevent:any=[];
|
||||
assignService:any = []
|
||||
registerForm: FormGroup;
|
||||
registerForm: FormGroup;
|
||||
submitted = false;
|
||||
selected = 'Assign New Services';
|
||||
messages: Object[] = [{
|
||||
@ -34,6 +58,7 @@ export class ConsultantSettingComponent implements OnInit {
|
||||
},
|
||||
];
|
||||
isEditable:any = false;
|
||||
isEditableBusiness :any = false
|
||||
public usersList:any = new MatTableDataSource();
|
||||
public servicesList:any = new MatTableDataSource();
|
||||
practitionerdetails: any=[
|
||||
@ -82,11 +107,13 @@ export class ConsultantSettingComponent implements OnInit {
|
||||
consultants: any = [];
|
||||
frontDeskHidden: any = 0;
|
||||
frontDeskPractdetails: any = [];
|
||||
constructor(private notifierService: NotifierService,private formBuilder: FormBuilder, public dialog: MatDialog, public _con:ConsultantService, private fb: FormBuilder, public _api:ConsultantService,private locationStrategy: LocationStrategy) {
|
||||
|
||||
BusinessDetailsdata: any = [];
|
||||
constructor(private http: HttpClient,private notifierService: NotifierService,private formBuilder: FormBuilder, public dialog: MatDialog, public _con:ConsultantService, private fb: FormBuilder, public _api:ConsultantService,private locationStrategy: LocationStrategy) {
|
||||
this.formData= new FormData();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
ngOnInit() {
|
||||
|
||||
this.userRole = localStorage.getItem('user_role');
|
||||
@ -111,10 +138,41 @@ export class ConsultantSettingComponent implements OnInit {
|
||||
status: ['', Validators.required],
|
||||
information: ['', Validators.required],
|
||||
});
|
||||
|
||||
// let valData;
|
||||
// if(this.action == 'Add'){
|
||||
// valData= [this.validateUsernameAvailability.bind(this)]
|
||||
// }else{
|
||||
// valData = null
|
||||
// }
|
||||
let userrole = localStorage.getItem('user_role')
|
||||
this.businessDetails = new FormGroup({
|
||||
logo: new FormControl('', null),
|
||||
busName: new FormControl('', [Validators.required]),
|
||||
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}$',
|
||||
),]),
|
||||
contactNo: new FormControl('', [Validators.required, Validators.minLength(10),Validators.maxLength(10)]),
|
||||
createdBy:new FormControl(userrole,[Validators.required]),
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public myErrorBusiness = (controlName: string, errorName: string) =>{
|
||||
return this.businessDetails.controls[controlName].hasError(errorName);
|
||||
}
|
||||
|
||||
get f(){
|
||||
return this.businessDetails.controls;
|
||||
}
|
||||
getCosultantList() {
|
||||
let param ={"busId": localStorage.getItem('busId')}
|
||||
console.log(param)
|
||||
@ -181,6 +239,21 @@ edit_table(param){
|
||||
// this.isEditable_month = tableArr.months;
|
||||
}
|
||||
}
|
||||
edit_tableBusiness(param){
|
||||
|
||||
|
||||
|
||||
if (param == true) {
|
||||
this.isEditableBusiness = false;
|
||||
} else {
|
||||
console.log('status', );
|
||||
this.isEditableBusiness = true
|
||||
// localStorage.setItem('row_item',JSON.stringify(tableArr))
|
||||
console.log(this.isEditableBusiness);
|
||||
// this.isEditable = status;
|
||||
// this.isEditable_month = tableArr.months;
|
||||
}
|
||||
}
|
||||
|
||||
workingDialog(action,obj) {
|
||||
obj.action = action;
|
||||
@ -227,13 +300,64 @@ unavailability(action,obj) {
|
||||
this._con.getUsersListDetails(id).subscribe(res => {
|
||||
if (res.status == 200) {
|
||||
this.usersList = res.data[0];
|
||||
|
||||
//Start Edit Business Array
|
||||
this.BusinessDetailsdata = this.usersList['BusinessDetails'][0]
|
||||
console.log(this.BusinessDetailsdata)
|
||||
// this.BusinessDetailsdata.country = JSON.parse(this.BusinessDetailsdata.country)
|
||||
// this.BusinessDetailsdata.state = JSON.parse(this.BusinessDetailsdata.state)
|
||||
// this.BusinessDetailsdata.city = JSON.parse(this.BusinessDetailsdata.city)
|
||||
console.log(this.BusinessDetailsdata)
|
||||
if(this.BusinessDetailsdata.hasOwnProperty('country')){
|
||||
if(this.BusinessDetailsdata.country instanceof Object){
|
||||
this.BusinessDetailsdata.country = this.BusinessDetailsdata.country
|
||||
this.countryevent = this.BusinessDetailsdata.country
|
||||
this.countryname(this.BusinessDetailsdata.country)
|
||||
this.BusinessDetailsdata.country = this.BusinessDetailsdata.country.name
|
||||
}else{
|
||||
this.BusinessDetailsdata.country = JSON.parse(this.BusinessDetailsdata.country)
|
||||
this.countryevent = this.BusinessDetailsdata.country
|
||||
this.countryname(this.BusinessDetailsdata.country)
|
||||
this.BusinessDetailsdata.country = this.BusinessDetailsdata.country.name
|
||||
}
|
||||
}
|
||||
if(this.BusinessDetailsdata.hasOwnProperty('state')){
|
||||
if(this.BusinessDetailsdata.state instanceof Object){
|
||||
this.BusinessDetailsdata.state = this.BusinessDetailsdata.state
|
||||
this.selectedState = this.BusinessDetailsdata.state
|
||||
this.statename(this.BusinessDetailsdata.state)
|
||||
this.BusinessDetailsdata.state = this.BusinessDetailsdata.state.name
|
||||
|
||||
}else{
|
||||
this.BusinessDetailsdata.state = JSON.parse(this.BusinessDetailsdata.state)
|
||||
this.selectedState = this.BusinessDetailsdata.state
|
||||
this.statename(this.BusinessDetailsdata.state)
|
||||
this.BusinessDetailsdata.state = this.BusinessDetailsdata.state.name
|
||||
|
||||
}
|
||||
}
|
||||
if(this.BusinessDetailsdata.hasOwnProperty('city')){
|
||||
if(this.BusinessDetailsdata.city instanceof Object){
|
||||
this.BusinessDetailsdata.city = this.BusinessDetailsdata.city
|
||||
this.selectedCity = this.BusinessDetailsdata.city
|
||||
this.BusinessDetailsdata.city = this.BusinessDetailsdata.city.name
|
||||
}else{
|
||||
this.BusinessDetailsdata.city = JSON.parse(this.BusinessDetailsdata.city)
|
||||
this.selectedCity = this.BusinessDetailsdata.city
|
||||
this.BusinessDetailsdata.city = this.BusinessDetailsdata.city.name
|
||||
}
|
||||
}
|
||||
console.log(this.BusinessDetailsdata)
|
||||
this.businessDetails.patchValue(this.BusinessDetailsdata)
|
||||
setTimeout(() => {
|
||||
this.businessDetails.patchValue(this.BusinessDetailsdata)
|
||||
}, 1500);
|
||||
this.businessDetails.patchValue(this.BusinessDetailsdata)
|
||||
// End Edit Business Array
|
||||
localStorage.setItem('practitioner',JSON.stringify(this.usersList))
|
||||
console.log(this.usersList)
|
||||
if(this.usersList['practitionerInfos'].length==0){
|
||||
this.usersList['practitionerInfos'] =[
|
||||
{
|
||||
|
||||
{
|
||||
"exp":null,
|
||||
"qualification":null,
|
||||
"days": null,
|
||||
@ -359,17 +483,15 @@ unavailability(action,obj) {
|
||||
// this.assignService = this.checkedArray
|
||||
}
|
||||
|
||||
get f() {
|
||||
return this.registerForm.controls;
|
||||
}
|
||||
|
||||
|
||||
onSubmit() {
|
||||
this.submitted = true;
|
||||
if (this.registerForm.invalid) {
|
||||
return;
|
||||
}
|
||||
console.log(JSON.stringify(this.registerForm.value, null, 2));
|
||||
}
|
||||
// onSubmit() {
|
||||
// this.submitted = true;
|
||||
// if (this.registerForm.invalid) {
|
||||
// return;
|
||||
// }
|
||||
// console.log(JSON.stringify(this.registerForm.value, null, 2));
|
||||
// }
|
||||
|
||||
openDialog(action,obj) {
|
||||
console.log(this.working_customize)
|
||||
@ -567,4 +689,154 @@ unavailability(action,obj) {
|
||||
this.copiedKey = 0
|
||||
}, 5000);
|
||||
}
|
||||
|
||||
//Tab Function For Edit Business
|
||||
|
||||
|
||||
validateUsernameAvailability(control: FormControl) {
|
||||
return this.http.get<any[]>(this.apiUrl + "businessDetailList")
|
||||
.pipe(
|
||||
map((response:any) => {
|
||||
|
||||
console.log(response)
|
||||
let response1 = response.data
|
||||
let tmp=[];
|
||||
if(response1 instanceof Array){
|
||||
|
||||
response.data.forEach(element => {
|
||||
tmp.push(element.email)
|
||||
});
|
||||
console.log(tmp,`${control.value}`);
|
||||
return !tmp.includes(`${control.value}`) ? null : { usernameTaken: true };
|
||||
}else{
|
||||
return null
|
||||
}
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
submit(){
|
||||
let tmp = this.businessDetails.value
|
||||
tmp.id = this.BusinessDetailsdata.id
|
||||
console.log(tmp,this.businessDetails)
|
||||
|
||||
if (!this.businessDetails.valid) {
|
||||
console.log("check")
|
||||
return;
|
||||
}
|
||||
// this.isSubmitting = true
|
||||
// this.formData.append('image', this.currentFileUpload);
|
||||
// console.log(this.formData.getAll('image'));
|
||||
|
||||
this.formData.append('id', tmp.id);
|
||||
this.formData.append('busId', this.BusinessDetailsdata.busId);
|
||||
|
||||
|
||||
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('email', tmp.email);
|
||||
this.formData.append('contactNo', tmp.contactNo);
|
||||
this.formData.append('busName', tmp.busName);
|
||||
this.formData.append('address', tmp.address);
|
||||
this.formData.append('currency',tmp.currency)
|
||||
console.log(this.formData)
|
||||
// this.dialogRef.close({event:this.action,data:this.formData,admincheck:tmp.admin_checked});
|
||||
// this.isSubmitting = false
|
||||
// console.log(this.businessDetails.value);
|
||||
// console.log(this.action,this.BusinessDetailsdata)
|
||||
this._con.addFormDetails(this.formData).subscribe(res => {
|
||||
if (res.status == 200) {
|
||||
this.isEditableBusiness = false;
|
||||
this.getUsersList()
|
||||
this.notifierService.notify('success', 'Business Updated Successfully');
|
||||
}
|
||||
else{
|
||||
console.log(res.message)
|
||||
// this.notifierService.notify('success', 'You are awesome! I mean it!');
|
||||
this.notifierService.notify('warning', res.message);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
countryname(country){
|
||||
console.log(country)
|
||||
|
||||
// console.log($event,$event.value)
|
||||
this.countryevent = country
|
||||
this.states = State.getStatesOfCountry(country.isoCode);
|
||||
console.log(country)
|
||||
this.businessDetails.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
|
||||
|
||||
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])
|
||||
let fileType = event.target.files[0]
|
||||
if(fileType.type == 'image/png' || fileType.type == 'image/jpg' || fileType.type == 'image/jpeg'){
|
||||
if(event.target.files[0].size > 2097152){
|
||||
this.notifierService.notify('warning', 'Image size is too Larger');
|
||||
}else {
|
||||
const file = event.target.files[0];
|
||||
if(event != null){
|
||||
this.imageViewStatus = true
|
||||
}
|
||||
this.businessDetails['value'].logo = [event.target.files[0]]
|
||||
if (event.target.files && event.target.files[0]) {
|
||||
var reader = new FileReader();
|
||||
reader.readAsDataURL(event.target.files[0]);
|
||||
reader.onload = (event) => {
|
||||
this.url = event.target.result;
|
||||
console.log(this.url)
|
||||
}
|
||||
}
|
||||
this.formData= new FormData();
|
||||
this.formData.append('image', file, file.name);
|
||||
this.formData.append('logo', '1');
|
||||
console.log(this.currentFileUpload)
|
||||
}
|
||||
} else {
|
||||
this.notifierService.notify('warning', 'Invalid File)');
|
||||
this.notifierService.notify('warning', 'Upload Supported File Like (png,jpg and jpeg)');
|
||||
}
|
||||
|
||||
|
||||
// this.formData.append('file', file, file.name);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -7,8 +7,8 @@ export const environment = {
|
||||
production: false,
|
||||
environmentName: 'Testing Environment',//Localhost Environment.
|
||||
// apiEndpoint:'http://venbainfotech.com:5000/api/',
|
||||
// apiEndpoint:'http://192.168.1.14:8080/api/',
|
||||
apiEndpoint:'https://api.venbait.in/api/',
|
||||
apiEndpoint:'http://192.168.1.23:8080/api/',
|
||||
// apiEndpoint:'https://api.venbait.in/api/',
|
||||
|
||||
//EndUser URL
|
||||
endUserUrl: window.location.origin+'/#/customer/',
|
||||
|
||||
Loading…
Reference in New Issue
Block a user