commission update -> change route under settings
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
json.extract! commissioner, :id, :created_at, :updated_at
|
||||
json.url commissioner_url(commissioner, format: :json)
|
||||
22
app/views/settings/commissioners/_form.html.erb
Normal file
22
app/views/settings/commissioners/_form.html.erb
Normal file
@@ -0,0 +1,22 @@
|
||||
<div class="col-md-3">
|
||||
<%= simple_form_for([:settings, @commissioner]) do |f| %>
|
||||
<%= f.error_notification %>
|
||||
|
||||
<div class="form-inputs">
|
||||
<%= f.input :name %>
|
||||
<%= f.label :emp_id, 'Employee' %>
|
||||
<%= f.collection_select :emp_id, Employee.all.order('name asc'), :id, :name, {prompt: 'Select an Employee'}, {class: "form-control"} %>
|
||||
<br/>
|
||||
<%= f.label :commission_id, 'Commission' %><br/>
|
||||
<%= f.select :commission_id, Commission.all.map {|l| [l.menu_item.name, l.id]}, {prompt: 'Select a Product'}, {class: 'form-control'} %>
|
||||
<br/>
|
||||
<label><%= f.check_box :is_active %> Active </label>
|
||||
</div>
|
||||
<br/>
|
||||
|
||||
<div class="form-actions">
|
||||
<%= link_to 'Back', settings_commissioners_path, class: 'btn btn-success' %>
|
||||
<%= f.button :submit, class: 'btn btn-info' %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
10
app/views/settings/commissioners/edit.html.erb
Normal file
10
app/views/settings/commissioners/edit.html.erb
Normal file
@@ -0,0 +1,10 @@
|
||||
<div class="span12">
|
||||
<div class="page-header">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="<%= settings_commissioners_path %>">Home</a></li>
|
||||
<li><a href="<%= settings_commissioners_path %>">Commissioners</a></li>
|
||||
<li>Edit</li>
|
||||
</ul>
|
||||
</div>
|
||||
<%= render 'form', commissioner: @commissioner %>
|
||||
</div>
|
||||
40
app/views/settings/commissioners/index.html.erb
Normal file
40
app/views/settings/commissioners/index.html.erb
Normal file
@@ -0,0 +1,40 @@
|
||||
<div class="page-header">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="<%= settings_commissioners_path %>">Home</a></li>
|
||||
<li>Commissioner</li>
|
||||
<span style="float: right">
|
||||
<%= link_to t('.new', :default => t("helpers.links.new")), new_settings_commissioner_path, :class => 'btn btn-primary btn-sm' %>
|
||||
</span>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<br>
|
||||
<div class="card">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Employee Name</th>
|
||||
<th>Commission type</th>
|
||||
<th>Active</th>
|
||||
<th colspan="3"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<% @commissioners.each do |commissioner| %>
|
||||
<tr>
|
||||
<td><%= commissioner.name %></td>
|
||||
<td>
|
||||
<%= commissioner.employee.name rescue '-' %>
|
||||
</td>
|
||||
<td><%= commissioner.commission.menu_item.name rescue '-' %></td>
|
||||
<td><%= commissioner.is_active %></td>
|
||||
<td><%= link_to 'Show', settings_commissioner_path(commissioner) %></td>
|
||||
<td><%= link_to 'Edit', edit_settings_commissioner_path(commissioner) %></td>
|
||||
<td><%= link_to 'Destroy', settings_commissioner_path(commissioner), method: :delete, data: {confirm: 'Are you sure?'} %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
1
app/views/settings/commissioners/index.json.jbuilder
Normal file
1
app/views/settings/commissioners/index.json.jbuilder
Normal file
@@ -0,0 +1 @@
|
||||
json.array! @commissioners, partial: 'commissioners/commissioner', as: :commissioner
|
||||
10
app/views/settings/commissioners/new.html.erb
Normal file
10
app/views/settings/commissioners/new.html.erb
Normal file
@@ -0,0 +1,10 @@
|
||||
<div class="span12">
|
||||
<div class="page-header">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="<%= settings_commissioners_path %>">Home</a></li>
|
||||
<li><a href="<%= settings_commissioners_path %>">Commissioners</a></li>
|
||||
<li>New</li>
|
||||
</ul>
|
||||
</div>
|
||||
<%= render 'form', commissioner: @commissioner %>
|
||||
</div>
|
||||
47
app/views/settings/commissioners/show.html.erb
Normal file
47
app/views/settings/commissioners/show.html.erb
Normal file
@@ -0,0 +1,47 @@
|
||||
<div class="page-header">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="<%= settings_commissioner_path %>">Home</a></li>
|
||||
<li><a href="<%= settings_commissioner_path %>">Commissioners</a></li>
|
||||
|
||||
<span style="float: right">
|
||||
</span>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="card">
|
||||
<div class="card-block">
|
||||
<h4 class="card-title">Commissioner</h4>
|
||||
<table class="table">
|
||||
|
||||
<tbody>
|
||||
|
||||
<tr>
|
||||
<td style="width:20%">Name</td>
|
||||
<td><%= @commissioner.name %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width:20%">Employee Name</td>
|
||||
<td>
|
||||
<%= @commissioner.employee.name rescue '-' %>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width:20%">Commission Type</td>
|
||||
<td><%= @commissioner.commission.menu_item.name rescue '-' %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width:20%">Active</td>
|
||||
<td><%= @commissioner.is_active %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width:20%">Created By</td>
|
||||
<td><%= Employee.find(@commissioner.created_by).name %></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<%= link_to 'Back', settings_commissioners_path, class: 'btn btn-success' %>
|
||||
<%= link_to 'Edit', edit_settings_commissioner_path(@commissioner), class: 'btn btn-info' %>
|
||||
<%= link_to 'Destroy', settings_commissioner_path(@commissioner), method: :delete, data: {confirm: 'Are you sure?'}, class: 'btn btn-danger' %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
1
app/views/settings/commissioners/show.json.jbuilder
Normal file
1
app/views/settings/commissioners/show.json.jbuilder
Normal file
@@ -0,0 +1 @@
|
||||
json.partial! "commissioners/commissioner", commissioner: @commissioner
|
||||
Reference in New Issue
Block a user