uhppoted-db-web/views/acl.ejs

82 lines
1.6 KiB
Plaintext

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Access Control List</title>
<style>
body {
font-family: Arial, sans-serif;
background: #f7f7f7;
margin: 0;
padding: 20px;
}
h1 {
text-align: center;
color: #333;
}
table {
width: 100%;
border-collapse: collapse;
background: #fff;
box-shadow: 0 2px 8px rgba(0,0,0,0.05);
margin: 20px auto;
}
th, td {
padding: 10px 12px;
border: 1px solid #ddd;
text-align: center;
}
th {
background: #f0f0f0;
color: #444;
}
tr:nth-child(even) {
background: #fafafa;
}
</style>
</head>
<body>
<h1>Access Control List</h1>
<table>
<thead>
<tr>
<th>Name</th>
<th>CardNumber</th>
<th>PIN</th>
<th>StartDate</th>
<th>EndDate</th>
<%
// Get door columns by filtering keys not in known columns
const knownCols = ['Name', 'CardNumber', 'PIN', 'StartDate', 'EndDate'];
const doors = acl.length > 0
? Object.keys(acl[0]).filter(col => !knownCols.includes(col))
: [];
doors.forEach(function(door) {
%>
<th><%= door %></th>
<% }); %>
</tr>
</thead>
<tbody>
<% acl.forEach(function(row) { %>
<tr>
<td><%= row.Name %></td>
<td><%= row.CardNumber %></td>
<td><%= row.PIN %></td>
<td><%= row.StartDate %></td>
<td><%= row.EndDate %></td>
<% doors.forEach(function(door) { %>
<td>
<% if (row[door]) { %>
<% } else { %>
<% } %>
</td>
<% }); %>
</tr>
<% }); %>
</tbody>
</table>
</body>
</html>