From 886fb9acd245f22c8420ffce4b2619692b80987e Mon Sep 17 00:00:00 2001 From: bitbucket Date: Mon, 15 May 2023 10:01:17 +0530 Subject: [PATCH] end slot duration check added --- .../dialog-box/dialog-box.component.html | 2 +- .../dialog-box/dialog-box.component.ts | 47 ++++++++++++++++++ .../slot-booking-details.component.html | 3 +- .../slot-booking-details.component.ts | 49 +++++++++++++++++++ 4 files changed, 99 insertions(+), 2 deletions(-) diff --git a/ng-seed/src/app/appoinment/appoinments/dialog-box/dialog-box.component.html b/ng-seed/src/app/appoinment/appoinments/dialog-box/dialog-box.component.html index e4654c0..decef75 100644 --- a/ng-seed/src/app/appoinment/appoinments/dialog-box/dialog-box.component.html +++ b/ng-seed/src/app/appoinment/appoinments/dialog-box/dialog-box.component.html @@ -78,7 +78,7 @@
- +
diff --git a/ng-seed/src/app/appoinment/appoinments/dialog-box/dialog-box.component.ts b/ng-seed/src/app/appoinment/appoinments/dialog-box/dialog-box.component.ts index deb6951..8bdd8ea 100644 --- a/ng-seed/src/app/appoinment/appoinments/dialog-box/dialog-box.component.ts +++ b/ng-seed/src/app/appoinment/appoinments/dialog-box/dialog-box.component.ts @@ -372,6 +372,53 @@ export class DialogBoxComponent implements OnInit { } }) } + + checkSlotDur(param:any,i:any){ + //console.log(param,i) + // this.slot_array =[]; + // debugger; + // event.preventDefault(); + // this.slotIndex = i + // this.slotTime = param + + // console.log(this.date,param) + let thirtyMinutes = this.duration * 60 * 1000; // convert 30 minutes to milliseconds + let date1 = new Date(param); + let date2 = new Date(date1.getTime() + thirtyMinutes); + // console.log(date1); + // console.log(date2); + const currentTime = new Date(); // Get the current time + //const filteredTimes = this.slots.filter(time => new Date(time) > date1); + + const rangeDate = new Date(date2); + + const resultArray = this.slots.filter(slot => { + const date = new Date(slot); + return date >= rangeDate; + }); + + const firstSlt = new Date(date1); + const lastSlt = new Date( resultArray[0]); + const filteredTimes = this.slots.filter(time => new Date(time) >= firstSlt && new Date(time) <= lastSlt); + + // console.log(resultArray,filteredTimes); + + if(filteredTimes.length>0){ + return 1 + + }else{ + return 0 + } + // let result = filteredTimes.pop(); + // console.log(result); + // this.slots.forEach(element => { + // if(element
- + + diff --git a/ng-seed/src/app/end-user/slot-booking/slot-booking-details.component.ts b/ng-seed/src/app/end-user/slot-booking/slot-booking-details.component.ts index 7c17ee2..546e3ab 100644 --- a/ng-seed/src/app/end-user/slot-booking/slot-booking-details.component.ts +++ b/ng-seed/src/app/end-user/slot-booking/slot-booking-details.component.ts @@ -284,6 +284,55 @@ if(this.getHours.length != 0){ this.slot_array.push({date:this.days[this.clicks],slots:filteredTimes}) } + + + + checkSlotDur(param:any,i:any){ + //console.log(param,i) + // this.slot_array =[]; + // debugger; + // event.preventDefault(); + // this.slotIndex = i + // this.slotTime = param + + // console.log(this.date,param) + let thirtyMinutes = this.servicesName.duration * 60 * 1000; // convert 30 minutes to milliseconds + let date1 = new Date(param); + let date2 = new Date(date1.getTime() + thirtyMinutes); + // console.log(date1); + // console.log(date2); + const currentTime = new Date(); // Get the current time + //const filteredTimes = this.slots.filter(time => new Date(time) > date1); + + const rangeDate = new Date(date2); + + const resultArray = this.slots.filter(slot => { + const date = new Date(slot); + return date >= rangeDate; + }); + + const firstSlt = new Date(date1); + const lastSlt = new Date( resultArray[0]); + const filteredTimes = this.slots.filter(time => new Date(time) >= firstSlt && new Date(time) <= lastSlt); + + // console.log(resultArray,filteredTimes); + + if(filteredTimes.length>0){ + return 1 + + }else{ + return 0 + } + // let result = filteredTimes.pop(); + // console.log(result); + // this.slots.forEach(element => { + // if(element