merge with august_spring

This commit is contained in:
Yan
2017-08-22 14:52:14 +06:30
102 changed files with 2910 additions and 748 deletions

View File

@@ -1,16 +1,33 @@
<%= simple_form_for([:settings,@settings_product]) do |f| %>
<%= f.error_notification %>
<div class="form-inputs">
<div class="col-md-8">
<div class="form-group">
<%= f.input :item_code, :input_html => { :id => 'item_code' } %>
<%= f.input :name %>
<%= f.input :alt_name %>
<%= f.input :unit_price %>
<%= f.input :image_path %>
<%= f.input :description %>
<%= f.input :information %>
<label><%= f.check_box :taxable %>Taxable</label>
</div>
</div>
<label>Product Image</label>
<div class="col-md-4">
<div class="panel padding-10">
<div class="form-group">
<div class="menu-item-img">
<% if f.object.image_path? %>
<p><%= f.object.name %></p>
<%= image_tag f.object.image_path.url, :class => "img-thumbnail" %>
<% else %>
<p>Sample Image</p>
<%= image_tag "/image/menu_images/default.png", :class => "img-thumbnail" %>
<% end %>
</div>
<%= f.file_field :image_path, :class => "img-thumbnail" %>
</div>
</div>
<div class="form-actions">
<%= f.button :submit %>

View File

@@ -0,0 +1,32 @@
<%= simple_form_for([:settings,@promotion,@promotion_product]) do |f| %>
<%= f.error_notification %>
<div class="form-inputs">
<div class="div-border">
<div class="row">
<div class="col-md-12"><%= f.input :item_code %></div>
</div>
<% if @promotion.promo_type == Promotion::PROMO_TYPE1 %>
<div class="row">
<div class="col-md-12"><%= f.input :min_qty %></div>
</div>
<% elsif @promotion.promo_type == Promotion::PROMO_TYPE2 %>
<div class="row">
<div class="col-md-12"><%= f.input :net_off %></div>
</div>
<% elsif @promotion.promo_type == Promotion::PROMO_TYPE3 %>
<div class="row">
<div class="col-md-12"><%= f.input :net_price %></div>
</div>
<% elsif @promotion.promo_type == Promotion::PROMO_TYPE4 %>
<div class="row">
<div class="col-md-12"><%= f.input :percentage %></div>
</div>
<% end %>
</div>
</div>
<div class="form-actions">
<%= f.button :submit %>
</div>
<% end %>

View File

@@ -0,0 +1,2 @@
json.extract! promotion, :id, :created_at, :updated_at
json.url promotion_url(promotion, format: :json)

View File

@@ -0,0 +1,11 @@
<div class="span12">
<div class="page-header">
<ul class="breadcrumb">
<li><a href="<%= root_path %>">Home</a></li>
<li><a href="<%= edit_settings_promotion_path(@promotion) %>">Promotions</a></li>
<li>Promotion Products</li>
<li>Edit</li>
</ul>
</div>
<%= render 'form', promotion_products: @promotion_product %>
</div>

View File

@@ -0,0 +1,47 @@
<p id="notice"><%= notice %></p>
<div class="page-header">
<ul class="breadcrumb">
<li><a href="<%= root_path %>">Home</a></li>
<li><a href="<%= settings_promotions_path %>">Promotions</a></li>
<li>PromotionProducts</li>
<span style="float: right">
<%= link_to t('.new', :default => t("helpers.links.new")),new_settings_promotion_promotion_product_path,:class => 'btn btn-primary btn-sm' %>
</span>
</ul>
</div>
<br>
<div class="card">
<table class="table table-striped">
<thead>
<tr>
<th>Promotion Code</th>
<th>Item Code</th>
<th>Minimum Quantity</th>
<th>Net Off</th>
<th>Net Price</th>
<th>Percentage</th>
<th>Created At</th>
<th colspan="2"></th>
</tr>
</thead>
<tbody>
<% @promotion_products.each do |pro| %>
<tr>
<td><%= link_to pro.promotion.promo_code, settings_promotion_promotion_path(pro.promotion) %></td>
<td><%= pro.item_code %></td>
<td><%= pro.min_qty %></td>
<td><%= pro.net_off rescue "-" %></td>
<td><%= pro.net_price rescue "-" %></td>
<td><%= pro.percentage %></td>
<td><%= pro.created_at.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") %></td>
<td><%= link_to 'Edit', edit_settings_promotion_promotion_product_path(pro) %></td>
<td><%= link_to 'Destroy', settings_promotion_promotion_product_path(pro), method: :delete, data: { confirm: 'Are you sure?' } %></td>
</tr>
<% end %>
</tbody>
</table>
</div>

