search in batches

This commit is contained in:
May Zin Oo
2017-10-25 11:42:56 +06:30
parent dce9c48eef
commit 87b340328e
8 changed files with 294 additions and 107 deletions

View File

@@ -1,26 +1,25 @@
<div class="row ">
<nav class="breadcrumb">
<a class="breadcrumb-item active" href="<%= dashboard_path %>">Home</a>
<a class="breadcrumb-item active" href="#">Batch Line Item List</a>
</nav>
<nav class="breadcrumb">
<a class="breadcrumb-item active" href="<%= dashboard_path %>">Home</a>
<a class="breadcrumb-item active" href="#">Batch Line Item List</a>
</nav>
</div>
<div class="row content">
<%= form_tag export_path(:format => :csv),:method => :post do%>
<div class="col-lg-4">
<label><strong>Select Client:</strong></label>
<%= select_tag "client", options_from_collection_for_select(@clients, "id", "name"), :class => 'form-control'%>
</div>
<div class="col-lg-4">
<label><strong>Select Product:</strong></label>
<%= select_tag "product_category", options_from_collection_for_select(@product_categories, "id", "name"), :class => 'form-control'%>
</div>
<div class="col-lg-4">
<label><strong>Select Batch:</strong></label><br>
<select class='selectpicker' id='batch' name='batch[]' multiple= "multiple"></select> &nbsp; &nbsp;
<%= button_tag "Export csv?",:class =>'btn btn-primary btn-sm',:id =>"btnexport" %>
</div>
<% end %>
<%= form_tag export_path(:format => :csv),:method => :post do%>
<div class="col-lg-4">
<label><strong>Select Client:</strong></label>
<%= select_tag "client", options_from_collection_for_select(@clients, "id", "name"), :class => 'form-control'%>
</div>
<div class="col-lg-4">
<label><strong>Select Product:</strong></label>
<%= select_tag "product_category", options_from_collection_for_select(@product_categories, "id", "name"), :class => 'form-control'%>
</div>
<div class="col-lg-4">
<label><strong>Select Batch:</strong></label><br>
<select class='selectpicker' id='batch' name='batch[]' multiple= "multiple"></select> &nbsp; &nbsp;
<%= button_tag "Export csv?",:class =>'btn btn-primary btn-sm',:id =>"btnexport" %>
</div>
<% end %>
</div>
<div class="row show_image">
<div class="col-lg-6"></div>
@@ -29,52 +28,51 @@
</div>
</div>
<div class="row content">
<div class="card">
<div class="card-header">
<strong>Batch Line Item List</strong>
</div>
<div class="card-block">
<% flash.each do |key, value| %>
<% if key =='message' %>
<div class="alert alert-danger center">
<a class="close" data-dismiss="alert">×</a>
<%= value %>
<% end %>
</div>
<% end %>
<div id ="filterrific_results">
<table class="table" style="border-top:none">
<thead>
<tr>
<th>Serial No</th>
<th>Asset Identity</th>
<th>Manufacture UID</th>
<th>Batch No</th>
<th>Asset Type</th>
<th>Created At </th>
<th>Update At </th>
</tr>
</thead>
<tbody>
<% @batchLineItems.each do |item| %>
<tr>
<td><%= item.serial_no rescue '' %></td>
<td><%= item.asset_identity rescue '' %></td>
<td><%= item.manufacture_uid rescue '' %></td>
<td><%= item.batch_name rescue '' %></td>
<td><%= item.asset_type rescue '' %></td>
<td><%= item.created_at.strftime("%e,%b %Y %I:%M %p") rescue '' %></td>
<td><%= item.updated_at.strftime("%e,%b %Y %I:%M %p") rescue '' %></td>
</tr>
<% end %>
</tbody>
</table>
<%=paginate @batchLineItems %>
<div>
<div class="card">
<div class="card-header">
<strong>Batch Line Item List</strong>
</div>
<div class="card-block">
<% flash.each do |key, value| %>
<% if key =='message' %>
<div class="alert alert-danger center">
<a class="close" data-dismiss="alert">×</a>
<%= value %>
<% end %>
</div>
<% end %>
<div id ="filterrific_results">
<table class="table" style="border-top:none">
<thead>
<tr>
<th>Serial No</th>
<th>Asset Identity</th>
<th>Manufacture UID</th>
<th>Batch No</th>
<th>Asset Type</th>
<th>Created At </th>
<th>Update At </th>
</tr>
</thead>
<tbody>
<% @batchLineItems.each do |item| %>
<tr>
<td><%= item.serial_no rescue '' %></td>
<td><%= item.asset_identity rescue '' %></td>
<td><%= item.manufacture_uid rescue '' %></td>
<td><%= item.batch_name rescue '' %></td>
<td><%= item.asset_type rescue '' %></td>
<td><%= item.created_at.strftime("%e,%b %Y %I:%M %p") rescue '' %></td>
<td><%= item.updated_at.strftime("%e,%b %Y %I:%M %p") rescue '' %></td>
</tr>
<% end %>
</tbody>
</table>
<%=paginate @batchLineItems %>
<div>
</div>
</div>
</div>
</div>
<script type="text/javascript">
$(document).ready(function(){
$('#loading').hide();
@@ -133,7 +131,7 @@ $(document).ready(function(){
function filter(client,product_category,batch){
if (batch==null){
batch=""
}
}
paramlist='client='+client+"&product_category="+product_category+"&batch="+batch
$.ajax({
@@ -147,7 +145,6 @@ $(document).ready(function(){
$('#loading').hide();
},
success: function(data) {
}
});
}