Merge branch 'adminbsb_ui_changes' of bitbucket.org:code2lab/sxrestaurant

This commit is contained in:
Yan
2017-12-07 16:38:17 +06:30
3 changed files with 6 additions and 7 deletions

View File

@@ -51,7 +51,7 @@ class Api::CheckInProcessController < Api::ApiController
end end
booking = Booking.create({:dining_facility_id => params[:dining_id],:type => type, booking = Booking.create({:dining_facility_id => params[:dining_id],:type => type,
:checkin_at => Time.now.utc,:checkout_at =>checkout_at, :booking_status => "assign" }) :checkin_by=>get_cashier[0].name,:checkin_at => Time.now.utc,:checkout_at =>checkout_at, :booking_status => "assign" })
booking.save! booking.save!
render :json => { :status => true, :checkout_at => booking.checkout_at.utc.strftime("%Y-%m-%d %H:%M") } render :json => { :status => true, :checkout_at => booking.checkout_at.utc.strftime("%Y-%m-%d %H:%M") }

View File

@@ -27,7 +27,7 @@ class Origami::CheckInProcessController < BaseOrigamiController
end end
@booking = Booking.create({:dining_facility_id => params[:dining_id],:type => type, @booking = Booking.create({:dining_facility_id => params[:dining_id],:type => type,
:checkin_at => Time.now.utc,:checkout_at =>checkout_at, :booking_status => "assign" }) :checkin_by=>current_login_employee.name,:checkin_at => Time.now.utc,:checkout_at =>checkout_at, :booking_status => "assign" })
@booking.save! @booking.save!
respond = {:status => 'ok'} respond = {:status => 'ok'}

View File

@@ -67,7 +67,7 @@ class DiningFacility < ApplicationRecord
end end
def get_current_checkout_booking def get_current_checkout_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 checkin_by 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)
if booking.count > 0 then if booking.count > 0 then
return booking[0] return booking[0]
else else
@@ -85,8 +85,7 @@ class DiningFacility < ApplicationRecord
checkout_at_hr = (checkout_at.utc.strftime("%H").to_i).to_int checkout_at_hr = (checkout_at.utc.strftime("%H").to_i).to_int
checkout_at_min = (checkout_at.utc.strftime("%M").to_i).to_int checkout_at_min = (checkout_at.utc.strftime("%M").to_i).to_int
checkout_at_min -= min checkout_at_min -= min
if (checkout_at_hr <= hr) && (checkout_at_min <= 15)
if checkout_at_min <= 15
return booking return booking
end end
end end