update payment action cable
This commit is contained in:
@@ -382,16 +382,17 @@ class SalePayment < ApplicationRecord
|
||||
|
||||
def table_update_status(sale_obj)
|
||||
status = true
|
||||
sale_count = 0
|
||||
booking = Booking.find_by_sale_id(sale_obj.id)
|
||||
|
||||
if booking
|
||||
table = DiningFacility.find(booking.dining_facility_id)
|
||||
bookings = table.bookings
|
||||
bookings.each do |tablebooking|
|
||||
if tablebooking.booking_status != 'moved'
|
||||
if tablebooking.sale_id
|
||||
if tablebooking.sale.sale_status != 'completed' && tablebooking.sale.sale_status != 'void'
|
||||
if tablebooking.sale.sale_status != 'completed' && tablebooking.sale.sale_status != 'void'
|
||||
status = false
|
||||
sale_count += 1
|
||||
else
|
||||
status = true
|
||||
end
|
||||
@@ -400,11 +401,14 @@ class SalePayment < ApplicationRecord
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if status
|
||||
if status && sale_count == 0
|
||||
table.status = "available"
|
||||
table.save
|
||||
end
|
||||
|
||||
type = 'payment'
|
||||
#Send to background job for processing
|
||||
OrderBroadcastJob.perform_later(table,type)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user