add new check-in route
This commit is contained in:
@@ -3,7 +3,16 @@ class Api::CheckInProcessController < Api::ApiController
|
|||||||
def check_in_time
|
def check_in_time
|
||||||
if params[:dining_id]
|
if params[:dining_id]
|
||||||
dining_facility = DiningFacility.find(params[:dining_id])
|
dining_facility = DiningFacility.find(params[:dining_id])
|
||||||
booking = dining_facility.get_current_checkout_booking
|
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?
|
if !booking.nil?
|
||||||
|
|
||||||
# DiningFacility.check_in_booking(params[:dining_id])
|
# DiningFacility.check_in_booking(params[:dining_id])
|
||||||
@@ -12,18 +21,23 @@ class Api::CheckInProcessController < Api::ApiController
|
|||||||
#Send to background job for processing
|
#Send to background job for processing
|
||||||
if ENV["SERVER_MODE"] == 'cloud'
|
if ENV["SERVER_MODE"] == 'cloud'
|
||||||
from = request.subdomain + "." + request.domain
|
from = request.subdomain + "." + request.domain
|
||||||
else
|
else
|
||||||
from = ""
|
from = ""
|
||||||
end
|
end
|
||||||
ActionCable.server.broadcast "check_in_booking_channel",table: table,from:from
|
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_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")
|
if booking.checkout_at
|
||||||
|
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.reserved_at
|
||||||
|
extra_minutes = (booking.checkout_at - booking.reserved_at) / 1.minutes
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
lookup_checkout_time = Lookup.collection_of("checkout_alert_time")
|
lookup_checkout_time = Lookup.collection_of("checkout_alert_time")
|
||||||
alert_time_min = 0
|
|
||||||
if !lookup_checkout_time.empty?
|
if !lookup_checkout_time.empty?
|
||||||
now = Time.now.utc
|
now = Time.now.utc
|
||||||
lookup_checkout_time.each do |checkout_time|
|
lookup_checkout_time.each do |checkout_time|
|
||||||
@@ -38,6 +52,7 @@ class Api::CheckInProcessController < Api::ApiController
|
|||||||
else
|
else
|
||||||
render :json => { :status => true }
|
render :json => { :status => true }
|
||||||
end
|
end
|
||||||
|
|
||||||
else
|
else
|
||||||
render :json => { :status => false, :error_message => "No current booking!" }
|
render :json => { :status => false, :error_message => "No current booking!" }
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -77,6 +77,7 @@ scope "(:locale)", locale: /en|mm/ do
|
|||||||
|
|
||||||
namespace :origami do
|
namespace :origami do
|
||||||
get "check_in/:dining_id" => "check_in_process#check_in_time"
|
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 "check_in" => "check_in_process#check_in_process"
|
||||||
post "request_time" => "check_in_process#request_time"
|
post "request_time" => "check_in_process#request_time"
|
||||||
post "call_waiter" => "call_waiters#index"
|
post "call_waiter" => "call_waiters#index"
|
||||||
|
|||||||
Reference in New Issue
Block a user