From 76c21dc25e7b01c4c5ece21daf11432e9221d000 Mon Sep 17 00:00:00 2001 From: bitbucket Date: Fri, 21 Apr 2023 15:38:09 +0530 Subject: [PATCH] reappointment changes --- .../appoinments-list.component.ts | 2 +- .../dialog-box/dialog-box.component.ts | 43 +++++++++++++++++-- ng-seed/src/environments/environment.ts | 2 +- 3 files changed, 42 insertions(+), 5 deletions(-) diff --git a/ng-seed/src/app/appoinment/appoinments/appoinments-list/appoinments-list.component.ts b/ng-seed/src/app/appoinment/appoinments/appoinments-list/appoinments-list.component.ts index ea3aea1..26f009e 100644 --- a/ng-seed/src/app/appoinment/appoinments/appoinments-list/appoinments-list.component.ts +++ b/ng-seed/src/app/appoinment/appoinments/appoinments-list/appoinments-list.component.ts @@ -33,7 +33,7 @@ export interface UsersData { export class AppoinmentsListComponent implements OnInit { push: any; - displayedColumns: string[] = ['id','ClientName','datetime','phoneNo','email','address','status', 'action']; + displayedColumns: string[] = ['ClientName','datetime','phoneNo','email','address','status', 'action']; public appointmentListLength: number; @ViewChild(MatPaginator) paginator: MatPaginator; @ViewChild(MatSort) sort: MatSort; 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 d32a858..b4b5eb1 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 @@ -188,8 +188,27 @@ export class DialogBoxComponent implements OnInit { }); console.log(this.local_data, this.selects) + // this.local_data.forEach(element => { + if(this.local_data.hasOwnProperty('action')){ + + + if(this.local_data.action != 'Add'){ + this.local_data.service = this.local_data['ServicesMapDetail.serviceId'] + this.ServiceId = this.local_data.service + this.local_data.customer = this.local_data.customer[0].id + this.customerId = this.local_data.customer + this.slotsResult =this.local_data.appoinmentSlots + + console.log(this.servicesList_array) + } + + } + + + // }); // this.form.controls['note'].setValue('Sample') this.form.patchValue(this.local_data) + let id = localStorage.getItem('user_id') console.log(id) this._con.getUsersListDetails(id).subscribe(res => { @@ -218,7 +237,7 @@ export class DialogBoxComponent implements OnInit { this.end_user.CreatecusServicesMapDetails(paramsmap).subscribe(res => { if (res.status == 200) { let serviceMap = res['data'][0].id - let paramsData= { + let paramsData:any= { "busId": localStorage.getItem('busId'), "cusId": this.customerId, "appoinmentDate": this.form.value.appoinmentDate, @@ -227,10 +246,24 @@ export class DialogBoxComponent implements OnInit { "appoinmentSlots": this.slotsResult, //"servicemap" :this.bookedAppointment_servicemap } + if(this.local_data.hasOwnProperty('id')){ + paramsData.id =this.local_data.id + } console.log(paramsData) this._app.addFormDetails(paramsData).subscribe(res => { if (res.status == 200) { - this.notifierService.notify('success', 'Appointment Added Successfully'); + + if(this.local_data.hasOwnProperty('action')){ + + + if(this.local_data.action != 'Add'){ + this.notifierService.notify('success', 'Appointment Rescheduled Successfully'); + }else{ + this.notifierService.notify('success', 'Appointment Added Successfully'); + } + }else{ + this.notifierService.notify('success', 'Appointment Added Successfully'); + } this.dialogRef.close(0); } }) @@ -323,7 +356,8 @@ export class DialogBoxComponent implements OnInit { let resultDate = new DatePipe('en-US').transform(param, 'shortTime') this.form.controls['appoinmentTime'].setValue(resultDate) this.date= param - console.log(this.date,param,this.duration) + + console.log(this.date,param,this.duration, this.ServiceId) let thirtyMinutes = this.duration * 60 * 1000; // convert 30 minutes to milliseconds let date1 = new Date(param); let date2 = new Date(date1.getTime() + thirtyMinutes); @@ -372,6 +406,9 @@ export class DialogBoxComponent implements OnInit { }); }); console.log(this.servicesList_array) + this.servicesList_array.filter(arr=>{return arr.serviceId == this.local_data['ServicesMapDetail.serviceId']}) + + this.duration = this.servicesList_array[0].duration } // this.getAssignedList(this.usersList.busId) }); diff --git a/ng-seed/src/environments/environment.ts b/ng-seed/src/environments/environment.ts index c154151..4e0118d 100644 --- a/ng-seed/src/environments/environment.ts +++ b/ng-seed/src/environments/environment.ts @@ -10,7 +10,7 @@ export const environment = { // apiEndpoint:'http://192.168.1.20:8080/api/', // apiEndpoint:'https://api.venbait.in/api/', // apiEndpoint:'http://venbainfotech.com:5000/api/', - apiEndpoint:'http://192.168.1.28:8080/api/', + apiEndpoint:'http://192.168.1.7:8080/api/', //apiEndpoint:'https://api.venbait.in/api/', //EndUser URL