quick service add order btn

This commit is contained in:
NyanLinHtut
2019-06-03 15:03:30 +06:30
parent 80d2bc4f13
commit 454ff6392b
7 changed files with 104 additions and 99 deletions

View File

@@ -6,7 +6,7 @@ class Origami::QuickServiceController < ApplicationController
redirect_to root_path
end
end
def index
today = DateTime.now
day = Date.today.wday
@@ -14,7 +14,7 @@ class Origami::QuickServiceController < ApplicationController
@menus = []
@menu = []
# else
# @menus = Menu.all
# @menus = Menu.all
# @menu = MenuCategory.active.where("menu_id =#{@menus[0].id}").order('order_by asc')
# end
@zone = Zone.all
@@ -28,20 +28,22 @@ class Origami::QuickServiceController < ApplicationController
else
@display_type = nil
end
#checked quick_service only
@quick_service_only = true
lookup_dine_in = Lookup.collection_of('dinein_cashier')
@quick_service_only = false
lookup_dine_in = Lookup.collection_of('quickservice_add_order')
puts 'lookup_dine_in!!!!'
puts lookup_dine_in
if !lookup_dine_in.empty?
lookup_dine_in.each do |dine_in|
if dine_in[0].downcase == "dineincashier"
if dine_in[1] == '1'
@quick_service_only = false
if dine_in[0].downcase == "quickserviceaddorder"
if dine_in[1] == '1'
@quick_service_only = true
end
end
end
end
render "origami/addorders/detail"
end
@@ -53,7 +55,7 @@ class Origami::QuickServiceController < ApplicationController
@menus = []
@menu = []
# else
# @menus = Menu.all
# @menus = Menu.all
# @menu = MenuCategory.active.where("menu_id =#{@menus[0].id}").order('order_by asc')
# end
if(params[:id][0,3] == "BKI")
@@ -65,7 +67,7 @@ class Origami::QuickServiceController < ApplicationController
@table = DiningFacility.find(@table_id)
@booking = @table.get_booking
end
@sale_id = params[:sale_id]
if @booking
@@ -96,7 +98,7 @@ class Origami::QuickServiceController < ApplicationController
@cashier_type = "quick_service"
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
@@ -169,7 +171,7 @@ class Origami::QuickServiceController < ApplicationController
end
@status, @booking = @order.generate
if(params[:sale_id][0,3] == "SAL")
if(params[:sale_id][0,3] == "SAL")
if @status && @booking && @order.source == 'quick_service'
if params[:sale_id]
@sale = Sale.find(params[:sale_id])
@@ -180,17 +182,17 @@ class Origami::QuickServiceController < ApplicationController
end
update = Sale.add_to_existing_pending_invoice(@table_id,params[:sale_id],@booking)
end
result = {:status=> true, :data => @sale }
render :json => result.to_json
end
end
elsif (params[:sale_id][0,3] == "BKI")
result = {:status=> true, :data => 'OK' }
render :json => result.to_json
render :json => result.to_json
else
result = {:status=> true, :data => nil }
render :json => result.to_json
end
end
end
@@ -216,9 +218,9 @@ class Origami::QuickServiceController < ApplicationController
return @sub_menu
end
end
def get_all_product()
@product = Product.all
@product = Product.all
end
# render json for http status code