Merge branch 'adminbsb_ui_changes' of bitbucket.org:code2lab/sxrestaurant

This commit is contained in:
phyusin
2018-02-14 17:33:18 +06:30
5 changed files with 27 additions and 15 deletions

View File

@@ -38,11 +38,11 @@ class ApplicationController < ActionController::Base
end
else
# check for license file
if check_license
current_license(ENV["SX_PROVISION_URL"])
else
redirect_to activate_path
end
# if check_license
# current_license(ENV["SX_PROVISION_URL"])
# else
# redirect_to activate_path
# end
end
end

View File

@@ -27,9 +27,9 @@ class Origami::HomeController < BaseOrigamiController
@membership = MembershipSetting::MembershipSetting
@payment_methods = PaymentMethodSetting.all
@order_items_count = Hash.new
bookings = Booking.all
if !bookings.nil?
@order_items_count = Hash.new
bookings.each do |booking|
if booking.sale_id.nil? && booking.booking_status != 'moved'
if !booking.booking_orders.empty?
@@ -51,7 +51,7 @@ class Origami::HomeController < BaseOrigamiController
if !@order_items_count.key?(booking.dining_facility_id)
@order_items_count.store(booking.dining_facility_id, sale.sale_items.count)
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
@@ -59,6 +59,9 @@ class Origami::HomeController < BaseOrigamiController
end
end
puts "@order_items_count"
puts @order_items_count.to_json
@dining.bookings.active.each do |booking|
if booking.sale_id.nil? && booking.booking_status != 'moved'
@order_items = Array.new

View File

@@ -13,9 +13,9 @@ class Origami::OrdersController < BaseOrigamiController
end
end
@order_items_count = Hash.new
bookings = Booking.all
if !bookings.nil?
@order_items_count = Hash.new
bookings.each do |booking|
if booking.sale_id.nil? && booking.booking_status != 'moved'
if !booking.booking_orders.empty?
@@ -37,7 +37,7 @@ class Origami::OrdersController < BaseOrigamiController
if !@order_items_count.key?(booking.dining_facility_id)
@order_items_count.store(booking.dining_facility_id, sale.sale_items.count)
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

View File

@@ -22,10 +22,10 @@ class Origami::RoomsController < BaseOrigamiController
@shop = Shop::ShopDetail
@membership = MembershipSetting::MembershipSetting
@payment_methods = PaymentMethodSetting.all
@order_items_count = Hash.new
bookings = Booking.all
if !bookings.nil?
@order_items_count = Hash.new
bookings.each do |booking|
if booking.sale_id.nil? && booking.booking_status != 'moved'
if !booking.booking_orders.empty?
@@ -47,7 +47,7 @@ class Origami::RoomsController < BaseOrigamiController
if !@order_items_count.key?(booking.dining_facility_id)
@order_items_count.store(booking.dining_facility_id, sale.sale_items.count)
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

View File

@@ -40,16 +40,25 @@ class Origami::VoidController < BaseOrigamiController
# end
table_avaliable = true
table_count = 0
table = sale.bookings[0].dining_facility
table.bookings.each do |booking|
if !booking.sale.nil?
if booking.sale.sale_status == 'new'
if booking.booking_status != 'moved'
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_count += 1
end
end
end
if table_avaliable
if table_avaliable && table_count == 0
table.status = 'available'
table.save
end