still dev to respond code for order

This commit is contained in:
Yan
2017-06-28 16:17:56 +06:30
parent 5ff75fad7d
commit d35aa23e34

View File

@@ -67,13 +67,19 @@ class Api::OrdersController < Api::ApiController
if booking if booking
if booking.dining_facility_id.to_i == params[:table_id].to_i && booking.booking_status != 'moved' if booking.dining_facility_id.to_i == params[:table_id].to_i && booking.booking_status != 'moved'
if !booking.sale_id.nil? if !booking.sale_id.nil?
check_order_with_booking(booking) sale_status = check_order_with_booking(booking)
if sale_status
return false
end
else else
@order.new_booking = false @order.new_booking = false
@order.booking_id = params[:booking_id] @order.booking_id = params[:booking_id]
end end
else else
check_order_with_table(params[:table_id]) sale_status = check_order_with_table(params[:table_id])
if sale_status
return false
end
end end
end #booking exists end #booking exists
else else
@@ -90,9 +96,11 @@ class Api::OrdersController < Api::ApiController
if booking if booking
if booking.sale.sale_status == "completed" || booking.sale.sale_status == "billed" if booking.sale.sale_status == "completed" || booking.sale.sale_status == "billed"
@order.new_booking = true @order.new_booking = true
return true
else else
@order.new_booking = false @order.new_booking = false
@order.booking_id = booking.booking_id @order.booking_id = booking.booking_id
return false
end end
end end
end end
@@ -101,9 +109,11 @@ class Api::OrdersController < Api::ApiController
def check_order_with_booking(booking) def check_order_with_booking(booking)
if booking.sale.sale_status == "completed" || booking.sale.sale_status == "billed" if booking.sale.sale_status == "completed" || booking.sale.sale_status == "billed"
@order.new_booking = true @order.new_booking = true
return true
else else
@order.new_booking = false @order.new_booking = false
@order.booking_id = params[:booking_id] @order.booking_id = params[:booking_id]
return false
end end
end end
# Description # Description