mp/Sean/views/home.ejs
2023-12-17 19:19:27 +08:00

163 lines
3.1 KiB
Plaintext

<!-- views/home.ejs -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Home</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<style>
body {
margin: 0;
font-family: 'Arial', sans-serif;
}
#sidebar {
height: 100%;
width: 250px;
position: fixed;
background-color: #333;
padding-top: 60px;
transition: 0.5s;
}
#sidebar img {
width: 100%;
margin-bottom: 20px;
}
#sidebar a {
padding: 10px 15px;
text-decoration: none;
font-size: 18px;
color: white;
display: block;
transition: 0.3s;
}
#sidebar a:hover {
background-color: #555;
}
#content {
margin-left: 250px;
padding: 16px;
}
@media screen and (max-width: 600px) {
#sidebar {
width: 0;
overflow-x: hidden;
}
#content {
margin-left: 0;
}
}
#sidebarCollapse {
width: 40px;
height: 40px;
position: absolute;
top: 10px;
left: 10px;
cursor: pointer;
z-index: 1;
}
#sidebarCollapse span {
display: block;
background: white;
height: 5px;
width: 30px;
margin: 6px auto;
transition: 0.3s;
}
#sidebarCollapse:hover span:nth-child(1) {
transform: rotate(-45deg) translate(-5px, 6px);
}
#sidebarCollapse:hover span:nth-child(2) {
opacity: 0;
}
#sidebarCollapse:hover span:nth-child(3) {
transform: rotate(45deg) translate(-5px, -6px);
}
table {
border-collapse: collapse;
width: 80%;
margin: 20px 0;
font-size: 16px;
}
th, td {
border: 1px solid #dddddd;
text-align: left;
padding: 12px;
}
th {
background-color: #f2f2f2;
}
tr:hover {
background-color: #f5f5f5;
}
td {
white-space: nowrap;
}
</style>
</head>
<body>
<div id="sidebar">
<img src="LOGO.PNG" alt="Custom Image">
<div id="sidebarCollapse">
<span></span>
<span></span>
<span></span>
</div>
<a href="/inusers">In-House Users</a>
<a href="#">Users</a>
<a href="#">Data Analysis</a>
<a href="#">Logout</a>
</div>
<div id="content">
<h2>Welcome to the Home Page, <%= username %>!</h2>
<h3>Last 10 Logins:</h3>
<table>
<thead>
<tr>
<th>Username</th>
<th>Last Login Time</th>
</tr>
</thead>
<tbody>
<% loginLogs.forEach(log => { %>
<tr>
<td><%= log.username %></td>
<td><%= new Date(log.lastLogin).toLocaleString('en-US', { timeZone: 'Asia/Singapore' }) %></td>
</tr>
<% }); %>
</tbody>
</table>
<script>
document.getElementById('sidebarCollapse').addEventListener('click', function () {
document.getElementById('sidebar').style.width = (document.getElementById('sidebar').style.width === '250px') ? '0' : '250px';
});
</script>
</div>
</body>
</html>