CRUD Update for Promotion

This commit is contained in:
Phyo
2017-08-30 18:22:22 +06:30
parent 15e37f9ee2
commit bf9f0cdbe7
4 changed files with 119 additions and 8 deletions

View File

@@ -76,6 +76,17 @@ class Settings::PromotionsController < ApplicationController
end
end
def find_item_instance
item = MenuItem.find_by_item_code(params[:item_code])
if item.nil?
product = Product.where("item_code = ?",params[:item_code]).pluck(:name,:item_code)
render json: product
else
menu_instance = MenuItemInstance.where("menu_item_id = ?",item.id).pluck(:item_instance_name,:item_instance_code)
render json: menu_instance
end
end
private
# Use callbacks to share common setup or constraints between actions.
def set_promotion