set items in order
This commit is contained in:
@@ -124,7 +124,7 @@ class Order < ApplicationRecord
|
|||||||
ordered_list = re_order_items(self.items)
|
ordered_list = re_order_items(self.items)
|
||||||
|
|
||||||
#loop to add all items to order
|
#loop to add all items to order
|
||||||
self.items.each do |item|
|
ordered_list.each do |item|
|
||||||
|
|
||||||
menu_item = MenuItem.search_by_item_code(item[:item_instance_code])
|
menu_item = MenuItem.search_by_item_code(item[:item_instance_code])
|
||||||
|
|
||||||
@@ -135,10 +135,16 @@ class Order < ApplicationRecord
|
|||||||
|
|
||||||
#if (!menu_item.nil?)
|
#if (!menu_item.nil?)
|
||||||
Rails.logger.debug menu_item
|
Rails.logger.debug menu_item
|
||||||
set_order_items = nil
|
set_order_items = Array.new
|
||||||
##If menu Item set item - must add child items to order as well, where price is only take from menu_item
|
##If menu Item set item - must add child items to order as well, where price is only take from menu_item
|
||||||
if (menu_item[:type] == "SetMenuItem")
|
# if (menu_item[:type] == "SetMenuItem")
|
||||||
set_order_items
|
# set_order_items =
|
||||||
|
# end
|
||||||
|
|
||||||
|
if item.include? 'sub_items'
|
||||||
|
item[:sub_items].each do |si|
|
||||||
|
set_order_items.push({"item_instance_code"=>si[:item_instance_code], "quantity"=>si[:quantity]})
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# not insert with price 0
|
# not insert with price 0
|
||||||
@@ -151,7 +157,7 @@ class Order < ApplicationRecord
|
|||||||
# end
|
# end
|
||||||
|
|
||||||
OrderItem.processs_item(menu_item[:item_code], item[:item_instance_code], menu_item[:name], menu_item[:alt_name], menu_item[:account_id],
|
OrderItem.processs_item(menu_item[:item_code], item[:item_instance_code], menu_item[:name], menu_item[:alt_name], menu_item[:account_id],
|
||||||
item[:quantity],menu_item[:price], item[:options], set_order_items, self.id,
|
item[:quantity],menu_item[:price], item[:options], set_order_items.to_json, self.id,
|
||||||
self.employee_name, menu_item[:taxable])
|
self.employee_name, menu_item[:taxable])
|
||||||
|
|
||||||
#end
|
#end
|
||||||
|
|||||||
Reference in New Issue
Block a user