Promotion Product Add

This commit is contained in:
Phyo
2017-08-21 17:38:07 +06:30
parent 8caf4b2612
commit e9ba56826c
16 changed files with 302 additions and 7 deletions

View File

@@ -1,4 +1,4 @@
<%= simple_form_for([:settings,@promotion]) do |f| %>
<%= simple_nested_form_for([:settings,@promotion]) do |f| %>
<%= f.error_notification %>
<div class="form-inputs">
@@ -32,13 +32,62 @@
<div class="row">
<div class="col-md-6">
<%= f.input :promo_type,input_html: { class: "" },
collection: %w{Quantity Net_off Net_price Percentage},:class => 'form-control' ,:label => "" %>
collection: %w{Quantity Net_off Net_price Percentage},:class => 'form-control' ,:label => "Promotion Type" %>
</div>
</div>
<div class="row">
<div class="col-md-6"><%= f.input :original_product,collection: MenuItem.order("name desc"),input_html: { selected: 2 } %></div>
<div class="col-md-6"><%= f.input :min_qty %></div>
</div>
<!-- <% if @promotion.id != nil %>
<div class="div-border">
<div class="col-md-10">
<%= link_to 'Promotion Product', new_settings_promotion_promotion_product_path(@promotion),:class => 'btn btn-primary' %>
</div>
</div>
<% end %> -->
<br>
<table class="table" style="border : 1px solid #555555 !important">
<tbody>
<tr>
<!-- <td>Promotion Code</td> -->
<td>Item Code</td>
<td>Min Qty</td>
<td>Net off</td>
<td>Net Price</td>
<td>Percentage</td>
<td colspan="2"><%= f.link_to_add "Add Product", :promotion_products, :class => 'btn btn-primary' %></td>
</tr>
<% @promotion.promotion_products.each do |pp| %>
<tr>
<!-- <td><%= pp.promotion_id %></td> -->
<td><%= pp.item_code %></td>
<td><%= pp.min_qty %></td>
<td><%= pp.net_off %></td>
<td><%= pp.net_price %></td>
<td><%= pp.percentage %></td>
<td><%= link_to 'Edit', edit_settings_promotion_promotion_product_path(@promotion,pp) %></td>
<td><%= link_to 'Destroy', settings_promotion_promotion_product_path(@promotion,pp), method: :delete, data: { confirm: 'Are you sure?' } %></td>
</tr>
<% end %>
<%= f.fields_for :promotion_products, PromotionProduct.new do |pro| %>
<tr>
<!-- <td></td> -->
<td><%= pro.input :item_code , :class => "form-control" %></td>
<td><%= pro.input :min_qty , :class => "form-control"%></td>
<td><%= pro.input :net_off , :class => "form-control" %></td>
<td><%= pro.input :net_price , :class => "form-control" %></td>
<td><%= pro.input :percentage , :class => "form-control" %></td>
<td><%= pro.link_to_remove "X" %></td>
<td></td>
</tr>
<% end %>
</tbody>
</table>
</div>
</div>