Files
sx-fc/app/controllers/origami/quick_service_controller.rb
2018-02-08 11:08:52 +06:30

70 lines
1.9 KiB
Ruby

class Origami::QuickServiceController < ApplicationController
# before_action :set_dining, only: [:detail]
def index
@menu = MenuCategory.all.active
@dining = DiningFacility.all.active
@customer = Customer.all
@tables = Table.all.active.order('status desc')
@rooms = Room.all.active.order('status desc')
# @tables = Table.all.active.order('zone_id asc').group("zone_id")
# @rooms = Room.all.active.order('zone_id asc').group("zone_id")
# @all_table = Table.all.active.order('status desc')
# @all_room = Room.all.active.order('status desc')
render "origami/addorders/detail"
end
def modify_order
@menu = MenuCategory.all.active
@table_id = params[:id]
@table = DiningFacility.find(@table_id)
@booking = @table.get_booking
if @booking
@booking_id = @booking.booking_id
@order_items = Array.new
@booking.booking_orders.each do |booking_order|
order = Order.find(booking_order.order_id)
if (order.status == "new")
@obj_order = order
@customer = order.customer
@date = order.created_at
order.order_items.each do |item|
@order_items.push(item)
end
end
end
else
@booking = nil
end
render "origami/addorders/detail"
end
def get_menu_category ()
if (params[:id])
puts params[:id]
#Pull this menu
@menu = MenuCategory.find_by_id(params[:id])
# puts @menu.menu_items[1].item_attributes.to_json
return @menu
else
MenuCategory.current_menu
end
end
def get_menu_sub_category ()
id = params[:id]
if (id)
#Pull this menu
@sub_menu = MenuCategory.where("menu_category_id = #{id}").active
# puts @menu.menu_items[1].item_attributes.to_json
return @sub_menu
end
end
def get_all_product()
@product = Product.all
end
end