product commission transaction in commissioner
This commit is contained in:
@@ -10,6 +10,10 @@
|
||||
<%= 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/>
|
||||
<%= f.label :joined_date %><br/>
|
||||
<%= f.text_field :joined_date, {class: 'form-control', id: 'joined_date', readonly: true} %><br/>
|
||||
<%= f.label :resigned_date %><br/>
|
||||
<%= f.text_field :resigned_date, {class: 'form-control', id: 'resigned_date', readonly: true} %><br/>
|
||||
<label><%= f.check_box :is_active %> Active </label>
|
||||
</div>
|
||||
<br/>
|
||||
@@ -20,3 +24,19 @@
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
$(document).ready(function () {
|
||||
$('#joined_date').datepicker({
|
||||
format: 'yyyy-mm-dd',
|
||||
autoclose: true
|
||||
});
|
||||
|
||||
$('#resigned_date').datepicker({
|
||||
format: 'yyyy-mm-dd',
|
||||
autoclose: true
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
@@ -16,8 +16,10 @@
|
||||
<th>Name</th>
|
||||
<th>Employee Name</th>
|
||||
<th>Commission type</th>
|
||||
<th>Joined Date</th>
|
||||
<th>Resigned Date</th>
|
||||
<th>Active</th>
|
||||
<th colspan="3"></th>
|
||||
<th colspan="4"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
@@ -29,6 +31,8 @@
|
||||
<%= commissioner.employee.name rescue '-' %>
|
||||
</td>
|
||||
<td><%= commissioner.commission.menu_item.name rescue '-' %></td>
|
||||
<td><%= commissioner.joined_date.utc.getlocal.strftime('%Y-%b-%d') rescue '-' %></td>
|
||||
<td><%= commissioner.resigned_date.utc.getlocal.strftime('%Y-%b-%d') 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>
|
||||
|
||||
@@ -7,41 +7,126 @@
|
||||
</span>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="card">
|
||||
<div class="card-block">
|
||||
<h4 class="card-title">Commissioner</h4>
|
||||
<table class="table">
|
||||
|
||||
<tbody>
|
||||
<!-- Nav tabs -->
|
||||
<ul class="nav nav-tabs" role="tablist">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" data-toggle="tab" href="#info" role="tab">Info</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="tab" href="#transaction" id="transaction_tab" role="tab">Transaction</a>
|
||||
</li>
|
||||
</ul>
|
||||
<!-- Nav tabs - End -->
|
||||
|
||||
<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 class="tab-content">
|
||||
<!--- Panel 0 - Info -->
|
||||
<div class="tab-pane active" id="info" role="tabpanel" style="max-height:670px; overflow:auto">
|
||||
<div class="card">
|
||||
<div class="card-block">
|
||||
<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%">Joined Date</td>
|
||||
<td><%= @commissioner.joined_date.utc.getlocal.strftime('%Y-%b-%d') rescue '-' %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width:20%">Resigned Date</td>
|
||||
<td><%= @commissioner.resigned_date.utc.getlocal.strftime('%Y-%b-%d') 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>
|
||||
</div>
|
||||
<!--- Panel 1 - Transaction -->
|
||||
<div class="tab-pane" id="transaction" role="tabpanel" style="max-height:670px; overflow:auto">
|
||||
<div class="card">
|
||||
<div class="card-block">
|
||||
|
||||
<table class="table" id="myTable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><%= 'Product Type' %></th>
|
||||
<th><%= 'Product Name' %></th>
|
||||
<th><%= 'Qty' %></th>
|
||||
<th><%= 'Price' %></th>
|
||||
<th><%= 'Amount' %></th>
|
||||
<th><%= 'Date' %></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<br/>
|
||||
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function () {
|
||||
|
||||
$("#transaction_tab").click(function () {
|
||||
get_transaction();
|
||||
});
|
||||
|
||||
function get_transaction() {
|
||||
var commissioner_id = <%= @commissioner.id %>
|
||||
paramlist = 'commissioner_id=' + commissioner_id ;
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: '<%= settings_get_transaction_by_commissioner_path() %>',
|
||||
data: paramlist,
|
||||
success: function (data) {
|
||||
// $('#myTable').DataTable().destroy();
|
||||
$('#myTable tbody > tr').remove();
|
||||
$.each(data, function (i, item) {
|
||||
tr = "<tr>" + "<td>" + data[i][0].product_type + "</td>" + "<td>" + data[i][1] + "</td>" + "<td>" + data[i][0].qty + "</td>" + "<td>" + data[i][0].price + "</td>" + "<td>" + data[i][0].amount + "</td>" + "<td>" + new Date(data[i][0].updated_at).toISOString().split('T')[0] + "</td>" + "</tr>";
|
||||
$('#myTable tbody').append(tr);
|
||||
});
|
||||
// $('#myTable').DataTable({
|
||||
// data: data,
|
||||
// columns: [
|
||||
// {data: 'product_type'},
|
||||
// {data: 'product_code'},
|
||||
// {data: 'commission_id'},
|
||||
// {data: 'qty'},
|
||||
// {data: 'price'},
|
||||
// {data: 'amount'}
|
||||
// ],
|
||||
// "order": [[0, "desc"]]
|
||||
// });
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user