commission update

This commit is contained in:
Zin Lin Phyo
2017-08-23 11:14:24 +06:30
parent b53db9b08b
commit 3132bc7c34
13 changed files with 204 additions and 166 deletions

View File

@@ -4,11 +4,11 @@
<div class="form-inputs">
<%= f.label :product_id %>
<%= f.collection_select :product_id, Product.all.order('name asc'), :id, :name, {prompt: "Select a Product"}, {class: "form-control"} %><br/>
<%= f.collection_select :product_id, @products, :id, :name, {prompt: 'Select a Product'}, {class: 'form-control'} %><br/>
<%= f.input :amount %>
<%= f.input :commission_type, :collection => [:percentage, :net_amount] %>
<%= f.input :commission_type, :collection => ['Percentage','Net Amount'], prompt: 'Select Commission Type', class: 'form-control' %>
<label><%= f.check_box :is_active %> Active </label>
</div>
</div><br>
<div class="form-actions">
<%= link_to 'Back', origami_commissions_path, class: 'btn btn-success' %>
<%= f.button :submit, class: 'btn btn-info' %>

View File

@@ -1,11 +1,11 @@
<div class="page-header">
<ul class="breadcrumb">
<li><a href="<%= origami_root_path %>">Home</a></li>
<li>Commissions</li>
<span style="float: right">
<%= link_to t('.new', :default => t("helpers.links.new")), new_origami_commission_path ,:class => 'btn btn-primary btn-sm' %>
<ul class="breadcrumb">
<li><a href="<%= origami_root_path %>">Home</a></li>
<li>Commissions</li>
<span style="float: right">
<%= link_to t('.new', :default => t("helpers.links.new")), new_origami_commission_path, :class => 'btn btn-primary btn-sm' %>
</span>
</ul>
</ul>
</div>
<br>
@@ -23,22 +23,16 @@
<tbody>
<% @commissions.each do |commission| %>
<tr>
<td>
<% if Product.exists? %>
<% product = Product.find(commission.product_id) %>
<%= product.name %>
<% end %>
</td>
<td><%= commission.amount %></td>
<td><%= commission.commission_type %></td>
<td><%= commission.is_active %></td>
<td><%= link_to 'Show', origami_commission_path(commission) %></td>
<td><%= link_to 'Edit', edit_origami_commission_path(commission) %></td>
<td><%= link_to 'Destroy', origami_commission_path(commission), method: :delete, data: { confirm: 'Are you sure?' } %></td>
</tr>
<tr>
<td><%= commission.menu_item.name rescue '-' %></td>
<td><%= commission.amount rescue '-' %></td>
<td><%= commission.commission_type rescue '-' %></td>
<td><%= commission.is_active rescue '-' %></td>
<td><%= link_to 'Show', origami_commission_path(commission) %></td>
<td><%= link_to 'Edit', edit_origami_commission_path(commission) %></td>
<td><%= link_to 'Destroy', origami_commission_path(commission), method: :delete, data: {confirm: 'Are you sure?'} %></td>
</tr>
<% end %>
</tbody>
</tbody>
</table>
</div>

View File

@@ -16,12 +16,7 @@
<tbody>
<tr>
<td style="width:20%">Product Name</td>
<td>
<% if Product.exists? %>
<% product = Product.find(@commission.product_id) %>
<%= product.name %>
<% end %>
</td>
<td><%= @commission.menu_item.name rescue '-' %></td>
</tr>
<tr>
<td style="width:20%">Amount</td>