update
This commit is contained in:
30
Sean/views/allusers.ejs
Normal file
30
Sean/views/allusers.ejs
Normal file
@ -0,0 +1,30 @@
|
||||
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>All Users</title>
|
||||
<!-- Add any additional styles or dependencies here -->
|
||||
</head>
|
||||
<body>
|
||||
<h2>All Users</h2>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Username</th>
|
||||
<!-- Add additional columns as needed -->
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% for (let i = 0; i < users.length; i++) { %>
|
||||
<tr>
|
||||
<td><%= users[i].username %></td>
|
||||
<!-- Add additional columns as needed -->
|
||||
</tr>
|
||||
<% } %>
|
||||
</tbody>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
@ -1,270 +1,162 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<!-- views/home.ejs -->
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible"
|
||||
content="IE=edge">
|
||||
<meta name="viewport"
|
||||
content="width=device-width,
|
||||
initial-scale=1.0">
|
||||
<title>GeeksForGeeks</title>
|
||||
<link rel="stylesheet"
|
||||
href="style.css">
|
||||
<link rel="stylesheet"
|
||||
href="responsive.css">
|
||||
,
|
||||
</head>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<body>
|
||||
|
||||
<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;
|
||||
}
|
||||
|
||||
<header>
|
||||
#sidebar {
|
||||
height: 100%;
|
||||
width: 250px;
|
||||
position: fixed;
|
||||
background-color: #333;
|
||||
padding-top: 60px;
|
||||
transition: 0.5s;
|
||||
}
|
||||
|
||||
<div class="logosec">
|
||||
<div class="logo">Eco Saver</div>
|
||||
<img src=
|
||||
"https://media.geeksforgeeks.org/wp-content/uploads/20221210182541/Untitled-design-(30).png"
|
||||
class="icn menuicn"
|
||||
id="menuicn"
|
||||
alt="menu-icon">
|
||||
</div>
|
||||
#sidebar img {
|
||||
width: 100%;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
<div class="searchbar">
|
||||
<input type="text"
|
||||
placeholder="Search">
|
||||
<div class="searchbtn">
|
||||
<img src=
|
||||
"https://media.geeksforgeeks.org/wp-content/uploads/20221210180758/Untitled-design-(28).png"
|
||||
class="icn srchicn"
|
||||
alt="search-icon">
|
||||
</div>
|
||||
</div>
|
||||
#sidebar a {
|
||||
padding: 10px 15px;
|
||||
text-decoration: none;
|
||||
font-size: 18px;
|
||||
color: white;
|
||||
display: block;
|
||||
transition: 0.3s;
|
||||
}
|
||||
|
||||
<div class="message">
|
||||
<div class="circle"></div>
|
||||
<img src=
|
||||
"https://media.geeksforgeeks.org/wp-content/uploads/20221210183322/8.png"
|
||||
class="icn"
|
||||
alt="">
|
||||
<div class="dp">
|
||||
<img src=
|
||||
"https://media.geeksforgeeks.org/wp-content/uploads/20221210180014/profile-removebg-preview.png"
|
||||
class="dpicn"
|
||||
alt="dp">
|
||||
</div>
|
||||
</div>
|
||||
#sidebar a:hover {
|
||||
background-color: #555;
|
||||
}
|
||||
|
||||
</header>
|
||||
#content {
|
||||
margin-left: 250px;
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
<div class="main-container">
|
||||
<div class="navcontainer">
|
||||
<nav class="nav">
|
||||
<div class="nav-upper-options">
|
||||
<div class="nav-option option1">
|
||||
<img src=
|
||||
"https://media.geeksforgeeks.org/wp-content/uploads/20221210182148/Untitled-design-(29).png"
|
||||
class="nav-img"
|
||||
alt="dashboard">
|
||||
<h3> Dashboard</h3>
|
||||
</div>
|
||||
@media screen and (max-width: 600px) {
|
||||
#sidebar {
|
||||
width: 0;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
<div class="option2 nav-option">
|
||||
<img src=
|
||||
"https://media.geeksforgeeks.org/wp-content/uploads/20221210183322/9.png"
|
||||
class="nav-img"
|
||||
alt="articles">
|
||||
<h3> Articles</h3>
|
||||
</div>
|
||||
#content {
|
||||
margin-left: 0;
|
||||
}
|
||||
}
|
||||
|
||||
<div class="nav-option option3">
|
||||
<img src=
|
||||
"https://media.geeksforgeeks.org/wp-content/uploads/20221210183320/5.png"
|
||||
class="nav-img"
|
||||
alt="report">
|
||||
<h3> Report</h3>
|
||||
</div>
|
||||
#sidebarCollapse {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
position: absolute;
|
||||
top: 10px;
|
||||
left: 10px;
|
||||
cursor: pointer;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
<div class="nav-option option4">
|
||||
<img src=
|
||||
"https://media.geeksforgeeks.org/wp-content/uploads/20221210183321/6.png"
|
||||
class="nav-img"
|
||||
alt="institution">
|
||||
<h3> Institution</h3>
|
||||
</div>
|
||||
#sidebarCollapse span {
|
||||
display: block;
|
||||
background: white;
|
||||
height: 5px;
|
||||
width: 30px;
|
||||
margin: 6px auto;
|
||||
transition: 0.3s;
|
||||
}
|
||||
|
||||
<div class="nav-option option5">
|
||||
<img src=
|
||||
"https://media.geeksforgeeks.org/wp-content/uploads/20221210183323/10.png"
|
||||
class="nav-img"
|
||||
alt="blog">
|
||||
<h3> Profile</h3>
|
||||
</div>
|
||||
#sidebarCollapse:hover span:nth-child(1) {
|
||||
transform: rotate(-45deg) translate(-5px, 6px);
|
||||
}
|
||||
|
||||
<div class="nav-option option6">
|
||||
<img src=
|
||||
"https://media.geeksforgeeks.org/wp-content/uploads/20221210183320/4.png"
|
||||
class="nav-img"
|
||||
alt="settings">
|
||||
<h3> Settings</h3>
|
||||
</div>
|
||||
#sidebarCollapse:hover span:nth-child(2) {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
<div class="nav-option logout">
|
||||
<img src=
|
||||
"https://media.geeksforgeeks.org/wp-content/uploads/20221210183321/7.png"
|
||||
class="nav-img"
|
||||
alt="logout">
|
||||
<h3>Logout</h3>
|
||||
</div>
|
||||
#sidebarCollapse:hover span:nth-child(3) {
|
||||
transform: rotate(45deg) translate(-5px, -6px);
|
||||
}
|
||||
|
||||
</div>
|
||||
</nav>
|
||||
</div>
|
||||
<div class="main">
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
width: 80%;
|
||||
margin: 20px 0;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
<div class="searchbar2">
|
||||
<input type="text"
|
||||
name=""
|
||||
id=""
|
||||
placeholder="Search">
|
||||
<div class="searchbtn">
|
||||
<img src=
|
||||
"https://media.geeksforgeeks.org/wp-content/uploads/20221210180758/Untitled-design-(28).png"
|
||||
class="icn srchicn"
|
||||
alt="search-button">
|
||||
</div>
|
||||
</div>
|
||||
th, td {
|
||||
border: 1px solid #dddddd;
|
||||
text-align: left;
|
||||
padding: 12px;
|
||||
}
|
||||
|
||||
<div class="box-container">
|
||||
th {
|
||||
background-color: #f2f2f2;
|
||||
}
|
||||
|
||||
<div class="box box1">
|
||||
<div class="text">
|
||||
<h2 class="topic-heading">60.5k</h2>
|
||||
<h2 class="topic">Article Views</h2>
|
||||
</div>
|
||||
tr:hover {
|
||||
background-color: #f5f5f5;
|
||||
}
|
||||
|
||||
<img src=
|
||||
"https://media.geeksforgeeks.org/wp-content/uploads/20221210184645/Untitled-design-(31).png"
|
||||
alt="Views">
|
||||
</div>
|
||||
td {
|
||||
white-space: nowrap;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<div class="box box2">
|
||||
<div class="text">
|
||||
<h2 class="topic-heading">150</h2>
|
||||
<h2 class="topic">Likes</h2>
|
||||
</div>
|
||||
<body>
|
||||
|
||||
<img src=
|
||||
"https://media.geeksforgeeks.org/wp-content/uploads/20221210185030/14.png"
|
||||
alt="likes">
|
||||
</div>
|
||||
<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 class="box box3">
|
||||
<div class="text">
|
||||
<h2 class="topic-heading">320</h2>
|
||||
<h2 class="topic">Comments</h2>
|
||||
</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>
|
||||
|
||||
<img src=
|
||||
"https://media.geeksforgeeks.org/wp-content/uploads/20221210184645/Untitled-design-(32).png"
|
||||
alt="comments">
|
||||
</div>
|
||||
<script>
|
||||
document.getElementById('sidebarCollapse').addEventListener('click', function () {
|
||||
document.getElementById('sidebar').style.width = (document.getElementById('sidebar').style.width === '250px') ? '0' : '250px';
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
<div class="box box4">
|
||||
<div class="text">
|
||||
<h2 class="topic-heading">70</h2>
|
||||
<h2 class="topic">Published</h2>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
<img src=
|
||||
"https://media.geeksforgeeks.org/wp-content/uploads/20221210185029/13.png" alt="published">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="report-container">
|
||||
<div class="report-header">
|
||||
<h1 class="recent-Articles">Recent Articles</h1>
|
||||
<button class="view">View All</button>
|
||||
</div>
|
||||
|
||||
<div class="report-body">
|
||||
<div class="report-topic-heading">
|
||||
<h3 class="t-op">Article</h3>
|
||||
<h3 class="t-op">Views</h3>
|
||||
<h3 class="t-op">Comments</h3>
|
||||
<h3 class="t-op">Status</h3>
|
||||
</div>
|
||||
|
||||
<div class="items">
|
||||
<div class="item1">
|
||||
<h3 class="t-op-nextlvl">Article 73</h3>
|
||||
<h3 class="t-op-nextlvl">2.9k</h3>
|
||||
<h3 class="t-op-nextlvl">210</h3>
|
||||
<h3 class="t-op-nextlvl label-tag">Published</h3>
|
||||
</div>
|
||||
|
||||
<div class="item1">
|
||||
<h3 class="t-op-nextlvl">Article 72</h3>
|
||||
<h3 class="t-op-nextlvl">1.5k</h3>
|
||||
<h3 class="t-op-nextlvl">360</h3>
|
||||
<h3 class="t-op-nextlvl label-tag">Published</h3>
|
||||
</div>
|
||||
|
||||
<div class="item1">
|
||||
<h3 class="t-op-nextlvl">Article 71</h3>
|
||||
<h3 class="t-op-nextlvl">1.1k</h3>
|
||||
<h3 class="t-op-nextlvl">150</h3>
|
||||
<h3 class="t-op-nextlvl label-tag">Published</h3>
|
||||
</div>
|
||||
|
||||
<div class="item1">
|
||||
<h3 class="t-op-nextlvl">Article 70</h3>
|
||||
<h3 class="t-op-nextlvl">1.2k</h3>
|
||||
<h3 class="t-op-nextlvl">420</h3>
|
||||
<h3 class="t-op-nextlvl label-tag">Published</h3>
|
||||
</div>
|
||||
|
||||
<div class="item1">
|
||||
<h3 class="t-op-nextlvl">Article 69</h3>
|
||||
<h3 class="t-op-nextlvl">2.6k</h3>
|
||||
<h3 class="t-op-nextlvl">190</h3>
|
||||
<h3 class="t-op-nextlvl label-tag">Published</h3>
|
||||
</div>
|
||||
|
||||
<div class="item1">
|
||||
<h3 class="t-op-nextlvl">Article 68</h3>
|
||||
<h3 class="t-op-nextlvl">1.9k</h3>
|
||||
<h3 class="t-op-nextlvl">390</h3>
|
||||
<h3 class="t-op-nextlvl label-tag">Published</h3>
|
||||
</div>
|
||||
|
||||
<div class="item1">
|
||||
<h3 class="t-op-nextlvl">Article 67</h3>
|
||||
<h3 class="t-op-nextlvl">1.2k</h3>
|
||||
<h3 class="t-op-nextlvl">580</h3>
|
||||
<h3 class="t-op-nextlvl label-tag">Published</h3>
|
||||
</div>
|
||||
|
||||
<div class="item1">
|
||||
<h3 class="t-op-nextlvl">Article 66</h3>
|
||||
<h3 class="t-op-nextlvl">3.6k</h3>
|
||||
<h3 class="t-op-nextlvl">160</h3>
|
||||
<h3 class="t-op-nextlvl label-tag">Published</h3>
|
||||
</div>
|
||||
|
||||
<div class="item1">
|
||||
<h3 class="t-op-nextlvl">Article 65</h3>
|
||||
<h3 class="t-op-nextlvl">1.3k</h3>
|
||||
<h3 class="t-op-nextlvl">220</h3>
|
||||
<h3 class="t-op-nextlvl label-tag">Published</h3>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="index.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -1,28 +1,64 @@
|
||||
let menuicn = document.querySelector(".menuicn");
|
||||
let nav = document.querySelector(".navcontainer");
|
||||
const express = require('express');
|
||||
const router = express.Router();
|
||||
const mysql = require('mysql');
|
||||
|
||||
menuicn.addEventListener("click", () => {
|
||||
nav.classList.toggle("navclose");
|
||||
})
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
// Fetch recent user logins from your server
|
||||
fetch('/api/recentUserLogins')
|
||||
.then(response => response.json())
|
||||
.then(userLogins => {
|
||||
// Populate the recent user logins section
|
||||
const itemsContainer = document.querySelector('.items');
|
||||
|
||||
userLogins.forEach(userLogin => {
|
||||
const item = document.createElement('div');
|
||||
item.classList.add('item1');
|
||||
item.innerHTML = `
|
||||
<h3 class="t-op-nextlvl">${userLogin.username}</h3>
|
||||
<h3 class="t-op-nextlvl">${userLogin.name}</h3>
|
||||
<h3 class="t-op-nextlvl">${userLogin.email}</h3>
|
||||
<h3 class="t-op-nextlvl label-tag">${userLogin.lastLogin}</h3>
|
||||
`;
|
||||
itemsContainer.appendChild(item);
|
||||
});
|
||||
})
|
||||
.catch(error => console.error('Error fetching recent user logins:', error));
|
||||
});
|
||||
// Replace with your MySQL connection details
|
||||
const mysqlConfig = {
|
||||
host: process.env.host,
|
||||
user: process.env.user,
|
||||
password: process.env.password,
|
||||
database: process.env.database,
|
||||
timezone: 'Z', // Set the timezone to UTC
|
||||
};
|
||||
|
||||
const mysqlConnection = mysql.createConnection(mysqlConfig);
|
||||
|
||||
// Middleware to check if the user is authenticated
|
||||
function isAuthenticated(req, res, next) {
|
||||
if (req.session && req.session.authenticated) {
|
||||
return next();
|
||||
} else {
|
||||
res.redirect('/login');
|
||||
}
|
||||
}
|
||||
|
||||
// InUsers route (renders the InUsers tab)
|
||||
router.get('/', isAuthenticated, (req, res) => {
|
||||
// Fetch all user data from the database
|
||||
const userDataQuery = 'SELECT * FROM users';
|
||||
|
||||
mysqlConnection.query(userDataQuery, (error, userData) => {
|
||||
if (error) {
|
||||
console.error('Error fetching user data:', error);
|
||||
res.status(500).send('Internal Server Error');
|
||||
return;
|
||||
}
|
||||
|
||||
// Render the inusers page with user data
|
||||
res.render('inusers', { userData: userData });
|
||||
});
|
||||
});
|
||||
|
||||
// User Data route
|
||||
router.get('/userdata', isAuthenticated, (req, res) => {
|
||||
// Fetch all user data from the database
|
||||
const userDataQuery = 'SELECT * FROM users';
|
||||
|
||||
mysqlConnection.query(userDataQuery, (error, userData) => {
|
||||
if (error) {
|
||||
console.error('Error fetching user data:', error);
|
||||
res.status(500).send('Internal Server Error');
|
||||
return;
|
||||
}
|
||||
|
||||
// Render the user-data page with user data
|
||||
res.render('user-data', { userData: userData });
|
||||
});
|
||||
});
|
||||
|
||||
// Edit User Data route
|
||||
router.get('/edituserdata', isAuthenticated, (req, res) => {
|
||||
res.render('edit-user-data');
|
||||
});
|
||||
|
||||
module.exports = router;
|
||||
|
208
Sean/views/inusers.ejs
Normal file
208
Sean/views/inusers.ejs
Normal file
@ -0,0 +1,208 @@
|
||||
<!-- views/inusers.ejs -->
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>In-House Users</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);
|
||||
}
|
||||
|
||||
/* Add additional styles specific to inusers.ejs below */
|
||||
#userDataContainer {
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
width: 100%;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
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="#" id="userDataLink">User Data</a>
|
||||
<a href="/inusers/edituserdata">Edit User Data</a>
|
||||
</div>
|
||||
|
||||
<div id="content">
|
||||
<h2>Welcome to the In-House Users Page</h2>
|
||||
|
||||
<div id="userDataContainer">
|
||||
<h3>All Users</h3>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Username</th>
|
||||
<th>Email</th>
|
||||
<th>Password</th>
|
||||
<th>Last Login</th>
|
||||
<th>Job Title</th>
|
||||
<!-- Add more table headers as needed -->
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% if (allUsers && allUsers.length > 0) { %>
|
||||
<% allUsers.forEach(user => { %>
|
||||
<tr>
|
||||
<td><%= user.name %></td>
|
||||
<td><%= user.username %></td>
|
||||
<td><%= user.email %></td>
|
||||
<td><%= user.password %></td>
|
||||
<td><%= new Date(user.lastLogin).toLocaleString('en-US', { timeZone: 'Asia/Singapore' }) %></td>
|
||||
<td><%= user.jobTitle %></td>
|
||||
<!-- Add more table data cells as needed -->
|
||||
</tr>
|
||||
<% }); %>
|
||||
<% } else { %>
|
||||
<tr>
|
||||
<td colspan="6">No users available.</td>
|
||||
</tr>
|
||||
<% } %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<!-- Additional content for In-House Users page goes here -->
|
||||
|
||||
<script src="https://code.jquery.com/jquery-3.6.4.min.js"></script>
|
||||
<script>
|
||||
document.getElementById('sidebarCollapse').addEventListener('click', function () {
|
||||
document.getElementById('sidebar').style.width = (document.getElementById('sidebar').style.width === '250px') ? '0' : '250px';
|
||||
});
|
||||
|
||||
$(document).ready(function () {
|
||||
function displayUserData() {
|
||||
$.ajax({
|
||||
url: '/inusers/userdata',
|
||||
method: 'GET',
|
||||
dataType: 'html',
|
||||
success: function (data) {
|
||||
$('#userDataContainer').html(data);
|
||||
},
|
||||
error: function (error) {
|
||||
console.error('Error fetching user data:', error);
|
||||
// Handle error as needed
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Call the function when the page loads
|
||||
displayUserData();
|
||||
});
|
||||
</script>
|
||||
|
||||
</div>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
Reference in New Issue
Block a user