Merge branch 'master' of bitbucket.org:venbainformationtechnology/appointments_frontend

This commit is contained in:
Surendiran 2023-05-31 16:34:39 +05:30
commit 2edad65476
9 changed files with 272 additions and 70 deletions

View File

@ -85,9 +85,16 @@
<button type="button" mat-raised-button (click)="goToSlotBooking2()" style="background-color: #7fffd400;box-shadow: none;color:#fff" ><mat-icon style="cursor: pointer;">keyboard_arrow_left</mat-icon></button><span style="width: 150px;text-align: center;">{{check(days) | date:'longDate'}}</span><button mat-raised-button type="button" (click)="goToSlotBooking()" *ngIf="clicks < advanced_slot_days" style="background-color: #7fffd400;box-shadow: none;color:#fff" ><mat-icon style="cursor: pointer;">keyboard_arrow_right</mat-icon></button>
</div>
<div class="innerdivs2" >
<div *ngIf="slots.length != 0" [ngStyle]="{ 'height.px': slots.length * 12 }">
<div *ngIf="slots.length != 0" [ngStyle]="{ 'height.px': slotslength * 12 }">
<!-- <div *ngIf="slots.length != 0" [ngStyle]="{ 'height.px': slots.length * 12 }"> -->
<!-- <ng-scrollbar class="scrollHV2" *ngIf="slots.length != 0"> -->
<button type="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 && checkSlotDur(slot,i)==1,'clickedSlot':slotIndex == i && checkSlotDur(slot,i)==1 }" (click)="toggleActive($event,slot,i)"><span *ngIf="checkSlotDur(slot,i)==1">{{slot | date:'shortTime'}}</span></button>
<span *ngFor="let slot1 of slots;let j=index">
<!-- <button *ngFor="let slot of slot1;let i=index" mat-raised-button mat-button-sm class="mr-1 mt-1 hoverButton" [ngClass]="{'primary':slotIndex != i && checkSlotDur(slot,i)==1,'clickedSlot':slotIndex == i && checkSlotDur(slot,i)==1 }" (click)="toggleActive($event,slot,i)" ><span *ngIf="checkSlotDur(slot,i)==1">{{slot | date:'shortTime'}}</span></button> -->
<a *ngFor="let slot of slot1;let i=index">
<button *ngIf="checkSlotDur(slot,i,slot1)==1" type="button" mat-raised-button mat-button-sm class="mr-1 mt-1 hoverButton primary" [ngClass]="{'primary':slotIndex != slot ,'clickedSlot':slotIndex == slot && slots_select ==slot1 && slotIndex_group == j}" (click)="toggleActive($event,slot,i,slot1,j)" ><span >{{slot| date:'shortTime' }}</span></button>
</a>
</span>
<!-- <button type="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 && checkSlotDur(slot,i)==1,'clickedSlot':slotIndex == i && checkSlotDur(slot,i)==1 }" (click)="toggleActive($event,slot,i)"><span *ngIf="checkSlotDur(slot,i)==1">{{slot | date:'shortTime'}}</span></button> -->
<!-- </ng-scrollbar> -->
</div>
<div *ngIf="slots.length == 0">

View File

