130 lines
4.7 KiB
Plaintext
130 lines
4.7 KiB
Plaintext
|
|
<%= simple_nested_form_for([:settings,@promotion]) do |f| %>
|
|
<%= f.error_notification %>
|
|
|
|
<div class="form-inputs">
|
|
<div class="div-border">
|
|
<div class="row">
|
|
<div class="col-md-6"><%= f.input :promo_code %></div>
|
|
<div class="col-md-6"></div>
|
|
</div>
|
|
<div class="row">
|
|
<div class="col-md-6">
|
|
<span>Promo Start Date</span>
|
|
<%= f.date_field :promo_start_date, :placeholder => "From Date" , :class => "form-control"%>
|
|
<br>
|
|
</div>
|
|
<div class="col-md-6">
|
|
<span>Promo End Date</span>
|
|
<%= f.date_field :promo_end_date ,:placeholder => "To Date" , :class => "form-control"%>
|
|
</div>
|
|
</div>
|
|
<div class="row">
|
|
<div class="col-md-6">
|
|
<!-- <%= f.input :promo_start_hour %> -->
|
|
<% 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 %>
|
|
<!-- <span>Promo Start Hour</span>
|
|
<%= text_field_tag :promo_start_hour , nil, :placeholder => "From Time", :id => "fromtime", :class => 'form-control' %> -->
|
|
</div>
|
|
<div class="col-md-6">
|
|
<!-- <%= f.input :promo_end_hour %> -->
|
|
<% 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 %>
|
|
</div>
|
|
</div>
|
|
<div class="row">
|
|
<div class="col-md-12"><%= f.input :promo_day %></div>
|
|
</div>
|
|
<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 => "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>
|
|
<br>
|
|
<br>
|
|
<table class="table" style="border : 1px solid #555555 !important;margin:0px">
|
|
<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"></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 %> -->
|
|
</tbody>
|
|
</table>
|
|
<%= f.fields_for :promotion_products do |pro| %>
|
|
<table class="table" style="margin:0px">
|
|
<tbody>
|
|
<tr>
|
|
<!-- <td></td> -->
|
|
<td><%= pro.input :item_code, label: false%></td>
|
|
<td><%= pro.input :min_qty , label: false%></td>
|
|
<td><%= pro.input :net_off , label: false %></td>
|
|
<td><%= pro.input :net_price , label: false %></td>
|
|
<td><%= pro.input :percentage , label: false %></td>
|
|
<td><%= pro.link_to_remove "X" %></td>
|
|
<td></td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<% end %>
|
|
<%= f.link_to_add "Add Product", :promotion_products, :class => 'btn btn-primary' %>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-actions">
|
|
<%= f.button :submit %>
|
|
</div>
|
|
<% end %>
|
|
<script>
|
|
$(document).ready(function(){
|
|
$('#promotion_promo_start_date').datetimepicker({
|
|
timepicker:false,
|
|
format:'Y-m-d'
|
|
});
|
|
$('#promotion_promo_end_date').datetimepicker({
|
|
timepicker:false,
|
|
format:'Y-m-d'
|
|
});
|
|
$('#promotion_promo_start_hour').datetimepicker({
|
|
datepicker:false,
|
|
format:'H:m'
|
|
});
|
|
$('#promotion_promo_end_hour').datetimepicker({
|
|
datepicker:false,
|
|
format:'H:m'
|
|
});
|
|
});
|
|
</script>
|