update api/resturant/menu
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
class Api::CheckInProcessController < Api::ApiController
|
||||
# before_action :authenticate
|
||||
def check_in_time
|
||||
if params[:dining_id]
|
||||
dining_facility = DiningFacility.find(params[:dining_id])
|
||||
if params[:dining_id]
|
||||
dining_facility = DiningFacility.find(params[:dining_id])
|
||||
if params[:booking_id]
|
||||
data = Booking.where("dining_facility_id = #{params[:dining_id]} AND booking_id = '#{params[:booking_id]}'")
|
||||
if data.count > 0
|
||||
@@ -10,7 +10,7 @@ class Api::CheckInProcessController < Api::ApiController
|
||||
else
|
||||
booking = nil
|
||||
end
|
||||
else
|
||||
else
|
||||
booking = dining_facility.get_current_booking
|
||||
end
|
||||
if !booking.nil?
|
||||
@@ -21,7 +21,7 @@ class Api::CheckInProcessController < Api::ApiController
|
||||
#Send to background job for processing
|
||||
if ENV["SERVER_MODE"] == 'cloud'
|
||||
from = request.subdomain + "." + request.domain
|
||||
else
|
||||
else
|
||||
from = ""
|
||||
end
|
||||
ActionCable.server.broadcast "check_in_booking_channel",table: table,from:from
|
||||
@@ -37,7 +37,7 @@ class Api::CheckInProcessController < Api::ApiController
|
||||
end
|
||||
|
||||
lookup_checkout_time = Lookup.collection_of("checkout_alert_time")
|
||||
|
||||
|
||||
if !lookup_checkout_time.empty?
|
||||
now = Time.now.utc
|
||||
lookup_checkout_time.each do |checkout_time|
|
||||
@@ -52,16 +52,18 @@ class Api::CheckInProcessController < Api::ApiController
|
||||
else
|
||||
render :json => { :status => true }
|
||||
end
|
||||
|
||||
else
|
||||
|
||||
else
|
||||
render :json => { :status => false, :error_message => "No current booking!" }
|
||||
end
|
||||
else
|
||||
render :json => { :status => false }
|
||||
end
|
||||
end
|
||||
|
||||
def check_in_process
|
||||
if params[:dining_id]
|
||||
dining_facility = DiningFacility.find(params[:dining_id])
|
||||
dining_facility = DiningFacility.find(params[:dining_id])
|
||||
if dining_facility.is_active && dining_facility.status == "available"
|
||||
if params[:checkin_time]
|
||||
checkin_at = nil
|
||||
@@ -75,7 +77,7 @@ class Api::CheckInProcessController < Api::ApiController
|
||||
if dining_facility.check_time(checkin_at, "checkin")
|
||||
booking = dining_facility.get_current_booking
|
||||
if booking.nil?
|
||||
|
||||
|
||||
booking = Booking.create({:dining_facility_id => params[:dining_id],:type => "TableBooking",
|
||||
:checkin_by=>current_login_employee.name,:checkin_at => checkin_at,:checkout_at =>nil, :booking_status => "assign", :reserved_at => nil, :reserved_by => nil })
|
||||
if booking.save!
|
||||
@@ -98,7 +100,7 @@ class Api::CheckInProcessController < Api::ApiController
|
||||
booking = dining_facility.get_current_checkout_booking
|
||||
if booking.nil?
|
||||
lookup_checkout_time = Lookup.collection_of("checkout_time")
|
||||
|
||||
|
||||
if !lookup_checkout_time.empty?
|
||||
today = Time.now.utc.getlocal
|
||||
checkout_at = Time.now.utc.getlocal
|
||||
@@ -118,7 +120,7 @@ class Api::CheckInProcessController < Api::ApiController
|
||||
# else
|
||||
# type = "RoomBooking"
|
||||
# end
|
||||
|
||||
|
||||
booking = Booking.create({:dining_facility_id => params[:dining_id],:type => "TableBooking",
|
||||
:checkin_by=>current_login_employee.name,:checkin_at => Time.now.utc,:checkout_at =>checkout_at, :booking_status => "assign", :reserved_at => checkout_at, :reserved_by => current_login_employee.name })
|
||||
if booking.save!
|
||||
@@ -133,13 +135,13 @@ class Api::CheckInProcessController < Api::ApiController
|
||||
unique_code = "CheckInOutPdf"
|
||||
printer = PrintSetting.find_by_unique_code(unique_code)
|
||||
|
||||
# print when complete click
|
||||
# print when complete click
|
||||
order_queue_printer = Printer::OrderQueuePrinter.new(printer)
|
||||
|
||||
if !printer.nil?
|
||||
order_queue_printer.print_check_in_out(printer, cashier_terminal, booking, dining_facility)
|
||||
end
|
||||
end
|
||||
end
|
||||
render :json => { :status => true, :booking_id => booking.booking_id, :checkout_at => booking.checkout_at.utc.getlocal.strftime("%Y-%m-%d %H:%M") }
|
||||
else
|
||||
render :json => { :status => true }
|
||||
@@ -176,7 +178,7 @@ class Api::CheckInProcessController < Api::ApiController
|
||||
booking.save!
|
||||
|
||||
render :json => { :status => true, :checkout_at => booking.checkout_at.utc.getlocal.strftime("%Y-%m-%d %H:%M") }
|
||||
elsif !params[:booking_id].nil? && params[:time].nil?
|
||||
elsif !params[:booking_id].nil? && params[:time].nil?
|
||||
error_message = "time is required!"
|
||||
render :json => { :status => false, :error_message => error_message }
|
||||
elsif params[:booking_id].nil? && !params[:time].nil?
|
||||
|
||||
Reference in New Issue
Block a user