merge with r-19
This commit is contained in:
@@ -71,15 +71,10 @@ class Api::OrdersController < Api::ApiController
|
||||
current_user =Employee.find(current_shift.employee_id)
|
||||
if checkin_checkout_time(params[:booking_id])
|
||||
|
||||
if params[:booking_id].present?
|
||||
booking = Booking.find(params[:booking_id])
|
||||
end
|
||||
if params[:table_id].present?
|
||||
if booking.nil? || booking.dining_facility_id.to_i != params[:table_id].to_i
|
||||
table = DiningFacility.find(params[:table_id])
|
||||
booking = table.get_current_booking
|
||||
end
|
||||
end
|
||||
table = DiningFacility.find(params[:table_id]) if params[:table_id].present?
|
||||
|
||||
booking = table.current_checkin_booking if table
|
||||
booking ||= Booking.find(params[:booking_id]) if params[:booking_id].present?
|
||||
|
||||
#for extratime
|
||||
is_extra_time = false
|
||||
@@ -102,14 +97,14 @@ class Api::OrdersController < Api::ApiController
|
||||
@order = Order.new
|
||||
@order.source = params[:order_source]
|
||||
@order.order_type = params[:order_type]
|
||||
@order.customer_id = params[:customer_id] == ""? "CUS-000000000001" : params[:customer_id] # for no customer id from mobile
|
||||
@order.customer_id = params[:customer_id].present? ? params[:customer_id] : walkin.customer_id # for no customer id from mobile
|
||||
@order.items = params[:order_items]
|
||||
@order.guest = params[:guest_info]
|
||||
@order.table_id = params[:table_id] # this is dining facilities's id
|
||||
@order.new_booking = true
|
||||
@order.waiters = current_login_employee.name
|
||||
@order.employee_name = current_login_employee.name
|
||||
@order.shop_code = @shop.shop_code
|
||||
|
||||
@order.is_extra_time = is_extra_time
|
||||
@order.extra_time = extra_time
|
||||
|
||||
@@ -122,8 +117,9 @@ class Api::OrdersController < Api::ApiController
|
||||
end
|
||||
|
||||
@status, @booking = @order.generate
|
||||
if params[:order_source] != "app"
|
||||
@order.process_order_queue(@order.order_id,@order.table_id,@order.source)
|
||||
|
||||
if @status && @booking
|
||||
Order.process_order_queue(@order.order_id,@order.table_id,@order.source)
|
||||
end
|
||||
if @order.table_id.to_i > 0
|
||||
table = DiningFacility.find(@booking.dining_facility_id)
|
||||
@@ -131,11 +127,12 @@ class Api::OrdersController < Api::ApiController
|
||||
from = getCloudDomain #get sub domain in cloud mode
|
||||
ActionCable.server.broadcast "order_channel",table: table,type:type,from:from
|
||||
end
|
||||
if current_user.role != "waiter" && params[:create_type] == "create_pay"
|
||||
if @status && @booking && (@order.source == 'quick_service') || (@order.source == 'food_court') || (@order.source == 'app')
|
||||
@status, @sale = Sale.request_bill(@order,current_user,current_user)
|
||||
end
|
||||
end
|
||||
# # for parallel order
|
||||
# remoteIP = ""
|
||||
# begin
|
||||
# @status, @booking = @order.generate
|
||||
# remoteIP = request.remote_ip
|
||||
# end while request.remote_ip != remoteIP
|
||||
else
|
||||
return return_json_status_with_code(406, "Checkout time is over!")
|
||||
end
|
||||
@@ -198,7 +195,7 @@ class Api::OrdersController < Api::ApiController
|
||||
#checked checkin and checkout time
|
||||
def checkin_checkout_time(booking_id)
|
||||
status = true
|
||||
if !booking_id.nil?
|
||||
if booking_id.present?
|
||||
if booking = Booking.find(booking_id)
|
||||
if booking.checkout_at.present?
|
||||
if booking.checkout_at.utc <= Time.now.utc
|
||||
|
||||
Reference in New Issue
Block a user