View File

@@ -0,0 +1 @@
json.array! @promotions, partial: 'promotions/promotion', as: :promotion

View File

@@ -0,0 +1,15 @@
<div class="span12">
<div class="page-header">
<ul class="breadcrumb">
<li><a href="<%= root_path %>">Home</a></li>
<li><a href="<%= edit_settings_promotion_path(@promotion) %>">Promotion</a></li>
<!-- <li><a href="<%= settings_promotion_promotion_products_path %>">Promotion Products</a></li> -->
<li>New</li>
</ul>
</div>
<%= render 'form', promotion_products: @promotion_product %>
</div>
<script>
$("#promotion_promo_code").val(Math.random().toString(36).slice(5) + Math.random().toString(36).slice(5));
</script>

View File

@@ -0,0 +1,28 @@
<div class="span12">
<div class="page-header">
<ul class="breadcrumb">
<li><a href="<%= root_path %>">Home</a></li>
<li><a href="<%= settings_promotion_path(@promotion) %>">Promotion</a></li>
<li>Promotion Products</li>
</ul>
</div>
</div>
<div class="card">
<div class="card-block">
<h4 class="card-title">Promotion Product</h4>
<table class="table">
<tbody>
<tr><td style="width:20%">Promotion Code</td><td><%= @promotion_product.promo_code %></td></tr>
<tr><td style="width:20%">Item Code</td><td><%= @promotion_product.item_code %></td></tr>
<tr><td style="width:20%">Min Qty</td><td><%= @promotion_product.min_qty %></td></tr>
<tr><td style="width:20%">Net off</td><td><%= @promotion_product.net_off %></td></tr>
<tr><td style="width:20%">Net Price</td><td><%= @promotion_product.net_price %></td></tr>
<tr><td style="width:20%">Percentage</td><td><%= @promotion_product.percentage %></td></tr>
<tr><td style="width:20%"><%= link_to 'Edit', edit_settings_promotion_product_path(@promotion_product) %></td><td><%= link_to 'Destroy', settings_promotion_product_path(@promotion_product), method: :delete, data: { confirm: 'Are you sure?' } %></td></tr>
</tbody>
</table>
</div>
</div>

View File

@@ -0,0 +1 @@
json.partial! "promotions/promotion", promotion: @promotion

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,28 @@
<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>
<br>
<p><%= f.link_to_add "Add Product", :promotion_products, :class => 'btn btn-primary' %></p>
<br>
<%= f.fields_for :promotion_products do |p| %>
<div class="row">
<div class="col-md-1"><%= p.input :item_code , :class => "form-control" %></div>
<div class="col-md-1"><%= p.input :min_qty , :class => "form-control" %></div>
<div class="col-md-1"><%= p.input :net_off , :class => "form-control" %></div>
<div class="col-md-1"><%= p.input :net_price , :class => "form-control" %></div>
<div class="col-md-1"><%= p.input :percentage , :class => "form-control" %></div>
<div class="col-md-1" style='padding-top:30px;'><%= p.link_to_remove "X"%></div>
</div>
<% end %>
</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>