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>

View File

@@ -1,4 +1,28 @@
<p id="notice"><%= notice %></p>
<%= link_to 'Edit', edit_promotion_path(@promotion) %> |
<%= link_to 'Back', promotions_path %>
<div class="span12">
<div class="page-header">
<ul class="breadcrumb">
<li><a href="<%= root_path %>">Home</a></li>
<li><a href="<%= settings_promotions_path %>">Promotions</a></li>
</ul>
</div>
</div>
<div class="card">
<div class="card-block">
<h4 class="card-title">Promotion</h4>
<table class="table">
<tbody>
<tr><td style="width:20%">Promotion code</td><td><%= @promotion.promo_code %></td></tr>
<tr><td style="width:20%">Promotion Start Date</td><td><%= @promotion.promo_start_date %></td></tr>
<tr><td style="width:20%">Promotion End Date</td><td><%= @promotion.promo_end_date %></td></tr>
<tr><td style="width:20%">Promotion Start Hour</td><td><%= @promotion.promo_start_hour %></td></tr>
<tr><td style="width:20%">Promotion Start Hour</td><td><%= @promotion.promo_end_hour %></td></tr>
<tr><td style="width:20%"><%= link_to 'Edit', edit_settings_promotion_path(@promotion) %></td><td><%= link_to 'Destroy', settings_promotion_path(@promotion), method: :delete, data: { confirm: 'Are you sure?' } %></td></tr>
</tbody>
</table>
</div>
</div>