second display

This commit is contained in:
NyanLinHtut
2019-06-20 15:07:18 +06:30
parent a0506f5a4e
commit 7de795ee27
12 changed files with 534 additions and 476 deletions

View File

@@ -1,10 +1,10 @@
class Origami::AddordersController < BaseOrigamiController
# before_action :set_dining, only: [:detail]
def index
@webview = false
if check_mobile
@webview = true
@webview = true
end
@tables = Table.all.active.order('zone_id asc').group("zone_id")
@@ -17,7 +17,7 @@ class Origami::AddordersController < BaseOrigamiController
@cashier_type = params[:type]
@webview = false
if check_mobile
@webview = true
@webview = true
end
display_type = Lookup.find_by_lookup_type("display_type")
if !display_type.nil? && display_type.value.to_i ==2
@@ -29,7 +29,7 @@ class Origami::AddordersController < BaseOrigamiController
@menus = []
@menu = []
# else
# @menus = Menu.all
# @menus = Menu.all
# @menu = MenuCategory.active.where("menu_id =#{@menus[0].id}").order('order_by asc')
# end
@@ -57,10 +57,10 @@ class Origami::AddordersController < BaseOrigamiController
def get_menu_category ()
if (params[:id])
#Pull this menu
@menu = MenuCategory.find_by_id(params[:id])
# puts @menu.menu_items[1].item_attributes.to_json
return @menu
else
@@ -96,9 +96,9 @@ class Origami::AddordersController < BaseOrigamiController
return @sub_menu
end
end
def get_all_product()
@product = Product.all
@product = Product.all
end
def create
@@ -108,7 +108,7 @@ class Origami::AddordersController < BaseOrigamiController
extra_time = ''
items_arr = []
JSON.parse(params[:order_items]).each { |i|
JSON.parse(params[:order_items]).each { |i|
i["item_instance_code"] = i["item_instance_code"].downcase.to_s
if i["item_instance_code"].include? "ext"
is_extra_time = true
@@ -192,25 +192,25 @@ class Origami::AddordersController < BaseOrigamiController
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" && params[:order_source] != "food_court"
process_order_queue(@order.order_id,@order.table_id,@order.source)
end
end
end
end
# Order.send_customer_view(@booking)
if current_user.role != "waiter" && params[:create_type] == "create_pay"
if @status && @booking && (@order.source == 'quick_service') || (@order.source == 'food_court')
@status, @sale = Sale.request_bill(@order,current_user,current_login_employee)
# for second display
# for second display
if @order.source == 'quick_service'
from = getCloudDomain #get sub domain in cloud mode
ActionCable.server.broadcast "second_display_channel",data: @sale,status:"sale",from:from
ActionCable.server.broadcast "second_display_channel",data: @sale,status:"sale",from:from
end
#end
result = {:status=> @status, :data => @sale }
@@ -220,7 +220,7 @@ class Origami::AddordersController < BaseOrigamiController
result = {:status=> @status, :data => 0 }
render :json => result.to_json
end
end
# render json for http status code
@@ -266,9 +266,9 @@ class Origami::AddordersController < BaseOrigamiController
def process_order_queue(order_id,table_id,order_source)
print_status = nil
cup_status = nil
#Send to background job for processing
order = Order.find(order_id)
order = Order.find(order_id)
sidekiq = Lookup.find_by_lookup_type("sidekiq")
if ENV["SERVER_MODE"] != 'cloud'
cup_status = `#{"sudo service cups status"}`
@@ -307,7 +307,7 @@ class Origami::AddordersController < BaseOrigamiController
else
if ENV["SERVER_MODE"] != 'cloud'
from = ""
msg = ' Print Error ! Please contact to service'
msg = ' Print Error ! Please contact to service'
ActionCable.server.broadcast "call_waiter_channel",table: msg,time:'print_error',from:from
end
if !sidekiq.nil?
@@ -342,7 +342,7 @@ class Origami::AddordersController < BaseOrigamiController
return from
end
private
# def set_dining