in frontend/src/app/customer/checkout-page/checkout-page.component.ts [173:212]
continuePurchase() {
let today = new Date();
let latest_date = this.datepipe.transform(this.purchaseStartDate, 'YYYY-MM-dd');
latest_date = latest_date + " " + this.defaultPickUpTime
let obj = {}
if (this.isHomeDelivery) {
obj = {
"order_date": this.datepipe.transform(today, 'YYYY-MM-dd'),
"order_status": "Initiated",
"order_items": this.products,
"user_id": this.userId,
"email": this.userEmail,
"total_amount": this.totalPrice,
"is_delivery": this.isHomeDelivery,
"is_pickup": false,
"pickup_datetime": ""
}
} else {
obj = {
"order_date": this.datepipe.transform(today, 'YYYY-MM-dd'),
"order_status": "Initiated",
"order_items": this.products,
"user_id": this.userId,
"email": this.userEmail,
"total_amount": this.totalPrice,
"is_delivery": false,
"is_pickup": this.pickUpInStore,
"pickup_datetime": latest_date
}
}
this.recommendationsService.addOrder(obj).subscribe((res: any) => {
this.orderId = res
this.products = [];
this.totalPrice = 0
this.emptyProducts.emit(this.products);
this.showOrderSuccess = true;
this.showSnackbar("Order placed", 'Close', '4000')
})
}