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

@@ -0,0 +1,38 @@
class Origami::CheckInProcessController < BaseOrigamiController
def check_in_process
dining_charge = DiningCharge.select('charge_type','charge_block')
.where('dining_facility_id = ?',params[:dining_id])
.first()
checkout_at = Time.now.utc
if !dining_charge.nil?
hr = (dining_charge.charge_block.utc.strftime("%H").to_i).to_int
min = (dining_charge.charge_block.utc.strftime("%M").to_i).to_int
# if dining_charge.charge_type == 'hr'
checkout_at = checkout_at + hr.hour + min.minutes
# else
# end
end
@dining_facility = DiningFacility.find(params[:dining_id])
@dining_facility.status = "occupied"
@dining_facility.save!
if @dining_facility.type == "Table"
type = "TableBooking"
else
type = "RoomBooking"
end
@booking = Booking.create({:dining_facility_id => params[:dining_id],:type => type,
:checkin_at => Time.now.utc,:checkout_at =>checkout_at, :booking_status => "assign" })
@booking.save!
respond = {:status => 'ok'}
respond_to do |format|
format.json { render json: respond }
end
end
end