mp/Sean/views/home.ejs
BIG2EYEZ e538a5fb6e f
2024-01-01 15:18:26 +08:00

109 lines
2.0 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;
}
#navbar {
background-color: #333;
overflow: hidden;
text-align: center;
}
#navbar h1 {
color: white;
padding: 14px 16px;
margin: 0;
font-size: 24px;
}
#navbar a {
display: inline-block;
color: white;
text-align: center;
padding: 14px 16px;
text-decoration: none;
font-size: 18px;
}
#navbar a:hover {
background-color: #555;
}
#content {
padding: 16px;
text-align: center;
}
table {
border-collapse: collapse;
width: 80%;
margin: 20px auto;
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="navbar">
<h1>Eco Saver</h1>
<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>
</div>
</body>
</html>