update rome check all fun

This commit is contained in:
Aung Myo
2017-08-03 11:22:23 +06:30
parent 3bbf60b3ef
commit 39a314bc9a
3 changed files with 112 additions and 56 deletions

View File

@@ -35,5 +35,20 @@ class Origami::MoveroomController < BaseOrigamiController
end
end
end
def moving
change_to = params[:change_to] #new
change_from = params[:change_from] #original
bookings = Booking.where('dining_facility_id=?',change_from)
booking_array = Array.new
bookings.each do | booking |
if booking.sale_id.nil? && booking.booking_status != 'moved'
booking_array.push(booking)
end
end
@get_type = Booking.update_dining_facility(booking_array,change_to,change_from)
end
end

View File

@@ -1,36 +1,77 @@
class Origami::RoomsController < BaseOrigamiController
def index
@tables = Table.all.active.order('status desc')
@rooms = Room.all.active.order('status desc')
@complete = Sale.where("sale_status != 'new'")
@orders = Order.all.order('date desc')
# @shift = ShiftSale.current_open_shift(current_user.id)
end
def show
@tables = Table.all.active.order('status desc')
@rooms = Room.all.active.order('status desc')
@complete = Sale.where("sale_status != 'new'")
@orders = Order.all.order('date desc')
@room = DiningFacility.find(params[:room_id])
@status = ""
@sale_array = Array.new
@room.bookings.each do |booking|
if booking.sale_id.nil?
@room.bookings.active.each do |booking|
if booking.sale_id.nil? && booking.booking_status != 'moved'
@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)
if (order.status == "new")
@obj = order
@customer = order.customer
@date = order.created_at
order.order_items.each do |item|
@order_items.push(item)
end
end
end
@status = 'order'
else
sale = Sale.find(booking.sale_id)
if sale.sale_status != "completed"
@sale_array.push(sale)
if sale.sale_status != "completed" && sale.sale_status != 'void'
@sale_array.push(sale)
if @status == 'order'
@status = 'sale'
end
@date = sale.created_at
@status = 'sale'
@obj = sale
@customer = sale.customer
end
end
end
end
# @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"
# @sale_array.push(sale)
# @status = 'sale'
# @obj = sale
# @customer = sale.customer
# end
# end
# end
end