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 fb51028..dceae71 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 @@ -610,11 +610,11 @@ console.log(params) this.date= param console.log(this.date,param,this.duration, this.ServiceId) - let thirtyMinutes = this.duration * 60 * 1000; // convert 30 minutes to milliseconds + let thirtyMinutes = this.duration*60000; // convert 30 minutes to milliseconds let date1 = new Date(param); let date2 = new Date(date1.getTime() + thirtyMinutes); console.log(date1); - console.log(date2); + console.log(date2,thirtyMinutes); const currentTime = new Date(); // Get the current time //const filteredTimes = this.slots.filter(time => new Date(time) > date1); @@ -630,10 +630,10 @@ console.log(params) const filteredTimes = this.slots.filter(time => new Date(time) >= firstSlt && new Date(time) <= lastSlt); console.log(resultArray,filteredTimes); - if(filteredTimes.length > 1){ - let result = filteredTimes.pop(); - console.log(result); - } + // if(filteredTimes.length > 1){ + // let result = filteredTimes.pop(); + // console.log(result); + // } this.slotsResult = filteredTimes // this.show = false; diff --git a/ng-seed/src/app/end-user/booking-summary/booking-summary.component.ts b/ng-seed/src/app/end-user/booking-summary/booking-summary.component.ts index 2e178d2..97fd11f 100644 --- a/ng-seed/src/app/end-user/booking-summary/booking-summary.component.ts +++ b/ng-seed/src/app/end-user/booking-summary/booking-summary.component.ts @@ -56,9 +56,15 @@ export class BookingSummaryComponent implements OnInit { console.log(URL,slot_array) let URL_AS_LIST = URL.split('/'); console.log(URL_AS_LIST); + let cusID; + if(URL_AS_LIST[2] == 'business'){ + cusID=URL_AS_LIST[9] + }else{ + cusID=URL_AS_LIST[8] + } // if(serviceDetails.hasOwnProperty('userId')){ serviceDetails.userId = localStorage.getItem('user_id') - let paramPay = {"cusId":URL_AS_LIST[9]} + let paramPay = {"cusId":cusID} this.end_user.paymentstatus(paramPay).subscribe(resPay => { @@ -79,19 +85,61 @@ export class BookingSummaryComponent implements OnInit { console.log(res) let serviceMap = res['data'][0].id let time = new Date().toLocaleTimeString() - let params= { - "busId": serviceDetails.busId, - "cusId": URL_AS_LIST[9], - "appoinmentDate": slot_array[0].date, - "appoinmentTime": time, - "serviceMap": serviceMap, - "paymentStatus": 1, - "paymentMode":"online", - "createdBy":"customer", - "appoinmentSlots": JSON.stringify(slot_array[0].slots) - //"servicemap" :this.bookedAppointment_servicemap - } - console.log(params) + let param= { + "busId": serviceDetails.busId, + "cusId": cusID, + "appoinmentDate": slot_array[0].date, + "userId": serviceDetails.userId, + "appoinmentSlots": JSON.stringify(slot_array[0].slots) + //"servicemap" :this.bookedAppointment_servicemap + } + console.log(param) + + this.end_user.CheckAppoinmentsDetails(param).subscribe(res => { + if (res.status == 200) { + console.log(res) + res = res.data; + // this.end_user.summmarylist.next(res.data) + console.log('booked2', res); + this.customerBookingDetails = res[0].customer[0] + console.log(this.customerBookingDetails) + this.bookingSummary = res[0] + + this.bookingSummary.createdAt2 = this.bookingSummary.createdAt + if(this.bookingSummary.appoinmentSlots instanceof Array){ + this.bookingSummary.appoinmentSlots =this.bookingSummary.appoinmentSlots + }else{ + 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} + this.end_user.getcusServicesMapDetails(param).subscribe(res => { + if (res.status == 200) { + console.log(res) + this.serviceMapDetails = res['data'][0] + this.busCurrency = this.serviceMapDetails['business'][0].currency + + } + }) + + + }else{ + + let params= { + "busId": serviceDetails.busId, + "cusId": cusID, + "appoinmentDate": slot_array[0].date, + "appoinmentTime": time, + "serviceMap": serviceMap, + "paymentStatus": 1, + "paymentMode":"online", + "createdBy":"customer", + "appoinmentSlots": JSON.stringify(slot_array[0].slots) + //"servicemap" :this.bookedAppointment_servicemap + } + this.end_user.CreateAppoinmentsCus(params).subscribe(res => { if (res.status == 200) { console.log(res) @@ -123,6 +171,9 @@ export class BookingSummaryComponent implements OnInit { // this.router.navigate([URL+"/bts"]) } }) + + } + }) } diff --git a/ng-seed/src/app/end-user/end-user-routing.module.ts b/ng-seed/src/app/end-user/end-user-routing.module.ts index 4d3cfef..8df63ba 100644 --- a/ng-seed/src/app/end-user/end-user-routing.module.ts +++ b/ng-seed/src/app/end-user/end-user-routing.module.ts @@ -54,16 +54,16 @@ const routes: Routes = [{ // component: ConsultantsListComponent // }, { - path: 'practitioner/:randstr/details', + path: 'practitioner/:randstr', component: DoctorProfileComponent }, { - path: 'practitioner/:randstr/details/services', + path: 'practitioner/:randstr/services', component: ServiceListComponent }, { - path: 'practitioner/:randstr/details/services/slots/list', + path: 'practitioner/:randstr/services/slots/list', component: SlotBookingDetailsComponent }, @@ -89,15 +89,15 @@ const routes: Routes = [{ }, /// { - path: 'practitioner/:randstr/details/services/slots/list/cus', + path: 'practitioner/:randstr/services/slots/list/cus', component: CustomerInfoComponent }, { - path: 'practitioner/:randstr/details/services/slots/list/cus/:cusId/pt', + path: 'practitioner/:randstr/services/slots/list/cus/:cusId/pt', component: PaymentComponent }, { - path: 'practitioner/:randstr/details/services/slots/list/cus/:cusId/pt/bts', + path: 'practitioner/:randstr/services/slots/list/cus/:cusId/pt/bts', component: BookingSummaryComponent }, { diff --git a/ng-seed/src/app/end-user/end-user.service.ts b/ng-seed/src/app/end-user/end-user.service.ts index f38700c..12f1685 100644 --- a/ng-seed/src/app/end-user/end-user.service.ts +++ b/ng-seed/src/app/end-user/end-user.service.ts @@ -51,6 +51,11 @@ private apiUrl = environment.apiEndpoint; } + CheckAppoinmentsDetails(Params): Observable { + return this._http.post(this.apiUrl + 'CheckAppoinmentsDetails', Params) + + } + paymentRequest(Params): Observable { return this._http.post(this.apiUrl + 'paymentRequest', Params) 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 bf8d49c..18b11d2 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 @@ -78,11 +78,11 @@ export class SlotBookingDetailsComponent implements OnInit { let URL_AS_LIST = URL.split('/'); console.log(URL_AS_LIST); - if(URL_AS_LIST[2] == 'practitioner'){ - this.router.navigate(['customer/'+URL_AS_LIST[2]+'/'+URL_AS_LIST[3]+'/details']) - }else{ - this.router.navigate(['customer/'+URL_AS_LIST[2]+'/'+URL_AS_LIST[3]]) - } + // if(URL_AS_LIST[2] == 'practitioner'){ + // this.router.navigate(['customer/'+URL_AS_LIST[2]+'/'+URL_AS_LIST[3]+'/details']) + // }else{ + // this.router.navigate(['customer/'+URL_AS_LIST[2]+'/'+URL_AS_LIST[3]]) + // } } }) @@ -255,7 +255,7 @@ if(this.getHours.length != 0){ this.slotTime = param console.log(this.date,param,this.servicesName.duration) - let thirtyMinutes = this.servicesName.duration * 60 * 1000; // convert 30 minutes to milliseconds + let thirtyMinutes = this.servicesName.duration *60000; // convert 30 minutes to milliseconds console.log(thirtyMinutes) let date1 = new Date(param); let date2 = new Date(date1.getTime() + thirtyMinutes);