add new check-in route
This commit is contained in:
@@ -2,8 +2,17 @@ class Api::CheckInProcessController < Api::ApiController
|
||||
# before_action :authenticate
|
||||
def check_in_time
|
||||
if params[:dining_id]
|
||||
dining_facility = DiningFacility.find(params[:dining_id])
|
||||
booking = dining_facility.get_current_checkout_booking
|
||||
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
|
||||
booking = data[0]
|
||||
else
|
||||
booking = nil
|
||||
end
|
||||
else
|
||||
booking = dining_facility.get_current_checkout_booking
|
||||
end
|
||||
if !booking.nil?
|
||||
|
||||
# DiningFacility.check_in_booking(params[:dining_id])
|
||||
@@ -12,18 +21,23 @@ 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
|
||||
end
|
||||
ActionCable.server.broadcast "check_in_booking_channel",table: table,from:from
|
||||
|
||||
check_out_time = nil
|
||||
extra_minutes = nil
|
||||
alert_time_min = 0
|
||||
check_in_time = booking.checkin_at.utc.getlocal.strftime("%Y-%m-%d %H:%M")
|
||||
check_out_time = booking.checkout_at.utc.getlocal.strftime("%Y-%m-%d %H:%M")
|
||||
|
||||
extra_minutes = (booking.checkout_at - booking.reserved_at) / 1.minutes
|
||||
if booking.checkout_at
|
||||
check_out_time = booking.checkout_at.utc.getlocal.strftime("%Y-%m-%d %H:%M")
|
||||
if booking.reserved_at
|
||||
extra_minutes = (booking.checkout_at - booking.reserved_at) / 1.minutes
|
||||
end
|
||||
end
|
||||
|
||||
lookup_checkout_time = Lookup.collection_of("checkout_alert_time")
|
||||
alert_time_min = 0
|
||||
|
||||
if !lookup_checkout_time.empty?
|
||||
now = Time.now.utc
|
||||
lookup_checkout_time.each do |checkout_time|
|
||||
@@ -38,6 +52,7 @@ class Api::CheckInProcessController < Api::ApiController
|
||||
else
|
||||
render :json => { :status => true }
|
||||
end
|
||||
|
||||
else
|
||||
render :json => { :status => false, :error_message => "No current booking!" }
|
||||
end
|
||||
|
||||
@@ -77,6 +77,7 @@ scope "(:locale)", locale: /en|mm/ do
|
||||
|
||||
namespace :origami do
|
||||
get "check_in/:dining_id" => "check_in_process#check_in_time"
|
||||
get "check_in_time/:dining_id/:booking_id" => "check_in_process#check_in_time"
|
||||
post "check_in" => "check_in_process#check_in_process"
|
||||
post "request_time" => "check_in_process#request_time"
|
||||
post "call_waiter" => "call_waiters#index"
|
||||
|
||||
Reference in New Issue
Block a user