dashboard ui and checkin checkout process
This commit is contained in:
38
app/controllers/origami/check_in_process_controller.rb
Normal file
38
app/controllers/origami/check_in_process_controller.rb
Normal 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
|
||||
@@ -7,7 +7,7 @@ class Origami::HomeController < BaseOrigamiController
|
||||
@complete = Sale.where("DATE_FORMAT(created_at,'%Y-%m-%d') = ? and sale_status != 'new'",DateTime.now.strftime('%Y-%m-%d'))
|
||||
@orders = Order.all.order('date desc')
|
||||
@shop = Shop.find_by_id(1)
|
||||
|
||||
|
||||
# @shift = ShiftSale.current_open_shift(current_user.id)
|
||||
end
|
||||
|
||||
@@ -23,10 +23,12 @@ class Origami::HomeController < BaseOrigamiController
|
||||
@sale_array = Array.new
|
||||
|
||||
@dining.bookings.active.each do |booking|
|
||||
if booking.sale_id.nil? && booking.booking_status != 'moved'
|
||||
|
||||
@order_items = Array.new
|
||||
booking.booking_orders.each do |booking_order|
|
||||
if booking.sale_id.nil? && booking.booking_status != 'moved'
|
||||
@order_items = Array.new
|
||||
if booking.booking_orders.empty?
|
||||
@booking = booking
|
||||
else
|
||||
booking.booking_orders.each do |booking_order|
|
||||
order = Order.find(booking_order.order_id)
|
||||
if (order.status == "new")
|
||||
@obj_order = order
|
||||
@@ -43,29 +45,30 @@ class Origami::HomeController < BaseOrigamiController
|
||||
@account_arr.push(account)
|
||||
end
|
||||
end
|
||||
end
|
||||
@status_order = 'order'
|
||||
else
|
||||
sale = Sale.find(booking.sale_id)
|
||||
if sale.sale_status != "completed" && sale.sale_status != 'void'
|
||||
|
||||
@sale_array.push(sale)
|
||||
if @status_order == 'order'
|
||||
@status_order = 'sale'
|
||||
end
|
||||
@booking= booking
|
||||
@date = sale.created_at
|
||||
@status_sale = 'sale'
|
||||
@obj_sale = sale
|
||||
@customer = sale.customer
|
||||
accounts = @customer.tax_profiles
|
||||
@account_arr =[]
|
||||
accounts.each do |acc|
|
||||
account = TaxProfile.find(acc)
|
||||
@account_arr.push(account)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@status_order = 'order'
|
||||
else
|
||||
sale = Sale.find(booking.sale_id)
|
||||
if sale.sale_status != "completed" && sale.sale_status != 'void'
|
||||
|
||||
@sale_array.push(sale)
|
||||
if @status_order == 'order'
|
||||
@status_order = 'sale'
|
||||
end
|
||||
@booking= booking
|
||||
@date = sale.created_at
|
||||
@status_sale = 'sale'
|
||||
@obj_sale = sale
|
||||
@customer = sale.customer
|
||||
accounts = @customer.tax_profiles
|
||||
@account_arr =[]
|
||||
accounts.each do |acc|
|
||||
account = TaxProfile.find(acc)
|
||||
@account_arr.push(account)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user