added action cable in move table

This commit is contained in:
Aung Myo
2018-06-07 11:30:52 +06:30
parent 2445f43994
commit cdc736778b
3 changed files with 24 additions and 6 deletions

View File

@@ -7,8 +7,8 @@ class Origami::MovetableController < BaseOrigamiController
@tables = Table.all.active.order('status desc')
@rooms = Room.all.active.order('status desc')
@complete = Sale.all
@orders = Order.all.order('date desc')
@complete = Sale.where("DATE_FORMAT(created_at,'%Y-%m-%d') = ? and sale_status != 'new'",DateTime.now.strftime('%Y-%m-%d'))
@orders = Order.where("DATE_FORMAT(date,'%Y-%m-%d') = ? and status != 'billed'",DateTime.now.strftime('%Y-%m-%d')).order('date desc')
@dining = DiningFacility.find(params[:dining_id])
@status_order = ""
@@ -104,6 +104,20 @@ class Origami::MovetableController < BaseOrigamiController
printer.print_move_table(print_settings,@to,@from ,@shop,@date,@type,@moved_by,order_items)
end
end
end
end
type = 'move'
from = getCloudDomain #get sub domain in cloud mode
ActionCable.server.broadcast "order_channel",table: change_from,type:type,from:from ,change_to:change_to
end
#get cloud domain
def getCloudDomain
from = ""
if ENV["SERVER_MODE"] == 'cloud'
from = request.subdomain + "." + request.domain
end
return from
end
end