change action cable issue for quick service

This commit is contained in:
phyusin
2018-05-31 10:29:38 +06:30
parent 6472dbeacb
commit c1961720c8
7 changed files with 73 additions and 33 deletions

View File

@@ -182,6 +182,15 @@ puts params[:id]
@status, @booking = @order.generate
if @status && @booking
#send order broadcast to order_channel
if @order.table_id.to_i > 0
table = DiningFacility.find(@booking.dining_facility_id)
type = 'order'
from = getCloudDomain #get sub domain in cloud mode
ActionCable.server.broadcast "order_channel",table: table,type:type,from:from
end
if params[:order_source] != "quick_service"
process_order_queue(@order.order_id,@order.table_id,@order.source)
end
@@ -194,11 +203,7 @@ puts params[:id]
@status, @sale = Sale.request_bill(@order,current_user,current_login_employee)
# for second display
if ENV["SERVER_MODE"] == 'cloud'
from = request.subdomain + "." + request.domain
else
from = ""
end
from = getCloudDomain #get sub domain in cloud mode
ActionCable.server.broadcast "second_display_channel",data: @sale,status:"sale",from:from
#end
result = {:status=> @status, :data => @sale }
@@ -307,11 +312,7 @@ puts params[:id]
oqs.process_order(order, table_id, order_source)
end
if ENV["SERVER_MODE"] == 'cloud'
from = request.subdomain + "." + request.domain
else
from = ""
end
from = getCloudDomain #get sub domain in cloud mode
assign_order = AssignedOrderItem.assigned_order_item_by_job(order_id)
ActionCable.server.broadcast "order_queue_station_channel",order: assign_order,from:from
end
@@ -325,6 +326,16 @@ puts params[:id]
end
return false
end
#get cloud domain
def getCloudDomain
from = ""
if ENV["SERVER_MODE"] == 'cloud'
from = request.subdomain + "." + request.domain
end
return from
end
private

View File

@@ -120,6 +120,10 @@ class Origami::PaymentsController < BaseOrigamiController
sale_payment = SalePayment.new
sale_payment.process_payment(saleObj, current_user.name, cash, "cash")
type = 'payment'
from = getCloudDomain #get sub domain in cloud mode
ActionCable.server.broadcast "order_channel",table: table,type:type,from:from
rebate_amount = nil
# For Cashier by Zone
@@ -184,6 +188,10 @@ class Origami::PaymentsController < BaseOrigamiController
# Order.pay_process_order_queue(order.order_id, table_id)
oqs = OrderQueueStation.new
oqs.pay_process_order_queue(order.order_id, table_id)
assign_order = AssignedOrderItem.assigned_order_item_by_job(order.order_id)
from = getCloudDomain #get sub domain in cloud mode
ActionCable.server.broadcast "order_queue_station_channel",order: assign_order,from:from
end
end
@@ -468,6 +476,10 @@ class Origami::PaymentsController < BaseOrigamiController
sale_payment = SalePayment.new
sale_payment.process_payment(saleObj, current_user.name, cash, "foc" ,remark)
type = 'payment'
from = getCloudDomain #get sub domain in cloud mode
ActionCable.server.broadcast "order_channel",table: table,type:type,from:from
# For Cashier by Zone
bookings = Booking.where("sale_id='#{sale_id}'")
# if bookings.count > 1
@@ -595,4 +607,14 @@ class Origami::PaymentsController < BaseOrigamiController
render json: JSON.generate({:status => true})
end
#get cloud domain
def getCloudDomain
from = ""
if ENV["SERVER_MODE"] == 'cloud'
from = request.subdomain + "." + request.domain
end
return from
end
end