edit
This commit is contained in:
@@ -1,60 +0,0 @@
|
||||
<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>
|
||||
<a class="breadcrumb-item active" href="#">Export CSV</a>
|
||||
</nav>
|
||||
</div>
|
||||
<div class="row content">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<strong>Export CSV</strong>
|
||||
</div>
|
||||
<div class="card-block">
|
||||
<%= 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-6">
|
||||
<label><strong>Select Batch:</strong></label><br>
|
||||
<select class='selectpicker' id='batch' name='batch[]' multiple= "multiple"></select>
|
||||
<%= button_tag "Export CSV",:class =>'btn btn-primary btn-sm',:id =>"btnexport" %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="spacer-30"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
client_id=$("#client").val();
|
||||
get_batch(client_id)
|
||||
$('#client').on('change', function() {
|
||||
client_id=$(this).val()
|
||||
get_batch(client_id)
|
||||
});
|
||||
function get_batch(client_id){
|
||||
$('#batch').multiselect('disable');
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: '<%= get_batch_path %>',
|
||||
dataType: "json",
|
||||
data : {'client_id':client_id },
|
||||
success: function(result){
|
||||
if (result.status){
|
||||
$('#batch').multiselect('enable');
|
||||
$("#batch").empty();
|
||||
$.each(result.data, function (i, item){
|
||||
$("#batch").append("<option value="+item.id+">"+ item.order_ref +"</option>")
|
||||
});
|
||||
$('#batch').multiselect("refresh");
|
||||
$("#batch").multiselect('rebuild');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
})
|
||||
</script>
|
||||
@@ -4,14 +4,38 @@
|
||||
<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-6">
|
||||
<label><strong>Select Batch:</strong></label><br>
|
||||
<select class='selectpicker' id='batch' name='batch[]' multiple= "multiple"></select>
|
||||
<%= 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>
|
||||
<div class="col-lg-4" id="loading">
|
||||
<img src="<%= asset_path( 'spinner.gif' ) %>" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row content">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<strong>Batch Line Item List</strong>
|
||||
</div>
|
||||
<div class="card-block">
|
||||
<div class="card-block">
|
||||
<% flash.each do |key, value| %>
|
||||
<div class="alert alert-danger center">
|
||||
<a class="close" data-dismiss="alert">×</a>
|
||||
<%= value %>
|
||||
</div>
|
||||
<% end %>
|
||||
<div id ="filterrific_results">
|
||||
<table class="table" style="border-top:none">
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -39,7 +63,72 @@
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
<%=paginate @batchLineItems %>
|
||||
<%=paginate @batchLineItems %>
|
||||
<div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
$('#loading').hide();
|
||||
client_id=$("#client").val();
|
||||
get_batch(client_id)
|
||||
$('#client').on('change', function() {
|
||||
client_id=$(this).val()
|
||||
get_batch(client_id)
|
||||
});
|
||||
function get_batch(client_id){
|
||||
$('#batch').multiselect('disable');
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: '<%= get_batch_path %>',
|
||||
dataType: "json",
|
||||
data : {'client_id':client_id },
|
||||
success: function(result){
|
||||
if (result.status){
|
||||
$('#batch').multiselect('enable');
|
||||
$("#batch").empty();
|
||||
$.each(result.data, function (i, item){
|
||||
$("#batch").append("<option value="+item.id+">"+ item.order_ref +"</option>")
|
||||
});
|
||||
$('#batch').multiselect("refresh");
|
||||
$("#batch").multiselect('rebuild');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
$("#client" ).on('change', function(){
|
||||
client=$(this).val();
|
||||
batch=$("#batch").val();
|
||||
filter(client,batch);
|
||||
})
|
||||
$('#batch').change(function(){
|
||||
client=$("#client").val();
|
||||
batch=$(this).val();
|
||||
filter(client,batch);
|
||||
|
||||
});
|
||||
function filter(client,batch){
|
||||
if (batch==null){
|
||||
batch=""
|
||||
}
|
||||
paramlist='client='+client+"&batch="+batch
|
||||
$.ajax({
|
||||
type:'GET',
|
||||
url: '<%= filter_path %>',
|
||||
data:paramlist,
|
||||
beforeSend: function(){
|
||||
$('#loading').show();
|
||||
},
|
||||
complete: function(){
|
||||
$('#loading').hide();
|
||||
},
|
||||
success: function(data) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user