Adding individual statistics/data-dumps
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
|
||||
<div class="payment_links <%= "payment-highlighted" if params[:flash] == "welcome_msg" %>">
|
||||
|
||||
<%= render '/statistics/index' %>
|
||||
<% if can? :read, resource.payments then %>
|
||||
<h3>Recorded Payments:</h3>
|
||||
<ul>
|
||||
|
||||
6
app/views/statistics/_index.html.erb
Normal file
6
app/views/statistics/_index.html.erb
Normal file
@@ -0,0 +1,6 @@
|
||||
<h2>Your Statistical Data</h2>
|
||||
|
||||
<ul>
|
||||
<li><%= link_to 'MAC Address Data', mac_statistics_path %></li>
|
||||
<li><%= link_to 'Card Access Data', door_statistics_path %></li>
|
||||
</ul>
|
||||
63
app/views/statistics/door_log.html.erb
Normal file
63
app/views/statistics/door_log.html.erb
Normal file
@@ -0,0 +1,63 @@
|
||||
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
|
||||
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
|
||||
<script src="http://code.highcharts.com/highcharts.js"></script>
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
|
||||
$( "#graph" ).dialog({
|
||||
autoOpen: false,
|
||||
height: 325,
|
||||
width: 525,
|
||||
modal: true,
|
||||
});
|
||||
$( "#graph-button" ).click(function() {
|
||||
$( "#graph" ).dialog( "open" );
|
||||
});
|
||||
|
||||
$('#graph').highcharts({
|
||||
chart: {
|
||||
type: 'column',
|
||||
zoomType : 'x'
|
||||
},
|
||||
title: {
|
||||
style : { fontSize: '10px' },
|
||||
text: "Click and Drag to Zoom, Click the Legend to Turn Off Items"
|
||||
},
|
||||
xAxis: {
|
||||
title : { text : "Days" },
|
||||
type : 'datetime'
|
||||
},
|
||||
yAxis : {
|
||||
title : {
|
||||
text : "Hours"
|
||||
}
|
||||
},
|
||||
series: [{
|
||||
name: "Accesses",
|
||||
data: <%= raw @door_log_graph.to_json %>
|
||||
}]
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
<div id="graph" title="MAC Presence by Day" style="height: 250px; width: 500px; float: right;"></div>
|
||||
|
||||
<h2>Your Card Access Data</h2>
|
||||
<button id="graph-button" class="btn">View Graph</button>
|
||||
<%= link_to 'Download JSON', door_statistics_path+".json", :class => 'btn' %>
|
||||
<table>
|
||||
<tr>
|
||||
<th>Date</th>
|
||||
<th>Action</th>
|
||||
<th>Card # (hex)</th>
|
||||
</tr>
|
||||
<% @door_logs.each do |log| %>
|
||||
<tr>
|
||||
<td><%= log.created_at %></td>
|
||||
<td><%= log.key %></td>
|
||||
<td><%= log.data.to_s(16) %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</table>
|
||||
1
app/views/statistics/index.html.erb
Normal file
1
app/views/statistics/index.html.erb
Normal file
@@ -0,0 +1 @@
|
||||
<%= render 'index' %>
|
||||
70
app/views/statistics/mac_log.html.erb
Normal file
70
app/views/statistics/mac_log.html.erb
Normal file
@@ -0,0 +1,70 @@
|
||||
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
|
||||
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
|
||||
<script src="http://code.highcharts.com/highcharts.js"></script>
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
|
||||
$( "#graph" ).dialog({
|
||||
autoOpen: false,
|
||||
height: 325,
|
||||
width: 525,
|
||||
modal: true,
|
||||
});
|
||||
$( "#graph-button" ).click(function() {
|
||||
$( "#graph" ).dialog( "open" );
|
||||
});
|
||||
|
||||
$('#graph').highcharts({
|
||||
chart: {
|
||||
type: 'column',
|
||||
zoomType : 'x'
|
||||
},
|
||||
title: {
|
||||
style : { fontSize: '10px' },
|
||||
text: "Click and Drag to Zoom, Click the Legend to Turn Off Items"
|
||||
},
|
||||
xAxis: {
|
||||
title : { text : "Days" },
|
||||
type : 'datetime'
|
||||
},
|
||||
yAxis : {
|
||||
title : {
|
||||
text : "Hours"
|
||||
}
|
||||
},
|
||||
series: [
|
||||
<% @mac_log_graph.each do |mac, graph, element| %>
|
||||
{
|
||||
name: "<%= raw mac %>",
|
||||
data: <%= raw graph.to_json %>
|
||||
},
|
||||
<% end %>
|
||||
]
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
<div id="graph" title="MAC Presence by Day" style="height: 250px; width: 500px; float: right;"></div>
|
||||
|
||||
|
||||
<h2>Your Mac Address Data</h2>
|
||||
<button id="graph-button" class="btn">View Graph</button>
|
||||
<%= link_to 'Download JSON', mac_statistics_path+".json", :class => 'btn' %>
|
||||
<table>
|
||||
<tr>
|
||||
<th>Date</th>
|
||||
<th>Action</th>
|
||||
<th>MAC</th>
|
||||
<th>IP</th>
|
||||
</tr>
|
||||
<% @mac_logs.each do |log| %>
|
||||
<tr>
|
||||
<td><%= log.created_at %></td>
|
||||
<td><%= log.action %></td>
|
||||
<td><%= log.mac %></td>
|
||||
<td><%= log.ip %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</table>
|
||||
Reference in New Issue
Block a user