check checkin time is available or valid time
This commit is contained in:
@@ -42,6 +42,7 @@ class Api::CheckInProcessController < Api::ApiController
|
|||||||
lookup_checkout_time = Lookup.collection_of("checkout_time")
|
lookup_checkout_time = Lookup.collection_of("checkout_time")
|
||||||
|
|
||||||
if !lookup_checkout_time.empty?
|
if !lookup_checkout_time.empty?
|
||||||
|
today = Time.now.utc.getlocal
|
||||||
checkout_at = Time.now.utc.getlocal
|
checkout_at = Time.now.utc.getlocal
|
||||||
|
|
||||||
lookup_checkout_time.each do |checkout_time|
|
lookup_checkout_time.each do |checkout_time|
|
||||||
@@ -53,6 +54,7 @@ class Api::CheckInProcessController < Api::ApiController
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if checkout_at.strftime("%Y-%m-%d %H:%M%p") > today.strftime("%Y-%m-%d %H:%M%p")
|
||||||
dining_facility.status = "occupied"
|
dining_facility.status = "occupied"
|
||||||
dining_facility.save!
|
dining_facility.save!
|
||||||
|
|
||||||
@@ -70,6 +72,9 @@ class Api::CheckInProcessController < Api::ApiController
|
|||||||
else
|
else
|
||||||
render :json => { :status => true }
|
render :json => { :status => true }
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
render :json => { :status => true }
|
||||||
|
end
|
||||||
else
|
else
|
||||||
error_message = "#{dining_facility.type} is not available!"
|
error_message = "#{dining_facility.type} is not available!"
|
||||||
render :json => { :status => false, :error_message => error_message }
|
render :json => { :status => false, :error_message => error_message }
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ class Origami::CheckInProcessController < BaseOrigamiController
|
|||||||
|
|
||||||
def check_in_process
|
def check_in_process
|
||||||
lookup_checkout_time = Lookup.collection_of("checkout_time")
|
lookup_checkout_time = Lookup.collection_of("checkout_time")
|
||||||
|
today = Time.now.utc.getlocal
|
||||||
checkout_at = Time.now.utc.getlocal
|
checkout_at = Time.now.utc.getlocal
|
||||||
if !lookup_checkout_time.empty?
|
if !lookup_checkout_time.empty?
|
||||||
lookup_checkout_time.each do |checkout_time|
|
lookup_checkout_time.each do |checkout_time|
|
||||||
@@ -13,6 +14,7 @@ class Origami::CheckInProcessController < BaseOrigamiController
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if checkout_at.strftime("%Y-%m-%d %H:%M%p") > today.strftime("%Y-%m-%d %H:%M%p")
|
||||||
@dining_facility = DiningFacility.find(params[:dining_id])
|
@dining_facility = DiningFacility.find(params[:dining_id])
|
||||||
@dining_facility.status = "occupied"
|
@dining_facility.status = "occupied"
|
||||||
@dining_facility.save!
|
@dining_facility.save!
|
||||||
@@ -27,6 +29,7 @@ class Origami::CheckInProcessController < BaseOrigamiController
|
|||||||
: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 })
|
: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 })
|
||||||
@booking.save!
|
@booking.save!
|
||||||
end
|
end
|
||||||
|
end
|
||||||
respond = {:status => 'ok'}
|
respond = {:status => 'ok'}
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.json { render json: respond }
|
format.json { render json: respond }
|
||||||
|
|||||||
Reference in New Issue
Block a user