UI Admin aproape finalizat
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 298 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 4.2 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 19 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 30 KiB |
@@ -0,0 +1,108 @@
|
||||
body, html {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
|
||||
font-family: "Roboto", sans-serif;
|
||||
font-weight: 500;
|
||||
font-style: normal;
|
||||
|
||||
background-image: url('/images/background.png');
|
||||
background-size: cover;
|
||||
background-repeat: no-repeat;
|
||||
|
||||
}
|
||||
|
||||
.container {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-evenly;
|
||||
align-items: center;
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
.header{
|
||||
color: #1B1A55;
|
||||
font-size: 4vh;
|
||||
text-transform: uppercase;
|
||||
line-height: 2.5rem;
|
||||
margin-bottom: 10rem;
|
||||
}
|
||||
|
||||
.login-form {
|
||||
background-color: #535C91;
|
||||
opacity: 71;
|
||||
padding: 9vh 3vh 5vh;
|
||||
border-radius: 1rem;
|
||||
box-shadow: 10px 10px 10px rgba(0, 0, 0, 0.9);
|
||||
width: 25%;
|
||||
}
|
||||
|
||||
.login-form-title{
|
||||
margin: 0 0 5vh 0;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.login-form-title h2{
|
||||
color: #FFFFFF;
|
||||
font-size: 5vh;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.login-form hr{
|
||||
width: 40%;
|
||||
}
|
||||
|
||||
.login-form-content{
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
input {
|
||||
text-align: center;
|
||||
color: white;
|
||||
font-weight: bold;
|
||||
font-size: 1.2rem;
|
||||
width: 70%;
|
||||
padding: 1rem;
|
||||
margin: 0.7rem;
|
||||
background-color: #1B1A55;
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
button {
|
||||
font-weight: bold;
|
||||
width: 35%;
|
||||
font-size: 1rem;
|
||||
padding: 10px;
|
||||
border: none;
|
||||
border-radius: 5px;
|
||||
margin-top: 1rem;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
button:hover{
|
||||
filter: brightness(85%);
|
||||
}
|
||||
|
||||
.login-form-footer{
|
||||
margin-top: 3vh;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-content: center;
|
||||
align-items: center;
|
||||
justify-content: space-evenly;
|
||||
}
|
||||
|
||||
button[name="submit"] {
|
||||
background-color: #F44336;
|
||||
color: white;
|
||||
}
|
||||
|
||||
button[name="signin"] {
|
||||
background-color: #2196F3;
|
||||
color: white;
|
||||
}
|
||||
@@ -0,0 +1,187 @@
|
||||
body, html {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
|
||||
font-family: "Roboto", sans-serif;
|
||||
font-weight: 500;
|
||||
font-style: normal;
|
||||
|
||||
background-image: url('/images/background.png');
|
||||
background-size: cover;
|
||||
background-repeat: no-repeat;
|
||||
|
||||
}
|
||||
|
||||
.overlay {
|
||||
display: none;
|
||||
position: fixed;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background-color: rgba(0, 0, 0, 0.85);
|
||||
z-index: 2;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.ceo-validation-form {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
width: 300px;
|
||||
padding: 20px;
|
||||
background: #1B1A55;
|
||||
border-radius: 10px;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.ceo-validation-form h2 {
|
||||
text-align: center;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.form-actions {
|
||||
text-align: center;
|
||||
padding-top: 20px;
|
||||
}
|
||||
|
||||
.form-actions button {
|
||||
padding: 10px 20px;
|
||||
margin: 0 10px;
|
||||
border: none;
|
||||
border-radius: 5px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
input {
|
||||
text-align: center;
|
||||
color: white;
|
||||
font-weight: bold;
|
||||
font-size: 1.2rem;
|
||||
width: 80%;
|
||||
padding: 1rem;
|
||||
margin: 0.7rem;
|
||||
background-color: #1B1A55;
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
#back_button {
|
||||
background-color: #f44336;
|
||||
width: 35%;
|
||||
height: auto;
|
||||
color: white;
|
||||
}
|
||||
|
||||
#submit_button {
|
||||
background-color: #4CAF50;
|
||||
width: 35%;
|
||||
height: auto;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.container {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-evenly;
|
||||
align-items: center;
|
||||
min-height: 100vh;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.main_block{
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
background-color: #535C91;
|
||||
opacity: 71;
|
||||
padding: 2rem;
|
||||
border-radius: 1rem;
|
||||
box-shadow: 10px 10px 10px rgba(0, 0, 0, 0.9);
|
||||
color: white;
|
||||
}
|
||||
|
||||
.header{
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.header h1{
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.header img{
|
||||
margin: 0 3vw 0 5vw;
|
||||
width: 8vw;
|
||||
height: 8vw;
|
||||
}
|
||||
|
||||
.content{
|
||||
margin: 2rem 0 2rem 0;
|
||||
}
|
||||
|
||||
.content_buttons{
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-content: center;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
button{
|
||||
margin: 0 1rem 0 1rem;
|
||||
width: 15vw;
|
||||
height: 10vh;
|
||||
|
||||
border: none;
|
||||
border-radius: 10px;
|
||||
|
||||
color: white;
|
||||
font-size: 1rem;
|
||||
font-weight: bold;
|
||||
|
||||
text-transform: uppercase;
|
||||
cursor: pointer;
|
||||
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
|
||||
outline: none;
|
||||
transition: background-color 0.3s ease;
|
||||
}
|
||||
|
||||
button:hover{
|
||||
filter: brightness(85%);
|
||||
}
|
||||
|
||||
.footer{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: end;
|
||||
}
|
||||
|
||||
button[name="logout"]{
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
width: 10vw;
|
||||
height: 5vh;
|
||||
background-color: #F44336;
|
||||
}
|
||||
|
||||
button[name="alert"]{
|
||||
margin: 0.7rem;
|
||||
background-color: #F44336;
|
||||
}
|
||||
|
||||
button[name="notification"]{
|
||||
margin: 0.7rem;
|
||||
background-color: #23BDEE;
|
||||
}
|
||||
|
||||
button[name="menu_button"]{
|
||||
margin: 0.7rem;
|
||||
background-color: #1B1A55;
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="icon" href="/images/hard-disk.ico" type="image/x-icon">
|
||||
<link rel="stylesheet" type="text/css" href="/css/login.css">
|
||||
<script src="/js/login.js"></script>
|
||||
<title>Login</title>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<div class="header">
|
||||
<h1>DO WE KNOW</h1>
|
||||
<h1>EACH OTHER?</h1>
|
||||
</div>
|
||||
<form id="loginForm" class="login-form">
|
||||
<div class="login-form-title">
|
||||
<h2>Login</h2>
|
||||
<hr>
|
||||
</div>
|
||||
<div class="login-form-content">
|
||||
<input type="email" name="email" placeholder="Email">
|
||||
<input type="password" name="password" placeholder="Password">
|
||||
</div>
|
||||
<div class="login-form-footer">
|
||||
<button id="submit" type="submit" name="submit">Submit</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,40 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="icon" href="/images/hard-disk.ico" type="image/x-icon">
|
||||
<link rel="stylesheet" href="/css/main_menu.css">
|
||||
|
||||
<script src="/js/main_menu.js"></script>
|
||||
|
||||
<title>Main Page</title>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<div class="main_block">
|
||||
<div class="header">
|
||||
<div>
|
||||
<h1>WELCOME BACK,</h1>
|
||||
<h1 id="username_field"></h1>
|
||||
<h2>Hope you have a productive day!</h2>
|
||||
</div>
|
||||
<img src="/images/user_1144760.png" alt="profile image">
|
||||
</div>
|
||||
<div class="content">
|
||||
<div class="content_buttons">
|
||||
<button id="start_uc" name="menu_button">Start UC</button>
|
||||
<button id="stop_uc" name="menu_button">Stop UC</button>
|
||||
</div>
|
||||
<div class="content_buttons">
|
||||
<button id="ceo_info" name="menu_button">Get CEO Info</button>
|
||||
<button id="set_conf" name="menu_button">Set Server Conf File</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="footer">
|
||||
<button id="logout" name="logout">Logout</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,38 @@
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
const loginForm = document.getElementById('loginForm');
|
||||
|
||||
loginForm.addEventListener('submit', async function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
const formData = new FormData(loginForm);
|
||||
const email = formData.get('email');
|
||||
const password = formData.get('password');
|
||||
|
||||
const data = { email, password };
|
||||
|
||||
try {
|
||||
const response = await fetch('/login', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify(data),
|
||||
});
|
||||
|
||||
const result = await response.json();
|
||||
|
||||
if (response.ok && result.success) {
|
||||
// Set cookie with email and name
|
||||
document.cookie = `email=${result.user.email};`;
|
||||
document.cookie = `name=${result.user.name};`;
|
||||
|
||||
window.location.href = '/';
|
||||
} else {
|
||||
alert('Incorrect credentials. Please try again.');
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Error during fetch:', error);
|
||||
alert('An error occurred. Please try again.');
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,82 @@
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
function getCookie(name) {
|
||||
const cookies = document.cookie.split(';');
|
||||
for (let i = 0; i < cookies.length; i++) {
|
||||
const cookie = cookies[i].trim();
|
||||
if (cookie.startsWith(name + '=')) {
|
||||
return cookie.substring(name.length + 1, cookie.length);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
const username = getCookie('name'); // Using 'name' to match your cookie structure
|
||||
const usernameField = document.getElementById('username_field');
|
||||
if (usernameField && username) {
|
||||
usernameField.textContent = username;
|
||||
}else{
|
||||
usernameField.textContent = 'Admin';
|
||||
}
|
||||
|
||||
// Define handler function
|
||||
function handleButtonClick(event) {
|
||||
console.log(`${event.target.id} button was clicked`);
|
||||
// Implement specific logic for each button here
|
||||
}
|
||||
|
||||
// Attach event handlers to specific buttons
|
||||
const startUcButton = document.getElementById('start_uc');
|
||||
const stopUcButton = document.getElementById('stop_uc');
|
||||
const ceoInfoButton = document.getElementById('ceo_info');
|
||||
const setConfButton = document.getElementById('set_conf');
|
||||
const logoutButton = document.getElementById('logout');
|
||||
|
||||
startUcButton.addEventListener('click', () => {
|
||||
console.log('Start UC Button pressed');
|
||||
fetch('/server', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify({ action: 'start' }),
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(data => alert(data.message))
|
||||
.catch(error => console.error('Error:', error));
|
||||
});
|
||||
|
||||
stopUcButton.addEventListener('click', () => {
|
||||
console.log('Stop UC Button pressed');
|
||||
fetch('/server', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify({ action: 'stop' }),
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(data => alert(data.message))
|
||||
.catch(error => console.error('Error:', error));
|
||||
});
|
||||
|
||||
ceoInfoButton.addEventListener('click', () => {
|
||||
console.log('Ceo Info Button pressed');
|
||||
})
|
||||
|
||||
setConfButton.addEventListener('click', () => {
|
||||
console.log('Set Conf Button pressed');
|
||||
})
|
||||
|
||||
logoutButton.addEventListener('click', function() {
|
||||
console.log('Logout button was clicked');
|
||||
|
||||
const deleteCookie = (name) => {
|
||||
document.cookie = `${name}=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/; Secure`;
|
||||
}
|
||||
|
||||
deleteCookie('email');
|
||||
deleteCookie('name');
|
||||
|
||||
window.location.href = '/login';
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user