udpdate qs
This commit is contained in:
@@ -25,23 +25,30 @@ class Order < ApplicationRecord
|
||||
booking = nil
|
||||
|
||||
if self.new_booking
|
||||
if !self.table_id.nil?
|
||||
table_id = self.table_id
|
||||
else
|
||||
table_id = nil
|
||||
end
|
||||
#add extra time
|
||||
if self.is_extra_time && self.extra_time
|
||||
booking = Booking.create({:dining_facility_id => self.table_id,:type => "TableBooking",
|
||||
booking = Booking.create({:dining_facility_id => table_id,:type => "TableBooking",
|
||||
:checkin_at => Time.now.utc,:checkout_at => Time.now.utc + self.extra_time.to_i,
|
||||
:checkin_by => self.employee_name,
|
||||
:booking_status => "assign" })
|
||||
else
|
||||
booking = Booking.create({:dining_facility_id => self.table_id,:type => "TableBooking",
|
||||
booking = Booking.create({:dining_facility_id => table_id,:type => "TableBooking",
|
||||
:checkin_at => Time.now.utc, :checkin_by => self.employee_name,
|
||||
:booking_status => "assign" })
|
||||
end
|
||||
#end extra time
|
||||
|
||||
if !self.table_id.nil?
|
||||
table = DiningFacility.find(self.table_id)
|
||||
table.status = "occupied"
|
||||
table.save
|
||||
end
|
||||
|
||||
table = DiningFacility.find(self.table_id)
|
||||
table.status = "occupied"
|
||||
table.save
|
||||
else
|
||||
booking = Booking.find(self.booking_id)
|
||||
#add extra time
|
||||
|
||||
Reference in New Issue
Block a user