update cable for cloud

This commit is contained in:
Aung Myo
2018-04-25 13:18:54 +06:30
parent d0ad95c8d6
commit 9b0a564b9a
10 changed files with 26 additions and 28 deletions

View File

@@ -47,9 +47,9 @@ class Api::BillController < Api::ApiController
Promotion.promo_activate(@sale) Promotion.promo_activate(@sale)
#BillBroadcastJob.perform_later(table) #BillBroadcastJob.perform_later(table)
if ENV["SERVER_MODE"] != 'cloud' #if ENV["SERVER_MODE"] != 'cloud'
ActionCable.server.broadcast "bill_channel",table: table ActionCable.server.broadcast "bill_channel",table: table
end #end
else else
@status = false @status = false
@error_message = "No Current Open Shift" @error_message = "No Current Open Shift"

View File

@@ -6,9 +6,9 @@ class Api::CallWaitersController < ActionController::API
@time = params[:time] @time = params[:time]
@table = DiningFacility.find(@table_id) @table = DiningFacility.find(@table_id)
# CallWaiterJob.perform_later(@table,@time) # CallWaiterJob.perform_later(@table,@time)
if ENV["SERVER_MODE"] != 'cloud' #if ENV["SERVER_MODE"] != 'cloud'
ActionCable.server.broadcast "call_waiter_channel",table: @table,time:@time ActionCable.server.broadcast "call_waiter_channel",table: @table,time:@time
end #end
# get printer info # get printer info
@shop = Shop.first @shop = Shop.first
unique_code = "CallWaiterPdf" unique_code = "CallWaiterPdf"

View File

@@ -61,7 +61,7 @@ class Api::OrderReserve::OrderReservationController < Api::ApiController
order_reservation = OrderReservation.find(order_reservation_id) order_reservation = OrderReservation.find(order_reservation_id)
# if ENV["SERVER_MODE"] != 'cloud' # if ENV["SERVER_MODE"] != 'cloud'
# ActionCable.server.broadcast "order_reservation_channel",data: order_reservation ActionCable.server.broadcast "order_reservation_channel",data: order_reservation
# end # end
if flag if flag
render :json => { :status => true, :order_reservation_id => order_reservation_id, :message => "Order reservation is successfully created!" } render :json => { :status => true, :order_reservation_id => order_reservation_id, :message => "Order reservation is successfully created!" }

View File

@@ -184,11 +184,9 @@ puts items_arr.to_json
@status, @sale = Sale.request_bill(@order,current_user,current_login_employee) @status, @sale = Sale.request_bill(@order,current_user,current_login_employee)
# for second display # for second display
if ENV["SERVER_MODE"] != 'cloud' #if ENV["SERVER_MODE"] != 'cloud'
ActionCable.server.broadcast "second_display_channel",data: @sale,status:"sale"
ActionCable.server.broadcast "second_display_channel",data: @sale,status:"sale" #end
end
result = {:status=> @status, :data => @sale } result = {:status=> @status, :data => @sale }
render :json => result.to_json render :json => result.to_json
end end

View File

@@ -39,9 +39,9 @@ class Origami::RequestBillsController < ApplicationController
# Promotion Activation # Promotion Activation
Promotion.promo_activate(@sale) Promotion.promo_activate(@sale)
#bill channel #bill channel
if ENV["SERVER_MODE"] != 'cloud' #if ENV["SERVER_MODE"] != 'cloud'
ActionCable.server.broadcast "bill_channel",table: table ActionCable.server.broadcast "bill_channel",table: table
end #end
if order.source == "quick_service" if order.source == "quick_service"
result = {:status=> @status, :data => @sale.sale_id } result = {:status=> @status, :data => @sale.sale_id }
render :json => result.to_json render :json => result.to_json

View File

@@ -13,9 +13,9 @@ class Origami::SecondDisplayController < BaseOrigamiController
else else
tax_profiles = nil tax_profiles = nil
end end
if ENV["SERVER_MODE"] != 'cloud' #if ENV["SERVER_MODE"] != 'cloud'
ActionCable.server.broadcast "second_display_view_channel",data: params[:data],tax_profiles: tax_profiles,status:params[:status] ActionCable.server.broadcast "second_display_view_channel",data: params[:data],tax_profiles: tax_profiles,status:params[:status]
end # end
end end
#Shop Name in Navbor #Shop Name in Navbor
helper_method :shop_detail helper_method :shop_detail

