update no table quick srevice

This commit is contained in:
Aung Myo
2018-02-14 18:21:10 +06:30
parent 9757c34a09
commit 47ffc5fa51
12 changed files with 173 additions and 90 deletions

View File

@@ -385,32 +385,34 @@ class SalePayment < ApplicationRecord
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 booking.dining_facility_id.to_i > 0
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'
status = false
sale_count += 1
else
status = true
end
else
status = false
sale_count += 1
else
status = true
end
else
status = false
sale_count += 1
end
end
end
if status && sale_count == 0
table.status = "available"
table.save
end
if status && sale_count == 0
table.status = "available"
table.save
end
type = 'payment'
#Send to background job for processing
# OrderBroadcastJob.perform_later(table,type)
ActionCable.server.broadcast "order_channel",table: table,type:type
type = 'payment'
#Send to background job for processing
# OrderBroadcastJob.perform_later(table,type)
ActionCable.server.broadcast "order_channel",table: table,type:type
end
end
end