WeatherStation/Program/templates/history.html
2024-05-05 21:27:17 +02:00

135 lines
3.0 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Database Contents</title>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<!-- <link rel="stylesheet" href="/css"> -->
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
}
.container {
max-width: 800px;
margin: 20px auto;
padding: 20px;
border: 1px solid #ccc;
border-radius: 5px;
}
h1 {
text-align: center;
}
table {
width: 100%;
border-collapse: collapse;
}
th, td {
padding: 8px;
text-align: left;
border-bottom: 1px solid #ddd;
}
tr:hover {
background-color: #f2f2f2;
}
.btn-container {
text-align: center;
margin-top: 20px;
}
.btn {
padding: 10px 20px;
font-size: 16px;
text-decoration: none;
color: #fff;
background-color: #007bff;
border: none;
border-radius: 5px;
cursor: pointer;
}
.btn:hover {
background-color: #0056b3;
}
</style>
</head>
<body>
<div class="btn-container">
<a href="/" class="btn">Dashboard</a>
<a href="/history" class="btn">View History</a>
<a href="/adm" class="btn">Admin</a>
</div>
<h1>Database Contents</h1>
<h2>{{ sensor[0] }}</h2>
<table border="1">
<tr>
<th>Id</th>
<th>Sensor</th>
<th>Timestamp</th>
<th>Temp</th>
<th>HR</th>
<th>Bat</th>
</tr>
{% for row in S1 %}
<tr>
<td>{{ row[0] }}</td>
<td>{{ row[1] }}</td>
<td>{{ row[2] }}</td>
<td>{{ row[3] }}</td>
<td>{{ row[4] }}</td>
<td>{{ row[5] }}</td>
</tr>
{% endfor %}
</table>
<h2>{{ sensor[1] }}</h2>
<table border="1">
<tr>
<th>Id</th>
<th>Sensor</th>
<th>Timestamp</th>
<th>Temp</th>
<th>HR</th>
<th>Bat</th>
</tr>
{% for row in S2 %}
<tr>
<td>{{ row[0] }}</td>
<td>{{ row[1] }}</td>
<td>{{ row[2] }}</td>
<td>{{ row[3] }}</td>
<td>{{ row[4] }}</td>
<td>{{ row[5] }}</td>
</tr>
{% endfor %}
</table>
<h2>{{ sensor[2] }}</h2>
<table border="1">
<tr>
<th>Id</th>
<th>Sensor</th>
<th>Timestamp</th>
<th>Temp</th>
<th>HR</th>
<th>Bat</th>
</tr>
{% for row in S3 %}
<tr>
<td>{{ row[0] }}</td>
<td>{{ row[1] }}</td>
<td>{{ row[2] }}</td>
<td>{{ row[3] }}</td>
<td>{{ row[4] }}</td>
<td>{{ row[5] }}</td>
</tr>
{% endfor %}
</table>
<script>
// Refresh the page every 10 seconds
setTimeout(function(){
location.reload();
}, 20000);
</script>
</body>
</html>