merge with august_spring
This commit is contained in:
@@ -69,6 +69,9 @@ class Settings::PromotionsController < ApplicationController
|
||||
# DELETE /promotions/1
|
||||
# DELETE /promotions/1.json
|
||||
def destroy
|
||||
@promotion.promotion_products.each do |pp|
|
||||
pp.destroy
|
||||
end
|
||||
@promotion.destroy
|
||||
respond_to do |format|
|
||||
format.html { redirect_to settings_promotions_path, notice: 'Promotion was successfully destroyed.' }
|
||||
@@ -87,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
|
||||
|
||||
Reference in New Issue
Block a user