90 lines
2.1 KiB
Plaintext
90 lines
2.1 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>
|
|
<a href="/dashboard">Dashboard</a>
|
|
<a href="/acl/add">Add New Entry</a>
|
|
<a href="/acl/bulk-add" style="margin-left: 20px;" disabled title="Bulk add is currently disabled">Add from reader</a>
|
|
<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>
|
|
<% }); %>
|
|
<th>Actions</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<% acl.forEach(function(row) { %>
|
|
<tr>
|
|
<td><%= row.Name %></td>
|
|
<td><%= row.CardNumber %></td>
|
|
<td><%= row.PIN %></td>
|
|
<td><%= row.StartDate ? new Date(row.StartDate).toISOString().slice(0,10) : '' %></td>
|
|
<td><%= row.EndDate ? new Date(row.EndDate).toISOString().slice(0,10) : '' %></td>
|
|
<% doors.forEach(function(door) { %>
|
|
<td>
|
|
<% if (row[door]) { %>
|
|
✅
|
|
<% } else { %>
|
|
❌
|
|
<% } %>
|
|
</td>
|
|
<% }); %>
|
|
<td>
|
|
<a href="/acl/edit/<%= row.CardNumber %>">Edit</a> |
|
|
<a href="/acl/delete/<%= row.CardNumber %>" onclick="return confirm('Are you sure you want to delete this entry?');">Delete</a>
|
|
</td>
|
|
</tr>
|
|
<% }); %>
|
|
</tbody>
|
|
</table>
|
|
</body>
|
|
</html> |