This commit is contained in:
BIG2EYEZ 2023-12-18 01:01:41 +08:00
parent e84b97fe40
commit e8bc6f9e82
4 changed files with 523 additions and 485 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.8 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View File

@ -7,120 +7,9 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>In-House Users</title> <title>In-House Users</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"> <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/5.3.0/css/bootstrap.min.css">
<script src="https://code.jquery.com/jquery-3.6.4.min.js"></script> <link rel="stylesheet" href="/style.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.17.4/xlsx.full.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.17.5/xlsx.full.min.js"></script>
<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> </head>
<body> <body>
@ -133,7 +22,8 @@
<span></span> <span></span>
</div> </div>
<a href="#" id="userDataLink">User Data</a> <a href="#" id="userDataLink">User Data</a>
<a href="/inusers/edituserdata">Edit User Data</a> <a href="#" id="addUserLink">Add User</a>
<a href="#" id="deleteUserLink">Delete User</a>
<a href="/home" id="homeLink">Home</a> <a href="/home" id="homeLink">Home</a>
</div> </div>
@ -153,7 +43,6 @@
<th>Password</th> <th>Password</th>
<th>Last Login</th> <th>Last Login</th>
<th>Job Title</th> <th>Job Title</th>
<!-- Add more table headers as needed -->
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -166,7 +55,6 @@
<td><%= user.password %></td> <td><%= user.password %></td>
<td><%= new Date(user.lastLogin).toLocaleString('en-US', { timeZone: 'Asia/Singapore' }) %></td> <td><%= new Date(user.lastLogin).toLocaleString('en-US', { timeZone: 'Asia/Singapore' }) %></td>
<td><%= user.jobTitle %></td> <td><%= user.jobTitle %></td>
<!-- Add more table data cells as needed -->
</tr> </tr>
<% }); %> <% }); %>
<% } else { %> <% } else { %>
@ -177,71 +65,135 @@
</tbody> </tbody>
</table> </table>
</div> </div>
<div class="container">
<div class="title">Registration</div>
<div class="content">
<form action="#">
<div class="user-details">
<div class="input-box">
<span class="details">Full Name</span>
<input type="text" placeholder="Enter your name" required>
</div>
<div class="input-box">
<span class="details">Username</span>
<input type="text" placeholder="Enter your username" required>
</div>
<div class="user-creation-container">
<div class="input-box">
<span class="details">Email</span>
<input type="text" placeholder="Enter your email" required>
</div>
<div class="input-box">
<span class="details">Phone Number</span>
<input type="text" placeholder="Enter your number" required>
</div>
<div class="input-box">
<span class="details">Password</span>
<input type="text" placeholder="Enter your password" required>
</div>
<div class="input-box">
<span class="details">Confirm Password</span>
<input type="text" placeholder="Confirm your password" required>
</div>
</div>
<div class="gender-details">
<input type="radio" name="gender" id="dot-1">
<input type="radio" name="gender" id="dot-2">
<input type="radio" name="gender" id="dot-3">
<span class="gender-title">Gender</span>
<div class="category">
<label for="dot-1">
<span class="dot one"></span>
<span class="gender">Male</span>
</label>
<label for="dot-2">
<span class="dot two"></span>
<span class="gender">Female</span>
</label>
<label for="dot-3">
<span class="dot three"></span>
<span class="gender">Prefer not to say</span>
</label>
</div>
</div>
<div class="button">
<input type="submit" value="Register">
</div>
</form>
</div>
</div>
</div>
<!-- Additional content for In-House Users page goes here --> <!-- Your existing script tags -->
<!-- Additional content for In-House Users page goes here --> <script src="https://code.jquery.com/jquery-3.6.4.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/5.3.0/js/bootstrap.bundle.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.17.4/xlsx.full.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/FileSaver.js/2.0.5/FileSaver.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/exceljs/4.2.1/exceljs.min.js"></script>
<!-- Additional content for In-House Users page goes here --> <script>
<!-- Additional content for In-House Users page goes here -->
<script>
// Use the JSON data provided by the server
const allUsers = <%- JSON.stringify(allUsers) %>; const allUsers = <%- JSON.stringify(allUsers) %>;
// Attach click event to the download button
document.getElementById('downloadButton').addEventListener('click', function () { document.getElementById('downloadButton').addEventListener('click', function () {
console.log('Download button clicked'); console.log('Download button clicked');
downloadExcel(allUsers); downloadExcel(allUsers);
}); });
// Function to download data as Excel document.getElementById('addUserLink').addEventListener('click', function () {
document.getElementById('downloadButtonContainer').style.display = 'none';
document.getElementById('userDataContainer').style.display = 'none';
document.getElementById('createUserForm').style.display = 'block';
});
document.getElementById('userDataLink').addEventListener('click', function () {
document.getElementById('downloadButtonContainer').style.display = 'block';
document.getElementById('userDataContainer').style.display = 'block';
document.getElementById('createUserForm').style.display = 'none';
});
document.getElementById('userForm').addEventListener('submit', function (event) {
event.preventDefault();
const formData = new FormData(this);
const newUser = {};
formData.forEach((value, key) => {
newUser[key] = value;
});
console.log('New User:', newUser);
// You can send the newUser data to your server here
});
function downloadExcel(allUsers) { function downloadExcel(allUsers) {
if (allUsers && allUsers.length > 0) { if (allUsers && allUsers.length > 0) {
const data = allUsers.map(user => [ const workbook = new ExcelJS.Workbook();
user.name, const worksheet = workbook.addWorksheet('All Users');
user.username, const headers = ['Name', 'Username', 'Email', 'Password', 'Last Login', 'Job Title'];
user.email, worksheet.addRow(headers);
user.password, allUsers.forEach(user => {
new Date(user.lastLogin).toLocaleString('en-US', { timeZone: 'Asia/Singapore' }), const rowData = [
user.jobTitle user.name || '',
]); user.username || '',
user.email || '',
const ws = XLSX.utils.aoa_to_sheet([['Name', 'Username', 'Email', 'Password', 'Last Login', 'Job Title'], ...data]); user.password || '',
const wb = XLSX.utils.book_new(); user.lastLogin ? new Date(user.lastLogin).toLocaleString('en-US', { timeZone: 'Asia/Singapore' }) : '',
XLSX.utils.book_append_sheet(wb, ws, 'All Users'); user.jobTitle || ''
];
// Use the correct MIME type for the blob worksheet.addRow(rowData);
const blob = XLSX.write(wb, { bookType: 'xlsx', mimeType: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' }); });
workbook.xlsx.writeBuffer().then(buffer => {
// Create a Blob containing the Excel file data const currentDate = new Date();
const blobData = new Blob([blob], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' }); const formattedDate = currentDate.toISOString().split('T')[0];
const formattedTime = currentDate.toTimeString().split(' ')[0].replace(/:/g, '-');
// Create a Blob URL const fileName = `user_data_${formattedDate}_${formattedTime}.xlsx`;
const blobUrl = URL.createObjectURL(blobData); const blob = new Blob([buffer], {
type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
// Create an anchor element and trigger the download });
const a = document.createElement('a'); saveAs(blob, fileName);
a.href = blobUrl; });
a.download = 'user_data.xlsx';
document.body.appendChild(a);
a.click();
// Clean up resources
document.body.removeChild(a);
URL.revokeObjectURL(blobUrl);
} else { } else {
console.error('No data available for download.'); console.error('No data available for download.');
} }
} }
</script>
</script>
</div> </div>

146
Sean/views/loginstyle.css Normal file
View File

@ -0,0 +1,146 @@
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@200;300;400;500;600;700&display=swap');
*{
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: 'Poppins',sans-serif;
}
body{
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
padding: 10px;
background: linear-gradient(135deg, #71b7e6, #9b59b6);
}
.container{
max-width: 700px;
width: 100%;
background-color: #fff;
padding: 25px 30px;
border-radius: 5px;
box-shadow: 0 5px 10px rgba(0,0,0,0.15);
}
.container .title{
font-size: 25px;
font-weight: 500;
position: relative;
}
.container .title::before{
content: "";
position: absolute;
left: 0;
bottom: 0;
height: 3px;
width: 30px;
border-radius: 5px;
background: linear-gradient(135deg, #71b7e6, #9b59b6);
}
.content form .user-details{
display: flex;
flex-wrap: wrap;
justify-content: space-between;
margin: 20px 0 12px 0;
}
form .user-details .input-box{
margin-bottom: 15px;
width: calc(100% / 2 - 20px);
}
form .input-box span.details{
display: block;
font-weight: 500;
margin-bottom: 5px;
}
.user-details .input-box input{
height: 45px;
width: 100%;
outline: none;
font-size: 16px;
border-radius: 5px;
padding-left: 15px;
border: 1px solid #ccc;
border-bottom-width: 2px;
transition: all 0.3s ease;
}
.user-details .input-box input:focus,
.user-details .input-box input:valid{
border-color: #9b59b6;
}
form .gender-details .gender-title{
font-size: 20px;
font-weight: 500;
}
form .category{
display: flex;
width: 80%;
margin: 14px 0 ;
justify-content: space-between;
}
form .category label{
display: flex;
align-items: center;
cursor: pointer;
}
form .category label .dot{
height: 18px;
width: 18px;
border-radius: 50%;
margin-right: 10px;
background: #d9d9d9;
border: 5px solid transparent;
transition: all 0.3s ease;
}
#dot-1:checked ~ .category label .one,
#dot-2:checked ~ .category label .two,
#dot-3:checked ~ .category label .three{
background: #9b59b6;
border-color: #d9d9d9;
}
form input[type="radio"]{
display: none;
}
form .button{
height: 45px;
margin: 35px 0
}
form .button input{
height: 100%;
width: 100%;
border-radius: 5px;
border: none;
color: #fff;
font-size: 18px;
font-weight: 500;
letter-spacing: 1px;
cursor: pointer;
transition: all 0.3s ease;
background: linear-gradient(135deg, #71b7e6, #9b59b6);
}
form .button input:hover{
/* transform: scale(0.99); */
background: linear-gradient(-135deg, #71b7e6, #9b59b6);
}
@media(max-width: 584px){
.container{
max-width: 100%;
}
form .user-details .input-box{
margin-bottom: 15px;
width: 100%;
}
form .category{
width: 100%;
}
.content form .user-details{
max-height: 300px;
overflow-y: scroll;
}
.user-details::-webkit-scrollbar{
width: 5px;
}
}
@media(max-width: 459px){
.container .content .category{
flex-direction: column;
}
}

View File

@ -1,335 +1,275 @@
/* Main CSS Here */
@import url(
"https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap");
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: "Poppins", sans-serif;
}
:root {
--background-color1: #fafaff;
--background-color2: #ffffff;
--background-color3: #ededed;
--background-color4: #cad7fda4;
--primary-color: #4b49ac;
--secondary-color: #0c007d;
--Border-color: #3f0097;
--one-use-color: #3f0097;
--two-use-color: #5500cb;
}
body { body {
background-color: var(--background-color4); margin: 0;
max-width: 100%; font-family: 'Arial', sans-serif;
overflow-x: hidden; }
}
header { #sidebar {
height: 70px; height: 100%;
width: 100vw; width: 250px;
padding: 0 30px; position: fixed;
background-color: var(--background-color1); background-color: #333;
position: fixed; padding-top: 60px;
z-index: 100; transition: 0.5s;
box-shadow: 1px 1px 15px rgba(161, 182, 253, 0.825); }
display: flex;
justify-content: space-between;
align-items: center;
}
.logo { #sidebar img {
font-size: 27px; width: 100%;
font-weight: 600; margin-bottom: 20px;
color: rgb(47, 141, 70); }
}
.icn { #sidebar a {
height: 30px; padding: 10px 15px;
} text-decoration: none;
.menuicn { font-size: 18px;
cursor: pointer; color: white;
} display: block;
transition: 0.3s;
}
.searchbar, #sidebar a:hover {
.message, background-color: #555;
.logosec { }
display: flex;
align-items: center;
justify-content: center;
}
.searchbar2 { #content {
display: none; margin-left: 250px;
} padding: 16px;
}
.logosec { @media screen and (max-width: 600px) {
gap: 60px; #sidebar {
} width: 0;
overflow-x: hidden;
}
.searchbar input { #content {
width: 250px; margin-left: 0;
height: 42px; }
border-radius: 50px 0 0 50px; }
background-color: var(--background-color3);
padding: 0 20px;
font-size: 15px;
outline: none;
border: none;
}
.searchbtn {
width: 50px;
height: 42px;
display: flex;
align-items: center;
justify-content: center;
border-radius: 0px 50px 50px 0px;
background-color: var(--secondary-color);
cursor: pointer;
}
.message { #sidebarCollapse {
gap: 40px; width: 40px;
position: relative; height: 40px;
cursor: pointer; position: absolute;
} top: 10px;
.circle { left: 10px;
height: 7px; cursor: pointer;
width: 7px; z-index: 1;
position: absolute; }
background-color: #fa7bb4;
border-radius: 50%;
left: 19px;
top: 8px;
}
.dp {
height: 40px;
width: 40px;
background-color: #626262;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
overflow: hidden;
}
.main-container {
display: flex;
width: 100vw;
position: relative;
top: 70px;
z-index: 1;
}
.dpicn {
height: 42px;
}
.main { #sidebarCollapse span {
height: calc(100vh - 70px); display: block;
width: 100%; background: white;
overflow-y: scroll; height: 5px;
overflow-x: hidden; width: 30px;
padding: 40px 30px 30px 30px; margin: 6px auto;
} transition: 0.3s;
}
.main::-webkit-scrollbar-thumb { #sidebarCollapse:hover span:nth-child(1) {
background-image: transform: rotate(-45deg) translate(-5px, 6px);
linear-gradient(to bottom, rgb(0, 0, 85), rgb(0, 0, 50)); }
}
.main::-webkit-scrollbar {
width: 5px;
}
.main::-webkit-scrollbar-track {
background-color: #9e9e9eb2;
}
.box-container { #sidebarCollapse:hover span:nth-child(2) {
display: flex; opacity: 0;
justify-content: space-evenly; }
align-items: center;
flex-wrap: wrap;
gap: 50px;
}
.nav {
min-height: 91vh;
width: 250px;
background-color: var(--background-color2);
position: absolute;
top: 0px;
left: 00;
box-shadow: 1px 1px 10px rgba(198, 189, 248, 0.825);
display: flex;
flex-direction: column;
justify-content: space-between;
overflow: hidden;
padding: 30px 0 20px 10px;
}
.navcontainer {
height: calc(100vh - 70px);
width: 250px;
position: relative;
overflow-y: scroll;
overflow-x: hidden;
transition: all 0.5s ease-in-out;
}
.navcontainer::-webkit-scrollbar {
display: none;
}
.navclose {
width: 80px;
}
.nav-option {
width: 250px;
height: 60px;
display: flex;
align-items: center;
padding: 0 30px 0 20px;
gap: 20px;
transition: all 0.1s ease-in-out;
}
.nav-option:hover {
border-left: 5px solid #a2a2a2;
background-color: #dadada;
cursor: pointer;
}
.nav-img {
height: 30px;
}
.nav-upper-options { #sidebarCollapse:hover span:nth-child(3) {
display: flex; transform: rotate(45deg) translate(-5px, -6px);
flex-direction: column; }
align-items: center;
gap: 30px;
}
.option1 { #userDataContainer {
border-left: 5px solid #010058af; margin-top: 20px;
background-color: var(--Border-color); }
color: white;
cursor: pointer;
}
.option1:hover {
border-left: 5px solid #010058af;
background-color: var(--Border-color);
}
.box {
height: 130px;
width: 230px;
border-radius: 20px;
box-shadow: 3px 3px 10px rgba(0, 30, 87, 0.751);
padding: 20px;
display: flex;
align-items: center;
justify-content: space-around;
cursor: pointer;
transition: transform 0.3s ease-in-out;
}
.box:hover {
transform: scale(1.08);
}
.box:nth-child(1) { table {
background-color: var(--one-use-color); border-collapse: collapse;
} width: 100%;
.box:nth-child(2) { margin-top: 20px;
background-color: var(--two-use-color); }
}
.box:nth-child(3) {
background-color: var(--one-use-color);
}
.box:nth-child(4) {
background-color: var(--two-use-color);
}
.box img { th,
height: 50px; td {
} border: 1px solid #dddddd;
.box .text { text-align: left;
color: white; padding: 12px;
} }
.topic {
font-size: 13px;
font-weight: 400;
letter-spacing: 1px;
}
.topic-heading { th {
font-size: 30px; background-color: #f2f2f2;
letter-spacing: 3px; }
}
.report-container { tr:hover {
min-height: 300px; background-color: #f5f5f5;
max-width: 1200px; }
margin: 70px auto 0px auto;
background-color: #ffffff;
border-radius: 30px;
box-shadow: 3px 3px 10px rgb(188, 188, 188);
padding: 0px 20px 20px 20px;
}
.report-header {
height: 80px;
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
padding: 20px 20px 10px 20px;
border-bottom: 2px solid rgba(0, 20, 151, 0.59);
}
.recent-Articles { td {
font-size: 30px; white-space: nowrap;
font-weight: 600; }
color: #5500cb;
}
.view { .dropdown {
height: 35px; display: block;
width: 90px; margin-top: 20px;
border-radius: 8px; }
background-color: #5500cb;
color: white;
font-size: 15px;
border: none;
cursor: pointer;
}
.report-body { .dropdown-toggle {
max-width: 1160px; color: white;
overflow-x: auto; background-color: #333;
padding: 20px; border: 1px solid #555;
} padding: 10px 15px;
.report-topic-heading, text-decoration: none;
.item1 { font-size: 18px;
width: 1120px; display: block;
display: flex; width: 100%;
justify-content: space-between; text-align: left;
align-items: center; }
}
.t-op {
font-size: 18px;
letter-spacing: 0px;
}
.items { .dropdown-toggle:hover {
width: 1120px; background-color: #555;
margin-top: 15px; }
}
.item1 { .dropdown-menu {
margin-top: 20px; background-color: #333;
} }
.t-op-nextlvl {
font-size: 14px; .dropdown-item {
letter-spacing: 0px; color: white;
font-weight: 600; }
}
.dropdown-item:hover {
background-color: #555;
}
/* Additional styles for Bootstrap form */
form {
max-width: 400px;
margin: auto;
}
.mb-3 {
margin-bottom: 1rem;
}
.btn-primary {
background-color: #007bff;
border-color: #007bff;
}
.btn-primary:hover {
background-color: #0056b3;
border-color: #0056b3;
}
/* style.css */
.user-creation-container .input-box {
margin-bottom: 15px;
width: calc(100% / 2 - 20px);
}
.user-creation-container .input-box span.details {
display: block;
font-weight: 500;
margin-bottom: 5px;
}
.user-creation-container .user-details .input-box input {
height: 45px;
width: 100%;
outline: none;
font-size: 16px;
border-radius: 5px;
padding-left: 15px;
border: 1px solid #ccc;
border-bottom-width: 2px;
transition: all 0.3s ease;
}
.user-creation-container .user-details .input-box input:focus,
.user-creation-container .user-details .input-box input:valid {
border-color: #9b59b6;
}
.user-creation-container form .gender-details .gender-title {
font-size: 20px;
font-weight: 500;
}
.user-creation-container form .category {
display: flex;
width: 80%;
margin: 14px 0;
justify-content: space-between;
}
.user-creation-container form .category label {
display: flex;
align-items: center;
cursor: pointer;
}
.user-creation-container form .category label .dot {
height: 18px;
width: 18px;
border-radius: 50%;
margin-right: 10px;
background: #d9d9d9;
border: 5px solid transparent;
transition: all 0.3s ease;
}
#dot-1:checked ~ .user-creation-container form .category label .one,
#dot-2:checked ~ .user-creation-container form .category label .two,
#dot-3:checked ~ .user-creation-container form .category label .three {
background: #9b59b6;
border-color: #d9d9d9;
}
.user-creation-container form input[type="radio"] {
display: none;
}
.user-creation-container form .button {
height: 45px;
margin: 35px 0;
}
.user-creation-container form .button input {
height: 100%;
width: 100%;
border-radius: 5px;
border: none;
color: #fff;
font-size: 18px;
font-weight: 500;
letter-spacing: 1px;
cursor: pointer;
transition: all 0.3s ease;
background: linear-gradient(135deg, #71b7e6, #9b59b6);
}
.user-creation-container form .button input:hover {
background: linear-gradient(-135deg, #71b7e6, #9b59b6);
}
@media (max-width: 584px) {
.user-creation-container .user-details .input-box {
margin-bottom: 15px;
width: 100%;
}
.user-creation-container form .category {
width: 100%;
}
.user-creation-container .content form .user-details {
max-height: 300px;
overflow-y: scroll;
}
.user-creation-container .user-details::-webkit-scrollbar {
width: 5px;
}
}
@media (max-width: 459px) {
.user-creation-container .container .content .category {
flex-direction: column;
}
}
.label-tag {
width: 100px;
text-align: center;
background-color: rgb(0, 177, 0);
color: white;
border-radius: 4px;
}