<%= simple_nested_form_for([:settings,@promotion]) do |f| %> <%= f.error_notification %>
<%= f.input :promo_code %>
* Promo Start Date <%= f.date_field :promo_start_date, :placeholder => "From Date" , :class => "form-control"%>
* Promo End Date <%= f.date_field :promo_end_date ,:placeholder => "To Date" , :class => "form-control"%>
<% if !@promotion.promo_start_hour.nil?%> <%= f.input :promo_start_hour, as: :string, input_html: { :value => @promotion.promo_start_hour.utc.strftime('%H:%M') } %> <% else %> <%= f.input :promo_start_hour, as: :string, input_html: { } %> <% end %>
<% if !@promotion.promo_end_hour.nil?%> <%= f.input :promo_end_hour, as: :string, input_html: {:value => @promotion.promo_end_hour.utc.strftime('%H:%M') } %> <% else %> <%= f.input :promo_end_hour, as: :string, input_html: {} %> <% end %>
<%= f.input :promo_day %>
<%= f.input :promo_type,input_html: { class: "" }, collection: %w{Quantity Net_off Net_price Percentage},:class => 'form-control' ,:label => "Promotion Type" %>
<%= f.input :original_product,collection: MenuItem.order("name desc").pluck(:name,:item_code),input_html: { selected: 2 } %>
<%= f.input :min_qty %>

Item Code
Min Qty
Net off
Net Price
Percentage
<%= f.fields_for :promotion_products do |pro| %>
<%= pro.input :item_code, label: false,collection: MenuItem.order("name desc").pluck(:name,:item_code)%>
<%= pro.input :min_qty , label: false%>
<%= pro.input :net_off , label: false %>
<%= pro.input :net_price , label: false %>
<%= pro.input :percentage , label: false %>
<%= pro.link_to_remove "X" %>
<% end %>
<%= f.link_to_add "Add Product", :promotion_products, :class => 'btn btn-primary' %>

<%= f.button :submit %>
<% end %>