app order with order

This commit is contained in:
Myat Zin Wai Maw
2019-12-04 16:18:06 +06:30
parent f404328089
commit 7a4db5e0f4
5 changed files with 46 additions and 44 deletions

View File

@@ -62,18 +62,19 @@ class Foodcourt::OrdersController < BaseFoodcourtController
.where("orders.source='app' and bookings.booking_id='#{params[:booking_id]}'").first
@customer_id =@booking.customer_id
@booking_id =@booking.booking_id
@order_id =@booking.order_id
end
@bookings = Booking.select("bookings.*,customers.*")
.joins(" JOIN booking_orders ON booking_orders.booking_id=bookings.booking_id")
.joins("JOIN orders ON orders.order_id=booking_orders.order_id")
.joins("JOIN order_items ON orders.order_id=order_items.order_id")
.joins("JOIN customers ON orders.customer_id=customers.customer_id")
.where("orders.source='app' and DATE(bookings.created_at) = '#{Date.today}'").order("bookings.created_at desc").uniq
.where("orders.source='app' and DATE(bookings.created_at) = '#{Date.today}' and bookings.shop_code='#{Shop.current_shop.shop_code}'").order("bookings.created_at desc").uniq
end
def completed
customer =Customer.find_by_customer_id(params[:customer_id])
phone_number =customer.contact_no
if Order.send_message(phone_number,params[:booking_id])
if Order.send_message(phone_number,params[:order_id])
booking =Booking.find(params[:booking_id])
booking.booking_status ='completed'
booking.save!