diff --git a/app/controllers/crm/home_controller.rb b/app/controllers/crm/home_controller.rb index ec2091b3..6c0671c3 100644 --- a/app/controllers/crm/home_controller.rb +++ b/app/controllers/crm/home_controller.rb @@ -1,6 +1,17 @@ class Crm::HomeController < BaseCrmController def index - @bookings = Booking.all + + @booking = Booking.select("bookings.id as booking_id, + bookings.checkin_at, + od.customer_id as customer, + odt.id") + .joins("join booking_orders as bko ON bko.booking_id = bookings.id") + .joins("right join orders as od ON od.id = bko.order_id") + .joins("right join order_items as odt ON odt.order_id=od.id") + .order("bookings.id DESC") + + + end def show end diff --git a/app/views/crm/home/index.html.erb b/app/views/crm/home/index.html.erb index 49107c10..8a115f49 100644 --- a/app/views/crm/home/index.html.erb +++ b/app/views/crm/home/index.html.erb @@ -54,15 +54,20 @@
fries, Salad
+fries, Salad + asdf +
- Order at <%= booking.created_at.strftime("%H:%M") %>, - <%= booking.checkin_by %> + adf
Well Done, Fries, Salad
+Order at 12:23, Kyaw Lwin
+