Files
frigate_counter/templates/index.html
2026-02-14 17:00:37 +07:00

170 lines
4.7 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Frigate Counter Data</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 20px;
background-color: #f5f5f5;
}
.container {
max-width: 1200px;
margin: 0 auto;
background-color: white;
padding: 20px;
border-radius: 8px;
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}
h1 {
color: #333;
text-align: center;
}
.summary {
background-color: #e8f4f8;
padding: 15px;
border-radius: 5px;
margin-bottom: 20px;
}
table {
width: 100%;
border-collapse: collapse;
margin-top: 20px;
}
th, td {
padding: 12px;
text-align: left;
border-bottom: 1px solid #ddd;
}
th {
background-color: #4CAF50;
color: white;
}
tr:hover {
background-color: #f5f5f5;
}
.refresh-btn {
background-color: #4CAF50;
color: white;
padding: 10px 20px;
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 16px;
margin-bottom: 20px;
}
.refresh-btn:hover {
background-color: #45a049;
}
.last-updated {
text-align: center;
color: #666;
font-style: italic;
margin-top: 10px;
}
.matrix-table {
margin-top: 20px;
}
.matrix-table th {
background-color: #2196F3;
}
.matrix-table td {
text-align: center;
}
.matrix-table tr:nth-child(even) {
background-color: #f2f2f2;
}
.matrix-table tr:nth-child(odd) {
background-color: #ffffff;
}
</style>
</head>
<body>
<div class="container">
<h1>Frigate Counter Data</h1>
<div class="summary">
<h2>Counter Summary</h2>
<table id="summary-table">
<thead>
<tr>
<th>Camera Name</th>
<th>Latest Date</th>
<th>Counter Value</th>
</tr>
</thead>
<tbody>
{% for item in summary_data %}
<tr>
<td>{{ item.camera_name }}</td>
<td>{{ item.latest_date }}</td>
<td>{{ item.counter_value }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<div>
<h2>Counter Data by Camera and Date</h2>
<table class="matrix-table">
<thead>
<tr>
<th>Camera Name</th>
{% for date in pivoted_data.dates %}
<th>{{ date }}</th>
{% endfor %}
</tr>
</thead>
<tbody>
{% for row in pivoted_data.matrix %}
<tr>
<td>{{ row.camera_name }}</td>
{% for date in pivoted_data.dates %}
<td>{{ row[date] }}</td>
{% endfor %}
</tr>
{% endfor %}
</tbody>
</table>
</div>
<div>
<h2>Full Counter Data</h2>
<table id="data-table">
<thead>
<tr>
<th>ID</th>
<th>Camera Name</th>
<th>Date</th>
<th>Counter Value</th>
</tr>
</thead>
<tbody>
{% for item in counter_data %}
<tr>
<td>{{ item.id }}</td>
<td>{{ item.camera_name }}</td>
<td>{{ item.date }}</td>
<td>{{ item.counter_value }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<div class="last-updated">
Last updated: {{ current_time.strftime('%Y-%m-%d %H:%M:%S') }}
</div>
</div>
<script>
// Auto-refresh every 30 seconds
setInterval(function() {
location.reload();
}, 30000);
</script>
</body>
</html>