change booking model generate

This commit is contained in:
phyusin
2018-06-22 15:50:43 +06:30
parent 703c4de50e
commit 8ee9434032
3 changed files with 13 additions and 13 deletions

View File

@@ -64,13 +64,13 @@ class Api::CheckInProcessController < Api::ApiController
end
if checkout_at.strftime("%Y-%m-%d %H:%M%p") > today.strftime("%Y-%m-%d %H:%M%p")
if dining_facility.type == "Table"
type = "TableBooking"
else
type = "RoomBooking"
end
# if dining_facility.type == "Table"
# type = "TableBooking"
# else
# type = "RoomBooking"
# end
booking = Booking.create({:dining_facility_id => params[:dining_id],:type => type,
booking = Booking.create({:dining_facility_id => params[:dining_id],:type => "TableBooking",
: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 })
if booking.save!
dining_facility.status = "occupied"

View File

@@ -17,13 +17,13 @@ class Origami::CheckInProcessController < BaseOrigamiController
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])
if @dining_facility.type == "Table"
type = "TableBooking"
else
type = "RoomBooking"
end
# if @dining_facility.type == "Table"
# type = "TableBooking"
# else
# type = "RoomBooking"
# end
@booking = Booking.create({:dining_facility_id => params[:dining_id],:type => type,
@booking = Booking.create({:dining_facility_id => params[:dining_id],:type => "TableBooking",
: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 })
if @booking.save!

View File

@@ -60,6 +60,6 @@ class Booking < ApplicationRecord
private
def generate_custom_id
self.booking_id = SeedGenerator.generate_id("Booking", "BKI") #(self.class.name, "BKI")
self.booking_id = SeedGenerator.generate_id(self.class.name, "BKI")
end
end