diff --git a/app/models/sale_payment.rb b/app/models/sale_payment.rb index 9fb4e9ae..1ef4f665 100755 --- a/app/models/sale_payment.rb +++ b/app/models/sale_payment.rb @@ -369,6 +369,7 @@ class SalePayment < ApplicationRecord def table_update_status(sale_obj) status = true booking = Booking.find_by_sale_id(sale_obj.id) + if booking table = DiningFacility.find(booking.dining_facility_id) bookings = table.bookings @@ -377,12 +378,15 @@ class SalePayment < ApplicationRecord if tablebooking.sale_id if tablebooking.sale.sale_status != 'completed' && tablebooking.sale.sale_status != 'void' status = false + else + status = true end else status = false end end end + if status table.status = "available" table.save diff --git a/app/views/origami/home/show.html.erb b/app/views/origami/home/show.html.erb index 6d83f852..0b98ac76 100755 --- a/app/views/origami/home/show.html.erb +++ b/app/views/origami/home/show.html.erb @@ -237,7 +237,7 @@ end if @status_order == 'order' && @status_sale != 'sale' - unless @order_items.nil? + unless @order_items.nil? || @order_items.empty? count = 0 @order_items.each do |order_item| count += 1 @@ -306,7 +306,7 @@ <% if @status_sale == 'sale' - unless @order_items.nil? + unless @order_items.nil? || @order_items.empty? %> Pending New Order