appointment and advance slot issues fix

This commit is contained in:
Surendiran 2023-05-05 10:20:22 +05:30
parent 281fe2dc92
commit 5ec2234c07
10 changed files with 103 additions and 77 deletions

View File

@ -231,13 +231,13 @@ export class AppoinmentsListComponent implements OnInit {
this.formAddUpdateAndDelete(event,element) this.formAddUpdateAndDelete(event,element)
Swal.fire( Swal.fire(
'Deleted!', 'Deleted!',
'Your imaginary file has been deleted.', 'Your Appointment has been deleted.',
'success' 'success'
) )
} else if (result.dismiss === Swal.DismissReason.cancel) { } else if (result.dismiss === Swal.DismissReason.cancel) {
Swal.fire( Swal.fire(
'Cancelled', 'Cancelled',
'Your imaginary file is safe :)', 'Your Appointment is safe :)',
'error' 'error'
) )
} }

View File

@ -99,7 +99,7 @@ export class DialogBoxComponent implements OnInit {
appoinmentsIds: any=[]; appoinmentsIds: any=[];
customersList: any=[]; customersList: any=[];
customerId: any; customerId: any;
slotsResult: any; slotsResult: any = [];
ServiceId: any; ServiceId: any;
user_role: string; user_role: string;
consultants: any = []; consultants: any = [];
@ -112,18 +112,7 @@ export class DialogBoxComponent implements OnInit {
@Inject(MAT_DIALOG_DATA) public data: UsersData,public _app:AppointmentsService,public end_user:EndUserService) { @Inject(MAT_DIALOG_DATA) public data: UsersData,public _app:AppointmentsService,public end_user:EndUserService) {
console.log(data); console.log(data);
this.local_data = {...data}; this.local_data = {...data};
this.action = this.local_data.action; this.action = this.local_data.action;
let advanceDays = localStorage.getItem('advanced_slot_days')
if(advanceDays == null){
this.advanced_slot_days = 7
}else{
this.advanced_slot_days = parseInt(localStorage.getItem('advanced_slot_days'))-1
console.log(this.advanced_slot_days)
}
} }
get f(){ get f(){
return this.form.controls; return this.form.controls;
@ -158,7 +147,14 @@ export class DialogBoxComponent implements OnInit {
ngOnInit() { ngOnInit() {
let advanceDays = localStorage.getItem('advanced_slot_days')
if(advanceDays == 'null'){
this.advanced_slot_days = 7
console.log(this.advanced_slot_days)
}else{
this.advanced_slot_days = parseInt(localStorage.getItem('advanced_slot_days'))-1
console.log(this.advanced_slot_days)
}
// this._app.customerlist_observable$.subscribe((res) => { // this._app.customerlist_observable$.subscribe((res) => {
// console.log('cus', res); // console.log('cus', res);
@ -171,6 +167,7 @@ export class DialogBoxComponent implements OnInit {
this.user_role = localStorage.getItem('user_role'); this.user_role = localStorage.getItem('user_role');
let tmp=[] let tmp=[]
console.log(this.advanced_slot_days)
for(let i=0;i<=this.advanced_slot_days;i++){ for(let i=0;i<=this.advanced_slot_days;i++){
var someDate = new Date(); var someDate = new Date();
someDate.setDate(someDate.getDate() + i); //number of days to add, e.x. 15 days someDate.setDate(someDate.getDate() + i); //number of days to add, e.x. 15 days
@ -180,8 +177,14 @@ export class DialogBoxComponent implements OnInit {
} }
console.log(tmp) console.log(tmp)
this.days= tmp this.days= tmp
// this.getslotData() console.log(this.days)
this.getSlots() if(this.action == 'Update'){
this.getslotData()
}else{
this.getSlots()
}
if(this.user_role != 'FRONTDESK'){ if(this.user_role != 'FRONTDESK'){
let userId = localStorage.getItem('user_id') let userId = localStorage.getItem('user_id')
let busId = localStorage.getItem('busId') let busId = localStorage.getItem('busId')
@ -195,15 +198,15 @@ export class DialogBoxComponent implements OnInit {
busname: new FormControl('', [Validators.required]), busname: new FormControl('', [Validators.required]),
service: new FormControl('', [Validators.required]), service: new FormControl('', [Validators.required]),
practitioner: new FormControl('', [Validators.required]), practitioner: new FormControl('', [Validators.required]),
appoinmentDate: new FormControl('', [Validators.required]), appoinmentDate: new FormControl('',null),
appoinmentTime: new FormControl('', [Validators.required]), appoinmentTime: new FormControl('',null),
customer: new FormControl('', [Validators.required]), customer: new FormControl('', [Validators.required]),
// note: new FormControl('', [Validators.required]), // note: new FormControl('', [Validators.required]),
status: new FormControl('', null), status: new FormControl('', null),
appoinmentSlots: new FormControl('', [Validators.required]), appoinmentSlots: new FormControl(''),
}); });
console.log(this.local_data, this.selects) console.log(this.local_data, this.selects)
@ -249,44 +252,44 @@ export class DialogBoxComponent implements OnInit {
return this.form.controls[controlName].hasError(errorName); return this.form.controls[controlName].hasError(errorName);
} }
// getslotData(){ getslotData(){
// let findAppointmentDate = this.local_data.appoinmentDate let findAppointmentDate = this.local_data.appoinmentDate
// this.days.forEach(element => { this.days.forEach(element => {
// console.log(element) console.log(element)
// if(element == findAppointmentDate){ if(element == findAppointmentDate){
// this.days.indexOf(element) this.days.indexOf(element)
// console.log(this.days.indexOf(element)) console.log(this.days.indexOf(element))
// this.clicks = this.days.indexOf(element) this.clicks = this.days.indexOf(element)
// } }
// }); });
// let options:any = { weekday: 'long'}; let options:any = { weekday: 'long'};
// var prnDt = new Date(this.days[ this.clicks]).toLocaleTimeString('en-us', options); var prnDt = new Date(this.days[ this.clicks]).toLocaleTimeString('en-us', options);
// var formatDate = prnDt.split(" ") var formatDate = prnDt.split(" ")
// console.log(formatDate) console.log(formatDate)
// this.dayName = formatDate[0] this.dayName = formatDate[0]
// let userId = localStorage.getItem('user_id') let userId = localStorage.getItem('user_id')
// let params ={"id":userId , "day": this.dayName , "addcount": this.clicks} let params ={"id":userId , "day": this.dayName , "addcount": this.clicks}
// this.end_user.getSlots(params).subscribe(res => { this.end_user.getSlots(params).subscribe(res => {
// if (res.status == 200) { if (res.status == 200) {
// console.log(res) console.log(res)
// let data = res['data']; let data = res['data'];
// this.slots = data this.slots = data
// this.slots.forEach(element => { this.slots.forEach(element => {
// console.log(element) console.log(element)
// if(element == this.findSlotIndex[0]){ if(element == this.findSlotIndex[0]){
// this.slots.indexOf(element) this.slots.indexOf(element)
// console.log(this.slots.indexOf(element)) console.log(this.slots.indexOf(element))
// this.slotIndex = this.slots.indexOf(element) this.slotIndex = this.slots.indexOf(element)
// } }
// }); });
// } }
// }) })
// } }
getCosultantList() { getCosultantList() {
let param ={"busId": localStorage.getItem('busId')} let param ={"busId": localStorage.getItem('busId')}
@ -310,12 +313,19 @@ export class DialogBoxComponent implements OnInit {
submit(){ submit(){
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.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();
if (!this.form.valid) { this.form.controls['appoinmentSlots'].updateValueAndValidity();
return; } else {
} if (!this.form.valid) {
return;
}
console.log(this.form.value,this.slotsResult,this.days[this.clicks]); console.log(this.form.value,this.slotsResult,this.days[this.clicks]);
let paramsmap= { let paramsmap= {
@ -332,7 +342,7 @@ export class DialogBoxComponent implements OnInit {
"appoinmentDate": this.days[this.clicks], "appoinmentDate": this.days[this.clicks],
"appoinmentTime": this.form.value.appoinmentTime, "appoinmentTime": this.form.value.appoinmentTime,
"serviceMap":serviceMap, "serviceMap":serviceMap,
"appoinmentSlots": this.slotsResult, "appoinmentSlots": JSON.stringify(this.slotsResult)
//"servicemap" :this.bookedAppointment_servicemap //"servicemap" :this.bookedAppointment_servicemap
} }
if(this.local_data.hasOwnProperty('id')){ if(this.local_data.hasOwnProperty('id')){
@ -358,7 +368,7 @@ export class DialogBoxComponent implements OnInit {
} }
}) })
} }
}) }) }
} }
@ -478,8 +488,11 @@ export class DialogBoxComponent implements OnInit {
const filteredTimes = this.slots.filter(time => new Date(time) >= firstSlt && new Date(time) <= lastSlt); const filteredTimes = this.slots.filter(time => new Date(time) >= firstSlt && new Date(time) <= lastSlt);
console.log(resultArray,filteredTimes); console.log(resultArray,filteredTimes);
let result = filteredTimes.pop(); if(filteredTimes.length > 1){
console.log(result); let result = filteredTimes.pop();
console.log(result);
}
this.slotsResult = filteredTimes this.slotsResult = filteredTimes
// this.show = false; // this.show = false;
// this.slots.forEach(element => { // this.slots.forEach(element => {

View File

@ -249,15 +249,11 @@ unavailability(action,obj) {
let param; let param;
let tmp = [{"sunday":{"hours":[],"breaks":[]}},{"monday":{"hours":[{"startTime":"09:00 am","endTime":"06:00 pm","day":"monday","value":null}],"breaks":[]}},{"tuesday":{"hours":[],"breaks":[]}},{"wednesday":{"hours":[],"breaks":[]}},{"thursday":{"hours":[],"breaks":[]}},{"friday":{"hours":[],"breaks":[]}},{"saturday":{"hours":[],"breaks":[]}}] let tmp = [{"sunday":{"hours":[],"breaks":[]}},{"monday":{"hours":[{"startTime":"09:00 am","endTime":"06:00 pm","day":"monday","value":null}],"breaks":[]}},{"tuesday":{"hours":[],"breaks":[]}},{"wednesday":{"hours":[],"breaks":[]}},{"thursday":{"hours":[],"breaks":[]}},{"friday":{"hours":[],"breaks":[]}},{"saturday":{"hours":[],"breaks":[]}}]
param ={practitionerId: this.usersList.id,workingHours:JSON.stringify(tmp)} param ={practitionerId: this.usersList.id,workingHours:JSON.stringify(tmp),days:7}
this._api.createPractitionerInfo(param).subscribe(res => { this._api.createPractitionerInfo(param).subscribe(res => {
if (res.status == 200) { if (res.status == 200) {
console.log(res) console.log(res)
this.getUsersList()
} }
else{ else{

View File

@ -34,7 +34,7 @@ export class BookingSummaryComponent implements OnInit {
this.end_user.summmarylist_observable$.subscribe((res) => { this.end_user.summmarylist_observable$.subscribe((res) => {
console.log('booked2', res); console.log('booked2', res);
this.bookingSummary = res[0] this.bookingSummary = res[0]
this.bookingSummary.appoinmentSlots =JSON.parse( this.bookingSummary.appoinmentSlots) this.bookingSummary.appoinmentSlots =JSON.parse(this.bookingSummary.appoinmentSlots)
// this.end_user.getcusServicesMapDetails() // this.end_user.getcusServicesMapDetails()
let param ={id:this.bookingSummary.serviceMap} let param ={id:this.bookingSummary.serviceMap}

View File

@ -20,7 +20,9 @@
</mat-form-field> </mat-form-field>
</div> </div>
</div> </div>
<ng-scrollbar class="scrollHV">
<div fxLayout="row wrap mt-2 mb-2" class="flexRow"> <div fxLayout="row wrap mt-2 mb-2" class="flexRow">
<div fxFlex.xs="100" fxFlex.sm="50" fxFlex.md="23.33" fxFlex.lg="23.33" fxFlex.xl="23.33" class="m-gap p-gap" *ngFor="let consultant of consultants | searchFilter:filterdata : 'consultants'"> <div fxFlex.xs="100" fxFlex.sm="50" fxFlex.md="23.33" fxFlex.lg="23.33" fxFlex.xl="23.33" class="m-gap p-gap" *ngFor="let consultant of consultants | searchFilter:filterdata : 'consultants'">
<div class="consultant-list-card card-inner-circle-orange" [style.background]="bgColorPast[1]" (click)="goToSlotBooking(consultant)"> <div class="consultant-list-card card-inner-circle-orange" [style.background]="bgColorPast[1]" (click)="goToSlotBooking(consultant)">
<!-- <div class="consultant-content"> --> <!-- <div class="consultant-content"> -->
@ -75,7 +77,9 @@
<!-- </div> --> <!-- </div> -->
</div> </div>
</div> </div>
</div> </div>
</ng-scrollbar>
</div> </div>
<!-- <div fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="30" fxFlex.lg="30" fxFlex.xl="30" class="m-gap p-gap"> <!-- <div fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="30" fxFlex.lg="30" fxFlex.xl="30" class="m-gap p-gap">
<app-summary></app-summary> <app-summary></app-summary>

View File

@ -20,7 +20,7 @@ h5{
font-family: sans-serif; font-family: sans-serif;
} }
.scrollHV { .scrollHV {
height: calc(100vh - 105px); height: calc(100vh - 211px);
} }
.consultant-list-card { .consultant-list-card {
border-radius: 10px; border-radius: 10px;

View File

@ -40,7 +40,7 @@ export class DoctorProfileComponent implements OnInit {
this.profileDetails = this.bookedAppointment.practitionerInfos[0] this.profileDetails = this.bookedAppointment.practitionerInfos[0]
console.log(this.profileDetails) console.log(this.profileDetails)
this.skillsDetails = JSON.parse(this.profileDetails.skills) this.skillsDetails = JSON.parse(this.profileDetails.skills)
this.skillsDetails = JSON.parse(this.skillsDetails) // this.skillsDetails = JSON.parse(this.skillsDetails)
}else{ }else{

View File

@ -1,4 +1,4 @@
import { Component, OnInit } from '@angular/core'; import { Component, HostListener, OnInit } from '@angular/core';
import { FormControl, FormGroup, Validators } from '@angular/forms'; import { FormControl, FormGroup, Validators } from '@angular/forms';
import { ActivatedRoute, Router } from '@angular/router'; import { ActivatedRoute, Router } from '@angular/router';
import { local } from 'd3'; import { local } from 'd3';
@ -14,6 +14,8 @@ export class PaymentComponent implements OnInit {
bookedAppointment_servicemap: any; bookedAppointment_servicemap: any;
busName: string; busName: string;
onSubmitDisable: any = false; onSubmitDisable: any = false;
scrollValue: any;
clickedValue: any;
constructor(private router:Router,public enduser:EndUserService, private route: ActivatedRoute, ) { constructor(private router:Router,public enduser:EndUserService, private route: ActivatedRoute, ) {
this.enduser.appointmentBooked_observable$.subscribe((res) => { this.enduser.appointmentBooked_observable$.subscribe((res) => {
console.log('booked', res); console.log('booked', res);
@ -30,8 +32,19 @@ export class PaymentComponent implements OnInit {
} }
}) })
} }
// @HostListener('window:popstate', ['$event'])
// onPopState(event) {
// console.log('Back button pressed');
// let URL = this.router.url;
// console.log(URL)
// let URL_AS_LIST = URL.split('/');
// console.log(URL_AS_LIST);
// //this.router.navigate(['customer/business/'+URL_AS_LIST[3]])
// this.router.navigate(['customer/'+URL_AS_LIST[2]+'/'+URL_AS_LIST[3]])
// }
ngOnInit(): void { ngOnInit(): void {
this.busName = localStorage.getItem('busName') this.busName = localStorage.getItem('busName')
@ -81,7 +94,7 @@ export class PaymentComponent implements OnInit {
"appoinmentDate": slot_array[0].date, "appoinmentDate": slot_array[0].date,
"appoinmentTime": time, "appoinmentTime": time,
"serviceMap": serviceMap, "serviceMap": serviceMap,
"appoinmentSlots": slot_array[0].slots, "appoinmentSlots": JSON.stringify(slot_array[0].slots)
//"servicemap" :this.bookedAppointment_servicemap //"servicemap" :this.bookedAppointment_servicemap
} }
console.log(params) console.log(params)

View File

@ -312,7 +312,7 @@ if(this.getHours.length != 0){
this.busName = localStorage.getItem('busName') this.busName = localStorage.getItem('busName')
let params ={"id":this.user.id} let params ={"id":this.user.id,"addcount":this.clicks}
this.end_user.getSlots(params).subscribe(res => { this.end_user.getSlots(params).subscribe(res => {
if (res.status == 200) { if (res.status == 200) {
console.log(res) console.log(res)

View File

@ -6,7 +6,7 @@ export const environment = {
apiEndpoint:'https://api.venbait.in/api/', apiEndpoint:'https://api.venbait.in/api/',
//EndUser URL //EndUser URL
endUserUrl:'https://venbainfotech.com/appointment/#/customer/', endUserUrl: window.location.origin+'/appointment/#/customer/',
firebase: { firebase: {
apiKey: "AIzaSyCKbfDJ5Qf0rDP3WKppa94u9xuVaVabaDw", apiKey: "AIzaSyCKbfDJ5Qf0rDP3WKppa94u9xuVaVabaDw",