CRUDcommissioner

This commit is contained in:
yamin
2017-08-21 16:12:59 +06:30
parent 3b5eb532d3
commit 25e6039a9f
10 changed files with 105 additions and 33 deletions

View File

@@ -2,6 +2,10 @@
<%= f.error_notification %>
<div class="form-inputs">
<%= f.input :name %>
<%= f.collection_select :emp_id, Employee.all.order('name asc'), :emp_id, :name, {prompt: "Select an Employee"}, {class: "form-control"} %>
<%= f.input :commission_type %>
<label><%= f.check_box :is_active %> Active </label>
</div>
<div class="form-actions">

View File

@@ -1,6 +1,10 @@
<h1>Editing Commissioner</h1>
<%= render 'form', commissioner: @commissioner %>
<%= link_to 'Show', @commissioner %> |
<%= link_to 'Back', commissioners_path %>
<div class="span12">
<div class="page-header">
<ul class="breadcrumb">
<li><a href="<%= root_path %>">Home</a></li>
<li><a href="<%= commissioners_path %>">Commissioners</a></li>
<li>Edit</li>
</ul>
</div>
<%= render 'form', commissioner: @commissioner %>
</div>

View File

@@ -1,25 +1,46 @@
<p id="notice"><%= notice %></p>
<div class="page-header">
<ul class="breadcrumb">
<li><a href="<%= %>">Home</a></li>
<li>Commissioner</li>
<span style="float: right">
<%= link_to t('.new', :default => t("helpers.links.new")),new_commissioner_path,:class => 'btn btn-primary btn-sm' %>
</span>
</ul>
</div>
<h1>Commissioners</h1>
<table>
<thead>
<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>Created By</th>
<th colspan="3"></th>
</tr>
</thead>
</thead>
<tbody>
<tbody>
<% @commissioners.each do |commissioner| %>
<tr>
<td><%= link_to 'Show', commissioner %></td>
<td><%= commissioner.name %></td>
<td>
<% if Employee.exists? %>
<% employee = Employee.where('emp_id=?',commissioner.emp_id) %>
<%= employee[0].name %>
<% end %>
</td>
<td><%= commissioner.commission_type %></td>
<td><%= commissioner.is_active %></td>
<td><%= current_user.name %></td>
<td><%= link_to 'Show', commissioner_path(commissioner) %></td>
<td><%= link_to 'Edit', edit_commissioner_path(commissioner) %></td>
<td><%= link_to 'Destroy', commissioner, method: :delete, data: { confirm: 'Are you sure?' } %></td>
<td><%= link_to 'Destroy', commissioner_path(commissioner), method: :delete, data: { confirm: 'Are you sure?' } %></td>
</tr>
<% end %>
</tbody>
</table>
<br>
<%= link_to 'New Commissioner', new_commissioner_path %>
</table>
</div>

View File

@@ -1,5 +1,10 @@
<h1>New Commissioner</h1>
<%= render 'form', commissioner: @commissioner %>
<%= link_to 'Back', commissioners_path %>
<div class="span12">
<div class="page-header">
<ul class="breadcrumb">
<li><a href="<%= root_path %>">Home</a></li>
<li><a href="<%= commissioners_path %>">Commissioners</a></li>
<li>New</li>
</ul>
</div>
<%= render 'form', commissioner: @commissioner %>
</div>

View File

@@ -1,4 +1,39 @@
<p id="notice"><%= notice %></p>
<div class="page-header">
<ul class="breadcrumb">
<li><a href="<%= root_path %>">Home</a></li>
<li><a href="<%= commissioners_path %>">Commissioners</a></li>
<%= link_to 'Edit', edit_commissioner_path(@commissioner) %> |
<%= link_to 'Back', commissioners_path %>
<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>
<% if Employee.exists? %>
<% employee = Employee.where('emp_id=?',@commissioner.emp_id) %>
<%= employee[0].name %>
<% end %>
</td></tr>
<tr><td style="width:20%">Commission Type</td><td><%= @commissioner.commission_type %></td></tr>
<tr><td style="width:20%">Active</td><td><%= @commissioner.is_active %></td></tr>
<tr><td style="width:20%">Created By</td><td><%= current_user.name %></td></tr>
<tr><td style="width:20%"><%= link_to 'Edit', edit_commissioner_path(@commissioner) %></td><td><%= link_to 'Destroy', commissioner_path(@commissioner), method: :delete, data: { confirm: 'Are you sure?' } %></td></tr>
</tbody>
</table>
</div>
</div>
</div>

View File

@@ -28,6 +28,7 @@
<li><%= link_to "Print Setting", print_settings_path, :tabindex =>"-1" %></li>
<hr class="hr_advance" />
<li><%= link_to "Employees", settings_employees_path, :tabindex =>"-1" %></li>
<li><%= link_to "Commissioners", commissioners_path, :tabindex =>"-1" %></li>
<hr class="hr_advance" />
<li><%= link_to "Accounts", settings_accounts_path, :tabindex =>"-1" %></li>
<hr class="hr_advance" />