View File

@@ -335,9 +335,9 @@ class Origami::SplitBillController < BaseOrigamiController
end end
Promotion.promo_activate(sale) Promotion.promo_activate(sale)
if ENV["SERVER_MODE"] != 'cloud' #if ENV["SERVER_MODE"] != 'cloud'
ActionCable.server.broadcast "bill_channel",table: table ActionCable.server.broadcast "bill_channel",table: table
end #end
render :json => { status: status } render :json => { status: status }
else else
render :json => { status: false, error_message: 'No Current Open Shift!'} render :json => { status: false, error_message: 'No Current Open Shift!'}

View File

@@ -156,9 +156,9 @@ class DiningFacility < ApplicationRecord
table = DiningFacility.find(table_id) table = DiningFacility.find(table_id)
#Send to background job for processing #Send to background job for processing
# CheckInBookingJob.perform_later(table) # CheckInBookingJob.perform_later(table)
if ENV["SERVER_MODE"] != 'cloud' #if ENV["SERVER_MODE"] != 'cloud'
ActionCable.server.broadcast "check_in_booking_channel",table: table ActionCable.server.broadcast "check_in_booking_channel",table: table
end #end
end end
def self.checkin_time def self.checkin_time

View File

@@ -321,9 +321,9 @@ class Order < ApplicationRecord
end end
else else
msg = ' Print Error ! Please contact to service' msg = ' Print Error ! Please contact to service'
if ENV["SERVER_MODE"] != 'cloud' #if ENV["SERVER_MODE"] != 'cloud'
ActionCable.server.broadcast "call_waiter_channel",table: msg,time:'print_error' ActionCable.server.broadcast "call_waiter_channel",table: msg,time:'print_error'
end #end
if !sidekiq.nil? if !sidekiq.nil?
OrderQueueProcessorJob.perform_later(self.id, self.table_id) OrderQueueProcessorJob.perform_later(self.id, self.table_id)
else else
@@ -337,9 +337,9 @@ class Order < ApplicationRecord
end end
end end
assign_order = AssignedOrderItem.assigned_order_item_by_job(self.id) assign_order = AssignedOrderItem.assigned_order_item_by_job(self.id)
if ENV["SERVER_MODE"] != 'cloud' #if ENV["SERVER_MODE"] != 'cloud'
ActionCable.server.broadcast "order_queue_station_channel",order: assign_order ActionCable.server.broadcast "order_queue_station_channel",order: assign_order
end #end
end end
end end
@@ -376,9 +376,9 @@ class Order < ApplicationRecord
type = 'order' type = 'order'
#Send to background job for processing #Send to background job for processing
# OrderBroadcastJob.perform_later(table,type) # OrderBroadcastJob.perform_later(table,type)
if ENV["SERVER_MODE"] != 'cloud' #if ENV["SERVER_MODE"] != 'cloud'
ActionCable.server.broadcast "order_channel",table: table,type:type ActionCable.server.broadcast "order_channel",table: table,type:type
end #end
end end
end end
@@ -532,9 +532,9 @@ class Order < ApplicationRecord
end end
end end
end end
if ENV["SERVER_MODE"] != 'cloud' #if ENV["SERVER_MODE"] != 'cloud'
ActionCable.server.broadcast "second_display_channel",data: @data_array,status:@status ActionCable.server.broadcast "second_display_channel",data: @data_array,status:@status
end #end
end end
private private

View File

@@ -607,9 +607,9 @@ class SalePayment < ApplicationRecord
type = 'payment' type = 'payment'
#Send to background job for processing #Send to background job for processing
# OrderBroadcastJob.perform_later(table,type) # OrderBroadcastJob.perform_later(table,type)
if ENV["SERVER_MODE"] != 'cloud' #if ENV["SERVER_MODE"] != 'cloud'
ActionCable.server.broadcast "order_channel",table: table,type:type ActionCable.server.broadcast "order_channel",table: table,type:type
end #end
end end
end end
end end