sort and filter consult
This commit is contained in:
parent
6d1b441461
commit
21157acb66
@ -53,12 +53,19 @@ export class ConsultantsListComponent implements OnInit {
|
||||
|
||||
});
|
||||
console.log(workinghrs)
|
||||
localStorage.setItem('workingHrs',workinghrs[0].workingHours)
|
||||
|
||||
}
|
||||
|
||||
goToSlotBooking(param){
|
||||
let URL = this.router.url;
|
||||
console.log(URL,param)
|
||||
let tmp = localStorage.getItem('cusServiceData')
|
||||
let practitioner = JSON.parse(tmp)
|
||||
console.log(practitioner)
|
||||
let filter = practitioner.filter(arr=>{return arr.userId == param.id && arr.busId ==param.busId})
|
||||
console.log(filter)
|
||||
localStorage.setItem('workingHrs',param.practitionerInfos
|
||||
[0].workingHours)
|
||||
let service = localStorage.getItem("servicedetails")
|
||||
let serviceDetails = JSON.parse(service)
|
||||
serviceDetails.userId = ""+param.id+""
|
||||
@ -67,7 +74,7 @@ export class ConsultantsListComponent implements OnInit {
|
||||
|
||||
// let tmp = localStorage.getItem('cusServiceData')
|
||||
// console.log(JSON.parse(tmp))
|
||||
// this.end_user.getBookedAppointment.next(tmp.appoinment)
|
||||
this.end_user.appointmentBooked.next(filter)
|
||||
// console.log(URL+"/"+data.randStr+"/practitioner")
|
||||
this.router.navigate([URL+"/slot"])
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { environment } from 'environments/environment';
|
||||
import { Observable } from 'rxjs';
|
||||
import { BehaviorSubject, Observable } from 'rxjs';
|
||||
import { catchError } from 'rxjs/operators';
|
||||
|
||||
@Injectable({
|
||||
@ -10,6 +10,8 @@ import { catchError } from 'rxjs/operators';
|
||||
export class EndUserService {
|
||||
|
||||
|
||||
public appointmentBooked:BehaviorSubject<any> = new BehaviorSubject<any>([]);
|
||||
public appointmentBooked_observable$ = this.appointmentBooked.asObservable();
|
||||
private apiUrl = environment.apiEndpoint;
|
||||
constructor(private _http: HttpClient) { }
|
||||
|
||||
|
||||
@ -59,6 +59,7 @@ export class PaymentComponent implements OnInit {
|
||||
this.enduser.CreateAppoinmentsCus(params).subscribe(res => {
|
||||
if (res.status == 200) {
|
||||
console.log(res)
|
||||
localStorage.setItem('summarylist',JSON.stringify(res.data))
|
||||
this.router.navigate([URL+"/bts"])
|
||||
}
|
||||
})
|
||||
|
||||
@ -39,9 +39,9 @@
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div fxFlex.xs="50" fxFlex.sm="50" fxFlex.md="33.33" fxFlex.lg="33.33" fxFlex.xl="33.33" class="m-gap p-gap flx" fxLayoutAlign="end center">
|
||||
<!-- <div fxFlex.xs="50" fxFlex.sm="50" fxFlex.md="33.33" fxFlex.lg="33.33" fxFlex.xl="33.33" class="m-gap p-gap flx" fxLayoutAlign="end center">
|
||||
<app-summary></app-summary>
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
||||
</div>
|
||||
<footer>
|
||||
|
||||
@ -67,7 +67,7 @@ export class ServiceListComponent implements OnInit {
|
||||
console.log(res)
|
||||
this.full_data = res['data']
|
||||
let tmp =[];
|
||||
localStorage.setItem('cusServiceData',JSON.stringify(res['data']))
|
||||
|
||||
res['data'].forEach(element => {
|
||||
// tmp.push(element.service)
|
||||
element.service.forEach(e => {
|
||||
@ -193,7 +193,10 @@ let updatevalue = { serviceId: row_obj.serviceId,
|
||||
}
|
||||
goto(data){
|
||||
let URL = this.router.url;
|
||||
console.log(URL,data)
|
||||
console.log(URL,data,this.full_data)
|
||||
let filter = this.full_data.filter(arr=>{return arr.serviceId == data.serviceId && arr.busId ==data.busId})
|
||||
console.log(filter)
|
||||
localStorage.setItem('cusServiceData',JSON.stringify(filter))
|
||||
localStorage.setItem("servicedetails",JSON.stringify(data))
|
||||
console.log(URL+"/"+data.randStr+"/practitioner")
|
||||
this.router.navigate([URL+"/"+data.randStr+"/practitioner"])
|
||||
|
||||
@ -30,7 +30,7 @@
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div fxFlexAlign="center" fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="60" fxFlex.lg="60" fxFlex.xl="60" class="p-gap"> -->
|
||||
<button *ngFor="let slot of slots;let i=index" mat-raised-button mat-button-sm class="mr-1 mt-1 hoverButton" [ngClass]="{'primary':slotIndex != i,'clickedSlot':slotIndex == i}" (click)="toggleActive($event,slot.startTime,i)">{{slot.startTime | date:'shortTime'}}</button>
|
||||
<button *ngFor="let slot of slots;let i=index" mat-raised-button mat-button-sm class="mr-1 mt-1 hoverButton" [ngClass]="{'primary':slotIndex != i,'clickedSlot':slotIndex == i,'bookedSlot':checkBooked(slot.startTime | date:'shortTime')== '0' } " (click)="toggleActive($event,slot.startTime,i)">{{slot.startTime | date:'shortTime'}}</button>
|
||||
</div>
|
||||
<button mat-raised-button mat-button-sm class="mr-1 mb-1 mt-1 btn-red" (click)="submit()">PROCEED</button>
|
||||
</div>
|
||||
|
||||
@ -3,6 +3,7 @@ import { Component, OnInit } from '@angular/core';
|
||||
import { FormControl, FormGroup, Validators } from '@angular/forms';
|
||||
import { Router } from '@angular/router';
|
||||
import * as moment from 'moment';
|
||||
import { EndUserService } from '../end-user.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-slot-booking-details',
|
||||
@ -41,107 +42,109 @@ export class SlotBookingDetailsComponent implements OnInit {
|
||||
slots: any[];
|
||||
public Currentdate: Date;
|
||||
slotIndex: any;
|
||||
constructor(private router:Router,private datepipe:DatePipe) {
|
||||
bookedAppointment:any=[];
|
||||
constructor(private router:Router,private datepipe:DatePipe,public end_user:EndUserService) {
|
||||
this.end_user.appointmentBooked_observable$.subscribe((res) => {
|
||||
console.log('booked', res);
|
||||
if(res.length>0){
|
||||
this.bookedAppointment=res[0].appoinment
|
||||
}
|
||||
|
||||
})
|
||||
// Set the minimum to January 1st 20 years in the past and December 31st a year in the future.
|
||||
const currentYear:any = new Date();
|
||||
console.log(currentYear)
|
||||
this.minDate = currentYear
|
||||
this.maxDate = new Date(currentYear + 5);
|
||||
// this.maxDate = new Date(currentYear + 1, 11, 31);
|
||||
console.log(this.maxDate)
|
||||
this.workingHours = localStorage.getItem('workingHrs')
|
||||
let formatDate = this.datepipe.transform(new Date(),'EEEE')
|
||||
let findDate = formatDate.toLowerCase()
|
||||
console.log(findDate)
|
||||
console.log(JSON.parse(this.workingHours))
|
||||
this.workingHours = JSON.parse(this.workingHours)
|
||||
|
||||
this.workingHours.forEach((value,index) => {
|
||||
console.log(value[findDate],index)
|
||||
if(value[findDate] != undefined){
|
||||
this.getHours = value[findDate]['hours']
|
||||
console.log(this.getHours[0])
|
||||
}
|
||||
//value.filter(val => findDate == val.)
|
||||
// for(const [key,value1] of Object.entries(value)) {
|
||||
// console.log(key,value1)
|
||||
// }
|
||||
});
|
||||
let getDuration = JSON.parse(localStorage.getItem('servicedetails'))
|
||||
console.log(getDuration.duration)
|
||||
|
||||
function convertTime12to24 (time12h) {
|
||||
const [time, modifier] = time12h.split(' ');
|
||||
|
||||
this.slot_Split()
|
||||
|
||||
let [hours, minutes] = time.split(':');
|
||||
|
||||
if (hours === '12') {
|
||||
hours = '00';
|
||||
}
|
||||
|
||||
if (modifier === 'pm') {
|
||||
hours = parseInt(hours, 10) + 12;
|
||||
}
|
||||
|
||||
return `${hours}:${minutes}`;
|
||||
}
|
||||
|
||||
console.log(convertTime12to24(this.getHours[0].startTime));
|
||||
|
||||
this.Currentdate = new Date();
|
||||
console.log(this.Currentdate.toISOString().slice(0,10));
|
||||
let todayDate = this.Currentdate.toISOString().slice(0,10)
|
||||
let startmomentDate = todayDate + 'T' + convertTime12to24(this.getHours[0].startTime) + ':00'
|
||||
console.log(startmomentDate)
|
||||
let endmomentDate = todayDate + 'T' + convertTime12to24(this.getHours[0].endTime) + ':00'
|
||||
|
||||
// let fristIndex = this.getHours[0].startTime.split(':')
|
||||
// console.log(fristIndex[0])
|
||||
// let secondIndex = fristIndex[1].endTime.split('')
|
||||
|
||||
const startTime = moment(startmomentDate);
|
||||
const endTime = moment(endmomentDate);
|
||||
|
||||
// Define the interval duration in minutes
|
||||
const intervalDurationInMinutes = getDuration.duration;
|
||||
|
||||
// Define an array to store the intervals
|
||||
const intervals = [];
|
||||
|
||||
// Iterate over the time range and split it into intervals
|
||||
let currentIntervalStartTime = startTime;
|
||||
while (currentIntervalStartTime < endTime) {
|
||||
// Calculate the end time of the interval
|
||||
const currentIntervalEndTime = moment.min(currentIntervalStartTime.clone().add(intervalDurationInMinutes, 'minutes'), endTime);
|
||||
|
||||
// Add the interval to the array
|
||||
intervals.push({
|
||||
startTime: currentIntervalStartTime.toDate(),
|
||||
endTime: currentIntervalEndTime.toDate(),
|
||||
});
|
||||
|
||||
// Move to the next interval
|
||||
currentIntervalStartTime = currentIntervalEndTime;
|
||||
}
|
||||
|
||||
// Output the intervals
|
||||
console.log(intervals);
|
||||
this.slots = intervals
|
||||
|
||||
// this.slots = []
|
||||
// intervals.forEach(element => {
|
||||
// console.log(element.startTime)
|
||||
// this.slots.push(element.service)
|
||||
// // element.startTime.forEach(e => {
|
||||
// // console.log(e)
|
||||
// // });
|
||||
|
||||
// });
|
||||
// const timeSlices = splitTime(this.getHours[0].startTime,this.getHours[0].endTime,getDuration.duration);
|
||||
|
||||
|
||||
}
|
||||
|
||||
slot_Split(){
|
||||
const currentYear:any = new Date();
|
||||
console.log(currentYear)
|
||||
this.minDate = currentYear
|
||||
this.maxDate = new Date(currentYear + 5);
|
||||
// this.maxDate = new Date(currentYear + 1, 11, 31);
|
||||
console.log(this.maxDate)
|
||||
this.workingHours = localStorage.getItem('workingHrs')
|
||||
let formatDate = this.datepipe.transform(new Date(),'EEEE')
|
||||
let findDate = formatDate.toLowerCase()
|
||||
console.log(findDate)
|
||||
console.log(JSON.parse(this.workingHours))
|
||||
this.workingHours = JSON.parse(this.workingHours)
|
||||
|
||||
this.workingHours.forEach((value,index) => {
|
||||
console.log(value[findDate],index)
|
||||
if(value[findDate] != undefined){
|
||||
this.getHours = value[findDate]['hours']
|
||||
console.log(this.getHours[0])
|
||||
}
|
||||
//value.filter(val => findDate == val.)
|
||||
// for(const [key,value1] of Object.entries(value)) {
|
||||
// console.log(key,value1)
|
||||
// }
|
||||
});
|
||||
let getDuration = JSON.parse(localStorage.getItem('servicedetails'))
|
||||
console.log(getDuration.duration)
|
||||
|
||||
function convertTime12to24 (time12h) {
|
||||
const [time, modifier] = time12h.split(' ');
|
||||
|
||||
let [hours, minutes] = time.split(':');
|
||||
|
||||
if (hours === '12') {
|
||||
hours = '00';
|
||||
}
|
||||
|
||||
if (modifier === 'pm') {
|
||||
hours = parseInt(hours, 10) + 12;
|
||||
}
|
||||
|
||||
return `${hours}:${minutes}`;
|
||||
}
|
||||
|
||||
console.log(convertTime12to24(this.getHours[0].startTime));
|
||||
|
||||
this.Currentdate = new Date();
|
||||
console.log(this.Currentdate.toISOString().slice(0,10));
|
||||
let todayDate = this.Currentdate.toISOString().slice(0,10)
|
||||
let startmomentDate = todayDate + 'T' + convertTime12to24(this.getHours[0].startTime) + ':00'
|
||||
console.log(startmomentDate)
|
||||
let endmomentDate = todayDate + 'T' + convertTime12to24(this.getHours[0].endTime) + ':00'
|
||||
|
||||
// let fristIndex = this.getHours[0].startTime.split(':')
|
||||
// console.log(fristIndex[0])
|
||||
// let secondIndex = fristIndex[1].endTime.split('')
|
||||
|
||||
const startTime = moment(startmomentDate);
|
||||
const endTime = moment(endmomentDate);
|
||||
|
||||
// Define the interval duration in minutes
|
||||
const intervalDurationInMinutes = getDuration.duration;
|
||||
|
||||
// Define an array to store the intervals
|
||||
const intervals = [];
|
||||
|
||||
// Iterate over the time range and split it into intervals
|
||||
let currentIntervalStartTime = startTime;
|
||||
while (currentIntervalStartTime < endTime) {
|
||||
// Calculate the end time of the interval
|
||||
const currentIntervalEndTime = moment.min(currentIntervalStartTime.clone().add(intervalDurationInMinutes, 'minutes'), endTime);
|
||||
|
||||
// Add the interval to the array
|
||||
intervals.push({
|
||||
startTime: currentIntervalStartTime.toDate(),
|
||||
endTime: currentIntervalEndTime.toDate(),
|
||||
});
|
||||
|
||||
// Move to the next interval
|
||||
currentIntervalStartTime = currentIntervalEndTime;
|
||||
}
|
||||
|
||||
// Output the intervals
|
||||
console.log(intervals);
|
||||
this.slots = intervals
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.form = new FormGroup({
|
||||
@ -181,5 +184,20 @@ export class SlotBookingDetailsComponent implements OnInit {
|
||||
console.log(URL)
|
||||
this.router.navigate([URL+"/cus"])
|
||||
}
|
||||
checkBooked(param){
|
||||
// console.log(param, this.bookedAppointment)
|
||||
this.bookedAppointment.forEach(element => {
|
||||
// console.log(element.appoinmentSlots,param)
|
||||
param = param.toString()
|
||||
if(element.appoinmentSlots.trim() == param.trim()){
|
||||
// console.log("sksjfjdhkfhsdfcgdjsh")
|
||||
return '0';
|
||||
}else{
|
||||
return 1
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -3,15 +3,13 @@
|
||||
<div class="header">
|
||||
<div class="content">
|
||||
<span class="title">SERVICE</span>
|
||||
<p class="message">Online Video</p>
|
||||
<p class="message">Counselling via Google </p>
|
||||
<p class="message">Meet with Ms. A.</p>
|
||||
<p class="message">Lakshmi</p>
|
||||
<p class="message">{{serviceName}}</p>
|
||||
|
||||
</div>
|
||||
<div class="content">
|
||||
<span class="title">LOCATION</span>
|
||||
<p class="message">Hope Counselling</p>
|
||||
<p class="message">Services </p>
|
||||
<!-- <p class="message">Hope Counselling</p>
|
||||
<p class="message">Services </p> -->
|
||||
</div>
|
||||
</div>
|
||||
<hr class="new1">
|
||||
@ -19,8 +17,8 @@
|
||||
<div class="content">
|
||||
<span class="title">PRACTITIONER</span>
|
||||
<p class="message">A Lakshmi</p>
|
||||
<p class="message">bookconsult.in/lakshmi </p>
|
||||
</div>
|
||||
<!-- <p class="message">bookconsult.in/lakshmi </p>
|
||||
</div> -->
|
||||
</div>
|
||||
<hr class="new1">
|
||||
<div class="header">
|
||||
|
||||
@ -8,10 +8,19 @@ import { ServiceListComponent } from '../service-list-details/service-list.compo
|
||||
styleUrls: ['./summary.component.scss']
|
||||
})
|
||||
export class SummaryComponent implements OnInit {
|
||||
serviceName: any=[];
|
||||
|
||||
constructor() { }
|
||||
|
||||
ngOnInit(): void {
|
||||
let tmp = localStorage.getItem("servicedetails")
|
||||
let val =JSON.parse(tmp)
|
||||
console.log(val)
|
||||
this.serviceName = val.servicesName
|
||||
let tmp2 = localStorage.getItem("servicedetails")
|
||||
let val2 =JSON.parse(tmp)
|
||||
console.log(val)
|
||||
this.serviceName = val.servicesName
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -6,7 +6,8 @@
|
||||
export const environment = {
|
||||
production: false,
|
||||
environmentName: 'Testing Environment',//Localhost Environment.
|
||||
|
||||
// apiEndpoint:'http://venbainfotech.com:5000/api/',
|
||||
//apiEndpoint:'http://venbainfotech.com:5000/api/',
|
||||
apiEndpoint:'http://192.168.1.20:8080/api/',
|
||||
|
||||
|
||||
};
|
||||
|
||||
Loading…
Reference in New Issue
Block a user