class Origami::RoomsController < BaseOrigamiController

  def show
    @tables = Table.all.active.order('status desc')
    @rooms = Room.all.active.order('status desc')
    @complete = Sale.all
    @orders = Order.all.order('date desc')
    @room = DiningFacility.find(params[:room_id])
    @room.bookings.each do |booking|
         if booking.sale_id.nil?
           @order_items = Array.new
           
           booking.booking_orders.each do |booking_order|
              order = Order.find(booking_order.order_id)
              @obj = order
              @customer = order.customer
              order.order_items.each do |item|
                @order_items.push(item)
              end
           end
           @status = 'order'
         else

          sale = Sale.find(booking.sale_id)
           if sale.sale_status != "completed"
             @status = 'sale'
             @obj = sale
             @customer = sale.customer
           end
         end
    end
  end


end
