update payment action cable
This commit is contained in:
@@ -14,6 +14,7 @@ App.order = App.cable.subscriptions.create('BillChannel', {
|
|||||||
$('.table_'+data.table.id).addClass('red');
|
$('.table_'+data.table.id).addClass('red');
|
||||||
}
|
}
|
||||||
$('.new_text_'+data.table.id).removeClass('hide');
|
$('.new_text_'+data.table.id).removeClass('hide');
|
||||||
|
$('.new_text_'+data.table.id).text('billed');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -6,9 +6,16 @@ App.order = App.cable.subscriptions.create('OrderChannel', {
|
|||||||
disconnected: function() {},
|
disconnected: function() {},
|
||||||
|
|
||||||
received: function(data) {
|
received: function(data) {
|
||||||
$('.table_'+data.table.id).removeClass('green');
|
if (data.type == 'order') {
|
||||||
$('.table_'+data.table.id).addClass('blue');
|
$('.table_'+data.table.id).removeClass('green');
|
||||||
$('.new_text_'+data.table.id).removeClass('hide')
|
$('.table_'+data.table.id).addClass('blue');
|
||||||
|
$('.new_text_'+data.table.id).removeClass('hide')
|
||||||
|
}else{
|
||||||
|
$('.table_'+data.table.id).removeClass('red');
|
||||||
|
$('.table_'+data.table.id).addClass('green');
|
||||||
|
$('.new_text_'+data.table.id).html('');
|
||||||
|
$('.new_text_'+data.table.id).removeClass('hide')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
class OrderBroadcastJob < ApplicationJob
|
class OrderBroadcastJob < ApplicationJob
|
||||||
queue_as :default
|
queue_as :default
|
||||||
|
|
||||||
def perform(table)
|
def perform(table,type)
|
||||||
ActionCable.server.broadcast "order_channel",table: table
|
ActionCable.server.broadcast "order_channel",table: table,type:type
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -285,8 +285,9 @@ class Order < ApplicationRecord
|
|||||||
#send order items and send to order queue
|
#send order items and send to order queue
|
||||||
def send_order_broadcast(booking)
|
def send_order_broadcast(booking)
|
||||||
table = DiningFacility.find(booking.dining_facility_id)
|
table = DiningFacility.find(booking.dining_facility_id)
|
||||||
|
type = 'order'
|
||||||
#Send to background job for processing
|
#Send to background job for processing
|
||||||
OrderBroadcastJob.perform_later(table)
|
OrderBroadcastJob.perform_later(table,type)
|
||||||
end
|
end
|
||||||
|
|
||||||
#Origami: Cashier : to view order Table
|
#Origami: Cashier : to view order Table
|
||||||
|
|||||||
@@ -382,8 +382,8 @@ class SalePayment < ApplicationRecord
|
|||||||
|
|
||||||
def table_update_status(sale_obj)
|
def table_update_status(sale_obj)
|
||||||
status = true
|
status = true
|
||||||
|
sale_count = 0
|
||||||
booking = Booking.find_by_sale_id(sale_obj.id)
|
booking = Booking.find_by_sale_id(sale_obj.id)
|
||||||
|
|
||||||
if booking
|
if booking
|
||||||
table = DiningFacility.find(booking.dining_facility_id)
|
table = DiningFacility.find(booking.dining_facility_id)
|
||||||
bookings = table.bookings
|
bookings = table.bookings
|
||||||
@@ -392,6 +392,7 @@ class SalePayment < ApplicationRecord
|
|||||||
if tablebooking.sale_id
|
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
|
status = false
|
||||||
|
sale_count += 1
|
||||||
else
|
else
|
||||||
status = true
|
status = true
|
||||||
end
|
end
|
||||||
@@ -400,11 +401,14 @@ class SalePayment < ApplicationRecord
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
if status && sale_count == 0
|
||||||
if status
|
|
||||||
table.status = "available"
|
table.status = "available"
|
||||||
table.save
|
table.save
|
||||||
end
|
end
|
||||||
|
|
||||||
|
type = 'payment'
|
||||||
|
#Send to background job for processing
|
||||||
|
OrderBroadcastJob.perform_later(table,type)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user