-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
95 lines (83 loc) · 2.36 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>SpynPro Classes Data</title>
<style>
/* General table styling */
table {
width: 100%;
border-collapse: collapse;
font-family: Arial, sans-serif; /* Use a more readable font */
}
th, td {
padding: 15px;
text-align: left;
border-bottom: 1px solid #ddd;
}
/* Header styling */
th {
background-color: #f2f2f2;
color: #333;
}
/* Alternating row colors */
tr:nth-child(even) {
background-color: #f5f5f5;
}
/* Hover effect for rows */
tr:hover {
background-color: #f0dbdb;
}
/* Remove hover effect for header */
th:hover {
background-color: #f2f2f2;
}
@media screen and (max-width: 600px) {
table {
display: block;
width: 100%;
overflow-x: auto;
}
}
</style>
</head>
<body>
<table>
<thead>
<tr>
<th>Date</th>
<th>Class</th>
<th>Names (Reserved + Present)</th>
<th>Count (Reserved + Present)</th>
</tr>
</thead>
<tbody id="tableBody">
<!-- Data will be populated here -->
</tbody>
</table>
<script>
function fetchData() {
fetch('http://127.0.0.1:5000/fetch_data')
.then(response => response.json())
.then(data => {
let html = '';
for (let entry of data) {
const allNames = [...entry.reserved_usernames, ...entry.present_usernames];
html += `<tr>
<td>${entry.date}</td>
<td>${entry.class_title}</td>
<td>${allNames.join(', ')}</td>
<td>${allNames.length}</td>
</tr>`;
}
document.getElementById('tableBody').innerHTML = html;
});
}
// Fetch data on page load
fetchData();
// Refresh data every 1 minute (60,000 milliseconds)
setInterval(fetchData, 60000);
</script>
</body>
</html>