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)
Swal.fire(
'Deleted!',
'Your imaginary file has been deleted.',
'Your Appointment has been deleted.',
'success'
)
} else if (result.dismiss === Swal.DismissReason.cancel) {
Swal.fire(
'Cancelled',
'Your imaginary file is safe :)',
'Your Appointment is safe :)',
'error'
)
}

View File

@ -99,7 +99,7 @@ export class DialogBoxComponent implements OnInit {
appoinmentsIds: any=[];
customersList: any=[];
customerId: any;
slotsResult: any;
slotsResult: any = [];
ServiceId: any;
user_role: string;
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) {
console.log(data);
this.local_data = {...data};
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)
}
this.action = this.local_data.action;
}
get f(){
return this.form.controls;
@ -158,7 +147,14 @@ export class DialogBoxComponent implements OnInit {
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) => {
// console.log('cus', res);
@ -171,6 +167,7 @@ export class DialogBoxComponent implements OnInit {
this.user_role = localStorage.getItem('user_role');
let tmp=[]
console.log(this.advanced_slot_days)
for(let i=0;i<=this.advanced_slot_days;i++){
var someDate = new Date();
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)
this.days= tmp
// this.getslotData()
this.getSlots()
console.log(this.days)
if(this.action == 'Update'){
this.getslotData()
}else{
this.getSlots()
}
if(this.user_role != 'FRONTDESK'){
let userId = localStorage.getItem('user_id')
let busId = localStorage.getItem('busId')
@ -195,15 +198,15 @@ export class DialogBoxComponent implements OnInit {
busname: new FormControl('', [Validators.required]),
service: new FormControl('', [Validators.required]),
practitioner: new FormControl('', [Validators.required]),
appoinmentDate: new FormControl('', [Validators.required]),
appoinmentTime: new FormControl('', [Validators.required]),
appoinmentDate: new FormControl('',null),
appoinmentTime: new FormControl('',null),
customer: new FormControl('', [Validators.required]),
// note: new FormControl('', [Validators.required]),
status: new FormControl('', null),
appoinmentSlots: new FormControl('', [Validators.required]),
appoinmentSlots: new FormControl(''),
});
console.log(this.local_data, this.selects)
@ -249,44 +252,44 @@ export class DialogBoxComponent implements OnInit {
return this.form.controls[controlName].hasError(errorName);
}
// getslotData(){
getslotData(){
// let findAppointmentDate = this.local_data.appoinmentDate
// this.days.forEach(element => {
// console.log(element)
// if(element == findAppointmentDate){
// this.days.indexOf(element)
// console.log(this.days.indexOf(element))
// this.clicks = this.days.indexOf(element)
// }
// });
let findAppointmentDate = this.local_data.appoinmentDate
this.days.forEach(element => {
console.log(element)
if(element == findAppointmentDate){
this.days.indexOf(element)
console.log(this.days.indexOf(element))
this.clicks = this.days.indexOf(element)
}
});
// let options:any = { weekday: 'long'};
// var prnDt = new Date(this.days[ this.clicks]).toLocaleTimeString('en-us', options);
// var formatDate = prnDt.split(" ")
// console.log(formatDate)
let options:any = { weekday: 'long'};
var prnDt = new Date(this.days[ this.clicks]).toLocaleTimeString('en-us', options);
var formatDate = prnDt.split(" ")
console.log(formatDate)
// this.dayName = formatDate[0]
// let userId = localStorage.getItem('user_id')
// let params ={"id":userId , "day": this.dayName , "addcount": this.clicks}
this.dayName = formatDate[0]
let userId = localStorage.getItem('user_id')
let params ={"id":userId , "day": this.dayName , "addcount": this.clicks}
// this.end_user.getSlots(params).subscribe(res => {
// if (res.status == 200) {
// console.log(res)
// let data = res['data'];
// this.slots = data
// this.slots.forEach(element => {
// console.log(element)
// if(element == this.findSlotIndex[0]){
// this.slots.indexOf(element)
// console.log(this.slots.indexOf(element))
// this.slotIndex = this.slots.indexOf(element)
this.end_user.getSlots(params).subscribe(res => {
if (res.status == 200) {
console.log(res)
let data = res['data'];
this.slots = data
this.slots.forEach(element => {
console.log(element)
if(element == this.findSlotIndex[0]){
this.slots.indexOf(element)
console.log(this.slots.indexOf(element))
this.slotIndex = this.slots.indexOf(element)
// }
// });
// }
// })
// }
}
});
}
})
}
getCosultantList() {
let param ={"busId": localStorage.getItem('busId')}
@ -310,12 +313,19 @@ export class DialogBoxComponent implements OnInit {
submit(){
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');
}
if (!this.form.valid) {
return;
}
this.form.controls['appoinmentSlots'].clearValidators();
this.form.controls['appoinmentSlots'].updateValueAndValidity();
} else {
if (!this.form.valid) {
return;
}
console.log(this.form.value,this.slotsResult,this.days[this.clicks]);
let paramsmap= {
@ -332,7 +342,7 @@ export class DialogBoxComponent implements OnInit {
"appoinmentDate": this.days[this.clicks],
"appoinmentTime": this.form.value.appoinmentTime,
"serviceMap":serviceMap,
"appoinmentSlots": this.slotsResult,
"appoinmentSlots": JSON.stringify(this.slotsResult)
//"servicemap" :this.bookedAppointment_servicemap
}
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);
console.log(resultArray,filteredTimes);
let result = filteredTimes.pop();
console.log(result);
if(filteredTimes.length > 1){
let result = filteredTimes.pop();
console.log(result);
}
this.slotsResult = filteredTimes
// this.show = false;
// this.slots.forEach(element => {

View File

@ -249,15 +249,11 @@ unavailability(action,obj) {
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":[]}}]
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 => {
if (res.status == 200) {
console.log(res)
console.log(res)
this.getUsersList()
}
else{

View File

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

View File

@ -20,7 +20,9 @@
</mat-form-field>
</div>
</div>
<ng-scrollbar class="scrollHV">
<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 class="consultant-list-card card-inner-circle-orange" [style.background]="bgColorPast[1]" (click)="goToSlotBooking(consultant)">
<!-- <div class="consultant-content"> -->
@ -75,7 +77,9 @@
<!-- </div> -->
</div>
</div>
</div>
</ng-scrollbar>
</div>
<!-- <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>

View File

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

View File

@ -40,7 +40,7 @@ export class DoctorProfileComponent implements OnInit {
this.profileDetails = this.bookedAppointment.practitionerInfos[0]
console.log(this.profileDetails)
this.skillsDetails = JSON.parse(this.profileDetails.skills)
this.skillsDetails = JSON.parse(this.skillsDetails)
// this.skillsDetails = JSON.parse(this.skillsDetails)
}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 { ActivatedRoute, Router } from '@angular/router';
import { local } from 'd3';
@ -14,6 +14,8 @@ export class PaymentComponent implements OnInit {
bookedAppointment_servicemap: any;
busName: string;
onSubmitDisable: any = false;
scrollValue: any;
clickedValue: any;
constructor(private router:Router,public enduser:EndUserService, private route: ActivatedRoute, ) {
this.enduser.appointmentBooked_observable$.subscribe((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 {
this.busName = localStorage.getItem('busName')
@ -81,7 +94,7 @@ export class PaymentComponent implements OnInit {
"appoinmentDate": slot_array[0].date,
"appoinmentTime": time,
"serviceMap": serviceMap,
"appoinmentSlots": slot_array[0].slots,
"appoinmentSlots": JSON.stringify(slot_array[0].slots)
//"servicemap" :this.bookedAppointment_servicemap
}
console.log(params)

View File

@ -312,7 +312,7 @@ if(this.getHours.length != 0){
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 => {
if (res.status == 200) {
console.log(res)

View File

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