diff --git a/app/controllers/api/bookings_controller.rb b/app/controllers/api/bookings_controller.rb index 8f10655f..401cd4a8 100644 --- a/app/controllers/api/bookings_controller.rb +++ b/app/controllers/api/bookings_controller.rb @@ -1,6 +1,5 @@ class Api::BookingsController < Api::ApiController - - + skip_before_action :authenticate #Show customer by ID def index @customer = Customer.find_by(params[:id]) diff --git a/app/controllers/api/orders_controller.rb b/app/controllers/api/orders_controller.rb index 57f2e48c..be600853 100644 --- a/app/controllers/api/orders_controller.rb +++ b/app/controllers/api/orders_controller.rb @@ -7,7 +7,10 @@ class Api::OrdersController < Api::ApiController order = Order.find(params[:order_id]) order.order_items end - + def get_order + order = Order.find(params[:order_id]) + order.order_items + end # Description # This API allow new order creation diff --git a/app/controllers/crm/home_controller.rb b/app/controllers/crm/home_controller.rb index 2a7153f8..083f2bf7 100644 --- a/app/controllers/crm/home_controller.rb +++ b/app/controllers/crm/home_controller.rb @@ -1,22 +1,22 @@ class Crm::HomeController < BaseCrmController def index - # @booking = Booking.all - - @booking = Booking.select("bookings.id as booking_id, - bookings.checkin_at, - bookings.checkin_by, - bookings.dining_facility_id, - od.customer_id as customer, - od.item_count as count, - odt.id as order_item_id, - odt.item_name as item_name") - .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") - + @booking = Booking.all @customer = Customer.all + + #@booking = Booking.select("bookings.id as booking_id, + # bookings.checkin_at, + # bookings.checkin_by, + # bookings.dining_facility_id, + # od.customer_id as customer, + # od.id as order_id, + # od.item_count as count, + # odt.id as order_item_id, + # odt.item_name as item_name") + # .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 diff --git a/app/views/api/bookings/show.json.jbuilder b/app/views/api/bookings/show.json.jbuilder index d579810c..c4edb79f 100644 --- a/app/views/api/bookings/show.json.jbuilder +++ b/app/views/api/bookings/show.json.jbuilder @@ -2,6 +2,8 @@ if (@booking) json.id @booking.id json.status @booking.booking_status json.checkin_at @booking.checkin_at + json.checkin_by @booking.checkin_by + json.table_name @booking.dining_facility.name if @booking.type == "TableBooking" json.table_id @booking.dining_facility_id diff --git a/app/views/crm/home/_booking.html.erb b/app/views/crm/home/_booking.html.erb index cf983116..13702bf6 100644 --- a/app/views/crm/home/_booking.html.erb +++ b/app/views/crm/home/_booking.html.erb @@ -1,26 +1,112 @@ + -
+
+ + <% @i = 0 %> + <% @booking.each do |booking| %> + <% if booking.booking_status == "new" %> +
+
+

+ <%= @i += 1 %> . <%= booking.dining_facility.name %> + - <%= booking.id %> +

+ +

+ + Order at <%= booking.checkin_at.strftime("%H,%m") %>, <%= booking.checkin_by %> + +

+
+ +
+ <% end %> +<% end %> + +
+ \ No newline at end of file diff --git a/app/views/crm/home/_queue.html.erb b/app/views/crm/home/_queue.html.erb index 99c56f9e..45ffadda 100644 --- a/app/views/crm/home/_queue.html.erb +++ b/app/views/crm/home/_queue.html.erb @@ -1,29 +1,47 @@
-
-
-

9. Table 4 - Beef Steak [x3]

-

Well Done, Fries, Salad

-

- Order at 12:23, Kyaw Lwin | - Printed at 12:23 | - Completed at 12:43 -

+ + <% @i = 0 %> + <% @booking.each do |booking| %> + <% if booking.booking_status == "complete" %> +
+
+

+ <%= @i += 1 %> . <%= booking.dining_facility.name %> + - <%= booking.id %> +

+ +

+ + Order at <%= booking.checkin_at.strftime("%H,%m") %>, <%= booking.checkin_by %> + +

+
+ +
+ <% end %> + <% end %> + +
+
+

9. Table 4 - Beef Steak [x3]

+

Well Done, Fries, Salad

+

+ Order at 12:23, Kyaw Lwin | + Printed at 12:23 | + Completed at 12:43 +

+
+
+ -
-
-
-
-

9. Table 4 - Beef Steak [x3]

-

Well Done, Fries, Salad

-

Order at 12:23, Kyaw Lwin

-
-
-
-
-

9. Table 4 - Beef Steak [x3]

-

Well Done, Fries, Salad

-

Order at 12:23, Kyaw Lwin

-
-
-
\ No newline at end of file +
\ No newline at end of file diff --git a/app/views/crm/home/index.html.erb b/app/views/crm/home/index.html.erb index 07e58652..431ef4a4 100644 --- a/app/views/crm/home/index.html.erb +++ b/app/views/crm/home/index.html.erb @@ -5,10 +5,10 @@