Merge branch 'r-1902001-01-dev' of https://gitlab.com/code2lab/SXRestaurant into r-1902001-01-dev

This commit is contained in:
Nweni
2019-06-24 10:10:25 +06:30
13 changed files with 415 additions and 350 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

View File

@@ -280,8 +280,12 @@ class Origami::PaymentsController < BaseOrigamiController
end
def show
puts current_user
puts "Hello current_user"
display_type = Lookup.find_by_lookup_type("display_type")
if !display_type.nil? && display_type.value.to_i ==2
@display_type = display_type.value
else
@display_type = nil
end
path = request.fullpath
sale_id = params[:sale_id]
@trans_flag = true

View File

@@ -9,7 +9,7 @@ class Origami::SecondDisplayController < BaseOrigamiController
def customer_view
display_type = Lookup.find_by_lookup_type("display_type")
if !display_type.nil? && display_type.value.to_i == 2
if !display_type.nil? && display_type.value.to_i == 2
if params[:status]!= "billed"
tax_profiles = TaxProfile.all.order("order_by asc")
else
@@ -17,7 +17,7 @@ class Origami::SecondDisplayController < BaseOrigamiController
end
if ENV["SERVER_MODE"] == 'cloud'
from = request.subdomain + "." + request.domain
else
else
from = ""
end
ActionCable.server.broadcast "second_display_view_channel",data: params[:data],tax_profiles: tax_profiles,status:params[:status],from:from