add new file

This commit is contained in:
Sunandar
2017-02-06 18:32:22 +06:30
parent 90eeb2ea1c
commit 5c78a2ca8a
13 changed files with 54 additions and 120 deletions

View File

@@ -5,32 +5,7 @@
</nav>
</div>
<div class="row top-content">
<% flash.each do |name, msg| %>
<div class="alert alert-danger">
<a class="close" data-dismiss="alert">×</a>
<%= msg %>
</div>
<% end %>
<br><br>
<%= form_tag export_path(:format => :csv),:method => :post do%>
<div class="col-lg-4">
</div>
<div class="col-lg-3">
<%= select_tag "client", options_from_collection_for_select(@clients, "id", "name"),:class => 'form-control'%>
</div>
<div class="col-lg-5">
<label><strong>Choose Batch:</strong></label>
<select class='selectpicker' id='batch' name='batch[]' multiple= "multiple" >
<!--<% @batches.each do |batch| %>
<option value="<%= batch.id %>"><%= batch.order_ref %></option>
<% end %> -->
</select>
&nbsp; &nbsp;
<%= button_tag "Export CSV",:class =>'btn btn-primary btn-sm',:id =>"btnexport" %>
</div>
<% end %>
</div>
<div class="row content">
<div class="card">
<div class="card-header">
@@ -68,34 +43,3 @@
</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();
$("#batch").append("<option value='all'>ALL</option>")
$.each(result.data, function (i, item){
$("#batch").append("<option value="+item.id+">"+ item.order_ref +"</option>")
});
$('#batch').multiselect("refresh");
$("#batch").multiselect('rebuild');
}
}
});
}
})
</script>