@ -112,6 +112,8 @@ export class DialogBoxComponent implements OnInit {
isSubmitting: boolean = false;
selectedRadioValue: any;
paymentMode: boolean = false;
slotIndex_group:any=[];
slotslength:any=[];
constructor(private notifierService: NotifierService,private router: Router,private formBuilder: FormBuilder, public _cus:CustomersService,
public dialogRef: MatDialogRef<DialogBoxComponent>,public _api:ConsultantService, public _con:ConsultantService,
@Inject(MAT_DIALOG_DATA) public data: UsersData,public _app:AppointmentsService,public end_user:EndUserService) {
@ -296,6 +298,12 @@ export class DialogBoxComponent implements OnInit {
console.log(res)
let data = res['data'];
this.slots = data
let len =[]
this.slots.forEach(element => {
len.push( element.length)
})
console.log(len)
// this.slots.forEach(element => {
// console.log(element)
// if(element == this.findSlotIndex[0]){
@ -376,7 +384,7 @@ export class DialogBoxComponent implements OnInit {
})
}
checkSlotDur(param:any,i:any){
checkSlotDur(param:any,i:any,slots){
//console.log(param,i)
// this.slot_array =[];
// debugger;
@ -385,7 +393,7 @@ export class DialogBoxComponent implements OnInit {
// this.slotTime = param
// console.log(this.date,param)
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);
@ -395,14 +403,14 @@ export class DialogBoxComponent implements OnInit {
const rangeDate = new Date(date2);
const resultArray = this.slots.filter(slot => {
const resultArray = 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);
const filteredTimes = slots.filter(time => new Date(time) >= firstSlt && new Date(time) <= lastSlt);
// console.log(resultArray,filteredTimes);
@ -595,16 +603,25 @@ console.log(params)
console.log(res)
let data = res['data'];
this.slots = data
let len =[];
this.slots.forEach(element => {
len.push( element.length)
})
console.log(len)
this.slotslength = len.reduce((a, b) => a + b, 0)
}
})
}
toggleActive(event:any,param:any,i:any){
toggleActive(event:any,param:any,i:any,slots,j){
console.log(event,param,i)
this.slot_array =[];
this.slotIndex_group=j
// debugger;
// // event.preventDefault();
this.slotIndex = i
this.slotIndex = param
// this.slotTime = param
let resultDate = new DatePipe('en-US').transform(param, 'shortTime')
this.form.controls['appoinmentTime'].setValue(resultDate)
@ -621,14 +638,14 @@ console.log(params)
const rangeDate = new Date(date2);
const resultArray = this.slots.filter(slot => {
const resultArray =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);
const filteredTimes = slots.filter(time => new Date(time) >= firstSlt && new Date(time) <= lastSlt);
console.log(resultArray,filteredTimes);
// if(filteredTimes.length > 1){

View File

@ -79,7 +79,7 @@
<span class="head">Booked On</span>
</div>
<div fxFlex.xs="75" fxFlex.sm="75" fxFlex.md="75" fxFlex.lg="75" fxFlex.xl="75">
<span>: {{bookingSummary.createdAt2 | date:'dd/MM/yyyy'}}</span>
<span>: {{bookingSummary.createdAt2 }}</span>
</div>
</div>
<div fxLayout="row wrap" style="margin-bottom: 20px;">
@ -111,7 +111,16 @@
<span class="head">Fees</span>
</div>
<div fxFlex.xs="75" fxFlex.sm="75" fxFlex.md="75" fxFlex.lg="75" fxFlex.xl="75">
<span>: {{busCurrency}} {{serviceMapDetails.duration.length>0 ? serviceMapDetails.duration[0].fees : serviceMapDetails.service[0].fees}}</span>
<span>: {{busCurrency}} {{(serviceMapDetails.duration.length>0 ? serviceMapDetails.duration[0].fees : serviceMapDetails.service[0].fees) | currency: currency}}</span>
</div>
</div>
<div fxLayout="row wrap" style="margin-bottom: 20px;">
<div fxFlex.xs="25" fxFlex.sm="25" fxFlex.md="25" fxFlex.lg="25" fxFlex.xl="25">
<span class="head">Payment Status</span>
</div>
<div fxFlex.xs="75" fxFlex.sm="75" fxFlex.md="75" fxFlex.lg="75" fxFlex.xl="75">
<span [ngStyle]="{ 'color': bookingSummary.paymentStatus== 0 ? 'red':'green' }">: {{(bookingSummary.paymentStatus== 0 ? 'Not Paid' : 'Paid') }}</span>
</div>
</div>
<!-- <div fxLayout="row wrap" style="margin-bottom: 20px;">

View File

@ -34,7 +34,7 @@ mat-toolbar{
}
.radius{
width: 100%;
margin-top: 5%;
margin-top: 3%;
}
.radius1{

View File

@ -23,13 +23,15 @@ export class BookingSummaryComponent implements OnInit {
private apiUrl = environment.apiEndpoint;
customerBookingDetails: any = [];
busCurrency: any = [];
constructor(public end_user:EndUserService,private router:Router,) {
this.logo = localStorage.getItem('logo')
this.busName = localStorage.getItem('busName')
this.end_user.summmarylist_observable$.subscribe((res) => {
console.log('booked', res);
if(res.length>0){
// this.bookedAppointment_servicemap=res[0].id;
// this.bookedAppointment_servicemap=res[0].id;z
}else{
let URL = this.router.url;
@ -127,50 +129,50 @@ export class BookingSummaryComponent implements OnInit {
}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
}
// 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)
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]
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.CreateAppoinmentsCus(params).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]
// 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
// // 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
}
})
// }
// })
// localStorage.setItem('summarylist',JSON.stringify(res.data))
// this.router.navigate([URL+"/bts"])
}
})
// // localStorage.setItem('summarylist',JSON.stringify(res.data))
// // this.router.navigate([URL+"/bts"])
// }
// })
}
})
@ -247,7 +249,9 @@ html2pdf().from(element).set(opt).save();
this.backRedireact()
}
@HostListener('window:beforeunload') goToPage() {
this.router.navigate(['/hello']);
}
image_view(image){
return this.apiUrl+'imageViewer?img_name='+image;

View File

@ -239,7 +239,7 @@
</mat-form-field>
<!-- </div> -->
<!-- <div fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="50" fxFlex.lg="50" fxFlex.xl="50" class="p-gap" fxLayoutAlign="center center"> -->
<mat-form-field style="width: 80%;display:none;">
<mat-form-field style="width: 80%; ">
<input matInput placeholder="udf3" type="text" name="udf3" formControlName="udf3" >
</mat-form-field>

View File

@ -115,7 +115,7 @@ export class CustomerInfoComponent implements OnInit {
order_id: generateRandomString(),
description: 'testing',
mode: 'TEST',
return_url: this.apiUrl+'paymentResponse',
return_url: 'http://localhost:8080/api/paymentResponse',
currency: 'INR',
country: 'IND',
udf1: ''+busId+'',
@ -351,7 +351,7 @@ export class CustomerInfoComponent implements OnInit {
}
onclickfun(){
onclickfun2(){
console.log("worked")
@ -452,6 +452,161 @@ this.paymentform = payment;
}
}
onclickfun(){
let URL = this.router.url;
let busId = localStorage.getItem('busId')
let addFormData = {
busId: busId,
cusName: this.form.value.name,
email: this.form.value.email,
address_1: this.form.value.address_line_1,
phoneNo: this.form.value.phone,
pincode: this.form.value.zip_code,
state: this.form.value.state,
city: this.form.value.city,
};
console.log(addFormData)
function generateRandomString() {
const prefix = "ORD-";
const randomNum = (Math.random() + 1).toString(36).substring(7);
return prefix + randomNum;
}
this._cus.addCusDetails(addFormData).subscribe(async (res1) => {
if (res1.status == 200) {
console.log(res1)
this.createAppointment(res1['data'].id)
}
})
}
createAppointment(cusID){
let slot_array = JSON.parse(localStorage.getItem("slotData"))
let busId = localStorage.getItem('busId')
let service = localStorage.getItem("servicedetails")
let serviceDetails = JSON.parse(service)
console.log(serviceDetails)
let URL = this.router.url;
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":cusID}
// }
let paramsmap= {
"serviceId": ""+serviceDetails.serviceId+"",
"userId": serviceDetails.userId,
"busId": serviceDetails.busId
}
console.log(paramsmap)
this._cus.CreatecusServicesMapDetails(paramsmap).subscribe(res => {
if (res.status == 200) {
console.log(res)
let serviceMap = res['data'][0].id
let time = new Date().toLocaleTimeString()
let params= {
"busId": serviceDetails.busId,
"cusId": cusID,
"appoinmentDate": slot_array[0].date,
"appoinmentTime": time,
"serviceMap": serviceMap,
"paymentStatus": 0,
"paymentMode":"online",
"createdBy":"customer",
"appoinmentSlots": JSON.stringify(slot_array[0].slots)
//"servicemap" :this.bookedAppointment_servicemap
}
this._cus.CreateAppoinmentsCus(params).subscribe(res => {
if (res.status == 200) {
console.log(res)
res = res.data;
// this.end_user.summmarylist.next(res.data)
console.log('booked2', res);
let app = {app:res,data:params}
let bookingId = res[0].bookingId
let appointmentId = res[0].id
let payment = {
api_key: '4cb964d4-9ef4-4a25-8f85-a2a13f43cbba',
hash: '',
amount: ""+this.bookedDetails.amount+"",
order_id: ''+bookingId+'',
description: 'testing',
mode: 'TEST',
return_url: 'http://localhost:8080/api/paymentResponse',
currency: 'INR',
country: 'IND',
udf1: ''+busId+'',
udf2: ''+window.location.origin+'/#'+URL+'/',
udf3: ''+cusID+'',
udf4: ''+appointmentId+'',
udf5: ''
}
this.form.patchValue(payment)
this._cus.paymentRequest(this.form.value ).subscribe(res => {
console.log(this.form.value , res)
//this._cus.addCusDetails(addFormData).subscribe(res1 => {
//if (res1.status == 200) {
// console.log(res1)
// let URL = this.router.url;
// console.log(URL)
this.form.controls['hash'].setValue(res.data)
this.testFormEl.nativeElement.submit()
})
// this.bookingSummary.appoinmentSlots =JSON.parse(this.bookingSummary.appoinmentSlots)
// this.end_user.getcusServicesMapDetails()
// let param ={id:serviceMap}
// this._cus.getcusServicesMapDetails(param).subscribe(res => {
// if (res.status == 200) {
// console.log(res)
// }
// })
}else{
return {}
}
})
}
})
}
ngOnDestroy(){
localStorage.clear();
}
}

View File

@ -87,8 +87,13 @@
</div>
</div>
</div>
<ng-scrollbar class="scrollHV" >
<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 && checkSlotDur(slot,i)==1,'clickedSlot':slotIndex == i && checkSlotDur(slot,i)==1 }" (click)="toggleActive($event,slot,i)" ><span *ngIf="checkSlotDur(slot,i)==1">{{slot | date:'shortTime'}}</span></button>
<ng-scrollbar class="scrollHV" >
<span *ngFor="let slot1 of slots;let j=index">
<!-- <button *ngFor="let slot of slot1;let i=index" mat-raised-button mat-button-sm class="mr-1 mt-1 hoverButton" [ngClass]="{'primary':slotIndex != i && checkSlotDur(slot,i)==1,'clickedSlot':slotIndex == i && checkSlotDur(slot,i)==1 }" (click)="toggleActive($event,slot,i)" ><span *ngIf="checkSlotDur(slot,i)==1">{{slot | date:'shortTime'}}</span></button> -->
<a *ngFor="let slot of slot1;let i=index">
<button *ngIf="checkSlotDur(slot,i,slot1)==1" mat-raised-button mat-button-sm class="mr-1 mt-1 hoverButton primary" [ngClass]="{'primary':slotIndex != slot ,'clickedSlot':slotIndex == slot && slots_select ==slot1 && slotIndex_group == j}" (click)="toggleActive($event,slot,i,slot1,j)" ><span >{{slot| date:'shortTime' }}</span></button>
</a>
</span>
</ng-scrollbar>

