dashboard ui and checkin checkout process

This commit is contained in:
phyusin
2017-11-16 18:17:40 +06:30
parent 37b509474f
commit d648bbf100
13 changed files with 555 additions and 87 deletions

View File

@@ -32,7 +32,7 @@ class DiningFacility < ApplicationRecord
end
def get_current_booking
booking = Booking.where("dining_facility_id = #{self.id} and booking_status ='assign' and checkin_at between '#{DateTime.now.utc - 5.hours}' and '#{DateTime.now.utc}' and checkout_at is null").limit(1)
booking = Booking.where("dining_facility_id = #{self.id} and booking_status ='assign' and checkin_at between '#{DateTime.now.utc - 5.hours}' and '#{DateTime.now.utc}'").limit(1) #and checkout_at is null
if booking.count > 0 then
return booking[0]
else
@@ -65,4 +65,32 @@ class DiningFacility < ApplicationRecord
return nil
end
end
def get_current_checkout_booking
booking = Booking.where("dining_facility_id = #{self.id} and booking_status ='assign' and sale_id is null and checkout_at is not null and checkout_by is null").limit(1)
if booking.count > 0 then
return booking[0]
else
return nil
end
end
def get_checkout_booking
booking = self.get_current_checkout_booking
if booking
now = Time.now.utc
hr = (now.strftime("%H").to_i).to_int
min = (now.strftime("%M").to_i).to_int
checkout_at = booking.checkout_at.utc
checkout_at = checkout_at - hr.hour
checkout_at = checkout_at - min.minutes
checkout_at = checkout_at.utc.strftime("%M").to_i
if checkout_at <= 15
return booking
end
end
end
end