check void for table status update
This commit is contained in:
@@ -38,11 +38,11 @@ class ApplicationController < ActionController::Base
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
# check for license file
|
# check for license file
|
||||||
if check_license
|
# if check_license
|
||||||
current_license(ENV["SX_PROVISION_URL"])
|
# current_license(ENV["SX_PROVISION_URL"])
|
||||||
else
|
# else
|
||||||
redirect_to activate_path
|
# redirect_to activate_path
|
||||||
end
|
# end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -27,9 +27,9 @@ class Origami::HomeController < BaseOrigamiController
|
|||||||
@membership = MembershipSetting::MembershipSetting
|
@membership = MembershipSetting::MembershipSetting
|
||||||
@payment_methods = PaymentMethodSetting.all
|
@payment_methods = PaymentMethodSetting.all
|
||||||
|
|
||||||
@order_items_count = Hash.new
|
|
||||||
bookings = Booking.all
|
bookings = Booking.all
|
||||||
if !bookings.nil?
|
if !bookings.nil?
|
||||||
|
@order_items_count = Hash.new
|
||||||
bookings.each do |booking|
|
bookings.each do |booking|
|
||||||
if booking.sale_id.nil? && booking.booking_status != 'moved'
|
if booking.sale_id.nil? && booking.booking_status != 'moved'
|
||||||
if !booking.booking_orders.empty?
|
if !booking.booking_orders.empty?
|
||||||
@@ -51,7 +51,7 @@ class Origami::HomeController < BaseOrigamiController
|
|||||||
if !@order_items_count.key?(booking.dining_facility_id)
|
if !@order_items_count.key?(booking.dining_facility_id)
|
||||||
@order_items_count.store(booking.dining_facility_id, sale.sale_items.count)
|
@order_items_count.store(booking.dining_facility_id, sale.sale_items.count)
|
||||||
else
|
else
|
||||||
@order_items_count[booking.dining_facility_id] += sale.sale_items.count
|
@order_items_count[booking.dining_facility_id] = sale.sale_items.count
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -59,6 +59,9 @@ class Origami::HomeController < BaseOrigamiController
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
puts "@order_items_count"
|
||||||
|
puts @order_items_count.to_json
|
||||||
|
|
||||||
@dining.bookings.active.each do |booking|
|
@dining.bookings.active.each do |booking|
|
||||||
if booking.sale_id.nil? && booking.booking_status != 'moved'
|
if booking.sale_id.nil? && booking.booking_status != 'moved'
|
||||||
@order_items = Array.new
|
@order_items = Array.new
|
||||||
|
|||||||
@@ -13,9 +13,9 @@ class Origami::OrdersController < BaseOrigamiController
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@order_items_count = Hash.new
|
|
||||||
bookings = Booking.all
|
bookings = Booking.all
|
||||||
if !bookings.nil?
|
if !bookings.nil?
|
||||||
|
@order_items_count = Hash.new
|
||||||
bookings.each do |booking|
|
bookings.each do |booking|
|
||||||
if booking.sale_id.nil? && booking.booking_status != 'moved'
|
if booking.sale_id.nil? && booking.booking_status != 'moved'
|
||||||
if !booking.booking_orders.empty?
|
if !booking.booking_orders.empty?
|
||||||
@@ -37,7 +37,7 @@ class Origami::OrdersController < BaseOrigamiController
|
|||||||
if !@order_items_count.key?(booking.dining_facility_id)
|
if !@order_items_count.key?(booking.dining_facility_id)
|
||||||
@order_items_count.store(booking.dining_facility_id, sale.sale_items.count)
|
@order_items_count.store(booking.dining_facility_id, sale.sale_items.count)
|
||||||
else
|
else
|
||||||
@order_items_count[booking.dining_facility_id] += sale.sale_items.count
|
@order_items_count[booking.dining_facility_id] = sale.sale_items.count
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -23,9 +23,9 @@ class Origami::RoomsController < BaseOrigamiController
|
|||||||
@membership = MembershipSetting::MembershipSetting
|
@membership = MembershipSetting::MembershipSetting
|
||||||
@payment_methods = PaymentMethodSetting.all
|
@payment_methods = PaymentMethodSetting.all
|
||||||
|
|
||||||
@order_items_count = Hash.new
|
|
||||||
bookings = Booking.all
|
bookings = Booking.all
|
||||||
if !bookings.nil?
|
if !bookings.nil?
|
||||||
|
@order_items_count = Hash.new
|
||||||
bookings.each do |booking|
|
bookings.each do |booking|
|
||||||
if booking.sale_id.nil? && booking.booking_status != 'moved'
|
if booking.sale_id.nil? && booking.booking_status != 'moved'
|
||||||
if !booking.booking_orders.empty?
|
if !booking.booking_orders.empty?
|
||||||
@@ -47,7 +47,7 @@ class Origami::RoomsController < BaseOrigamiController
|
|||||||
if !@order_items_count.key?(booking.dining_facility_id)
|
if !@order_items_count.key?(booking.dining_facility_id)
|
||||||
@order_items_count.store(booking.dining_facility_id, sale.sale_items.count)
|
@order_items_count.store(booking.dining_facility_id, sale.sale_items.count)
|
||||||
else
|
else
|
||||||
@order_items_count[booking.dining_facility_id] += sale.sale_items.count
|
@order_items_count[booking.dining_facility_id] = sale.sale_items.count
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -40,16 +40,25 @@ class Origami::VoidController < BaseOrigamiController
|
|||||||
# end
|
# end
|
||||||
|
|
||||||
table_avaliable = true
|
table_avaliable = true
|
||||||
|
table_count = 0
|
||||||
table = sale.bookings[0].dining_facility
|
table = sale.bookings[0].dining_facility
|
||||||
table.bookings.each do |booking|
|
table.bookings.each do |booking|
|
||||||
if !booking.sale.nil?
|
if booking.booking_status != 'moved'
|
||||||
if booking.sale.sale_status == 'new'
|
if booking.sale_id
|
||||||
|
if booking.sale.sale_status != 'completed' && booking.sale.sale_status != 'void'
|
||||||
|
table_avaliable = false
|
||||||
|
table_count += 1
|
||||||
|
else
|
||||||
|
table_avaliable = true
|
||||||
|
end
|
||||||
|
else
|
||||||
table_avaliable = false
|
table_avaliable = false
|
||||||
|
table_count += 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if table_avaliable
|
if table_avaliable && table_count == 0
|
||||||
table.status = 'available'
|
table.status = 'available'
|
||||||
table.save
|
table.save
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user