View File

@ -58,6 +58,8 @@ export class SlotBookingDetailsComponent implements OnInit {
serviceMapdetails:any =[]
advanced_slot_days: any;
logo: any;
slots_select:any=[];
slotIndex_group:any=[];
private apiUrl = environment.apiEndpoint;
constructor(private _location: Location,private router:Router,private datepipe:DatePipe,public end_user:EndUserService) {
@ -246,13 +248,16 @@ if(this.getHours.length != 0){
this.activeButton = event;
}
toggleActive(event:any,param:any,i:any){
toggleActive(event:any,param:any,i:any,slots,j){
console.log(event,param,i)
this.slot_array =[];
// debugger;
// event.preventDefault();
this.slotIndex = i
this.slotIndex = param
this.slotIndex_group = j
this.slotTime = param
this.slots_select = slots
console.log(this.date,param,this.servicesName.duration)
let thirtyMinutes = this.servicesName.duration *60000; // convert 30 minutes to milliseconds
@ -266,17 +271,17 @@ if(this.getHours.length != 0){
const rangeDate = new Date(date2);
const resultArray = this.slots.filter(slot => {
const resultArray = 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);
const filteredTimes = slots.filter(time => new Date(time) >= firstSlt && new Date(time) <= lastSlt);
console.log(resultArray,filteredTimes);
// let result = filteredTimes.pop();
console.log("hi",filteredTimes);
let result = filteredTimes.pop();
//console.log(result);
this.slots.forEach(element => {
if(element <date2){
@ -289,7 +294,7 @@ if(this.getHours.length != 0){
checkSlotDur(param:any,i:any){
checkSlotDur(param:any,i:any,slots){
//console.log(param,i)
// this.slot_array =[];
// debugger;
@ -308,14 +313,14 @@ if(this.getHours.length != 0){
const rangeDate = new Date(date2);
const resultArray = this.slots.filter(slot => {
const resultArray = 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);
const filteredTimes = slots.filter(time => new Date(time) >= firstSlt && new Date(time) <= lastSlt);
// console.log(resultArray,filteredTimes);