diff --git a/app/controllers/settings/promotions_controller.rb b/app/controllers/settings/promotions_controller.rb
index 4ab33dba..8acc7764 100644
--- a/app/controllers/settings/promotions_controller.rb
+++ b/app/controllers/settings/promotions_controller.rb
@@ -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
diff --git a/app/models/promotion.rb b/app/models/promotion.rb
index 624818f1..41dfaec6 100644
--- a/app/models/promotion.rb
+++ b/app/models/promotion.rb
@@ -1,5 +1,5 @@
class Promotion < ApplicationRecord
- validates_presence_of :promo_code,:promo_start_date,:promo_end_date,:promo_start_hour,:promo_end_hour,:promo_day,:promo_type,:original_product,:min_qty
+ validates_presence_of :promo_code,:promo_start_date,:promo_end_date,:promo_start_hour,:promo_end_hour,:promo_type,:original_product,:min_qty
has_many :promotion_products
diff --git a/app/views/settings/promotions/_form.html.erb b/app/views/settings/promotions/_form.html.erb
index c832461d..477731a1 100644
--- a/app/views/settings/promotions/_form.html.erb
+++ b/app/views/settings/promotions/_form.html.erb
@@ -39,9 +39,10 @@
<% end %>
-
+