diff --git a/app/assets/javascripts/channels/order.js b/app/assets/javascripts/channels/order.js index 87b08c4a..9326b2cc 100755 --- a/app/assets/javascripts/channels/order.js +++ b/app/assets/javascripts/channels/order.js @@ -13,7 +13,11 @@ App.order = App.cable.subscriptions.create('OrderChannel', { $('.table_'+data.table.id).removeClass('green'); $('.table_'+data.table.id).addClass('blue'); $('.new_text_'+data.table.id).removeClass('hide') - }else{ + }else if(data.type == 'move'){ + $('.table_'+data.table).removeClass('blue'); + $('.table_'+data.table).addClass('green'); + $('.table_'+data.change_to).addClass('blue'); + }else{ $('.table_'+data.table.id).removeClass('red'); $('.table_'+data.table.id).addClass('green'); $('.new_text_'+data.table.id).html(''); diff --git a/app/controllers/origami/moveroom_controller.rb b/app/controllers/origami/moveroom_controller.rb index 8f1430a6..04620543 100755 --- a/app/controllers/origami/moveroom_controller.rb +++ b/app/controllers/origami/moveroom_controller.rb @@ -7,8 +7,8 @@ class Origami::MoveroomController < 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') @status_order = "" @status_sale = "" diff --git a/app/controllers/origami/movetable_controller.rb b/app/controllers/origami/movetable_controller.rb index 7efdd46c..52f76c67 100755 --- a/app/controllers/origami/movetable_controller.rb +++ b/app/controllers/origami/movetable_controller.rb @@ -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