Show data in Edit

This commit is contained in:
Phyo
2017-09-06 17:01:33 +06:30
parent f56b7ab26e
commit 4ca3b708c4
4 changed files with 59 additions and 17 deletions

View File

@@ -90,6 +90,21 @@ class Settings::PromotionsController < ApplicationController
end
end
def find_parent_item
res = []
item = MenuItemInstance.find_by_item_instance_code(params[:item_instance_code])
if item.nil?
product = Product.where("item_code = ?",params[:item_instance_code]).pluck(:name,:item_code)
res.push(product.name)
res.push(product.item_code)
else
# menu_item = item.menu_item.pluck(:name,:item_code)
res.push(item.item_instance_name)
res.push(item.menu_item.item_code)
end
render json: res
end
private
# Use callbacks to share common setup or constraints between actions.
def set_promotion