add filter for dashboard
This commit is contained in:
@@ -67,21 +67,23 @@
|
||||
<!-- CPU Usage -->
|
||||
|
||||
<!-- Date range for dashboard -->
|
||||
<!-- <div class="row clearfix">
|
||||
<div class="row clearfix">
|
||||
<div class="col-lg-4 col-md-4 col-sm-4">
|
||||
<label class="font-14"><%= t("views.right_panel.detail.from") %></label>
|
||||
<input data-behaviour='datepicker' class="form-control datepicker" name="from" id="from" type="text" placeholder="From date" style="height: 35px;">
|
||||
<input data-behaviour='datepicker' class="form-control datepicker" name="from" id="from" type="text" value="<%= Time.now.utc.strftime('%d-%m-%Y') %>" placeholder="From date" style="height: 35px;">
|
||||
<span id="fromErr" style="color:red;"></span>
|
||||
</div>
|
||||
<div class="col-lg-4 col-md-4 col-sm-4">
|
||||
<label class="font-14"><%= t("views.right_panel.detail.to") %></label>
|
||||
<input data-behaviour='datepicker' class="form-control datepicker" name="to" id="to" type="text" placeholder="To date" style="height: 35px;">
|
||||
<input data-behaviour='datepicker' class="form-control datepicker" name="to" id="to" type="text" value="<%= Time.now.utc.strftime('%d-%m-%Y') %>" placeholder="To date" style="height: 35px;">
|
||||
<span id="toErr" style="color:red;"></span>
|
||||
</div>
|
||||
<div class="col-lg-2 col-md-2 col-sm-2">
|
||||
<label></label><br>
|
||||
<input type="button" value="Generate" class='btn btn-primary btn_generate'>
|
||||
</div>
|
||||
</div>
|
||||
<br> -->
|
||||
<br>
|
||||
<!-- Date range for dashboard -->
|
||||
|
||||
<div class="row">
|
||||
@@ -315,4 +317,39 @@
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
var from = '<%= @from.strftime('%d-%m-%Y') rescue '' %>';
|
||||
var to = '<%= @to.strftime('%d-%m-%Y') rescue '' %>';
|
||||
|
||||
if((from!=undefined) && (from != null) && (from != '')){
|
||||
$('#from').val(from);
|
||||
}
|
||||
if((to!=undefined) && (to != null) && (to != '')){
|
||||
$('#to').val(to);
|
||||
}
|
||||
});
|
||||
|
||||
$('.btn_generate').on('click',function(){
|
||||
var from = $("#from").val();
|
||||
var to = $("#to").val();
|
||||
if((from=='') && (to=='')){
|
||||
$('#fromErr').html("can't be blank");
|
||||
$('#toErr').html("can't be blank");
|
||||
}else if((from!='') && (to=='')){
|
||||
$('#fromErr').html("");
|
||||
$('#toErr').html("can't be blank");
|
||||
}else if((from=='') && (to!='')){
|
||||
$('#fromErr').html("can't be blank");
|
||||
$('#toErr').html("");
|
||||
}else{
|
||||
$('#fromErr').html("");
|
||||
$('#toErr').html("");
|
||||
}
|
||||
if((from!='') && (to!='')){
|
||||
window.location.href = '/dashboard?from='+from+'&to='+to;
|
||||
}
|
||||
});
|
||||
</script>
|
||||
Reference in New Issue
Block a user