Primo commit

This commit is contained in:
2026-01-13 11:20:12 +01:00
parent ce9e2fdf2a
commit 17453f5d13
51 changed files with 3883 additions and 2508 deletions

View File

@@ -1,5 +1,6 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
@@ -7,31 +8,33 @@
<link rel="icon" type="image/svg+xml" href="/favicon.svg">
<link rel="stylesheet" href="/css/styles.css">
</head>
<body>
<aside class="sidebar">
<div class="sidebar-header">
<h1>Parking Manager</h1>
<h1>Gestione Parcheggi</h1>
</div>
<nav class="sidebar-nav"></nav>
<div class="sidebar-footer">
<div class="user-menu">
<button class="user-button" id="userMenuButton">
<div class="user-avatar">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor"
stroke-width="2">
<path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"></path>
<circle cx="12" cy="7" r="4"></circle>
</svg>
</div>
<div class="user-info">
<div class="user-name" id="userName">Loading...</div>
<div class="user-name" id="userName">Caricamento...</div>
<div class="user-role" id="userRole">-</div>
</div>
</button>
<div class="user-dropdown" id="userDropdown" style="display: none;">
<a href="/profile" class="dropdown-item">Profile</a>
<a href="/settings" class="dropdown-item">Settings</a>
<a href="/profile" class="dropdown-item">Profilo</a>
<a href="/settings" class="dropdown-item">Impostazioni</a>
<hr class="dropdown-divider">
<button class="dropdown-item" id="logoutButton">Logout</button>
<button class="dropdown-item" id="logoutButton">Esci</button>
</div>
</div>
</div>
@@ -39,43 +42,44 @@
<main class="main-content">
<header class="page-header">
<h2>Profile</h2>
<h2>Profilo</h2>
</header>
<div class="content-wrapper">
<div class="card">
<div class="card-header">
<h3>Personal Information</h3>
<h3>Informazioni Personali</h3>
</div>
<div class="card-body">
<!-- LDAP Notice -->
<div id="ldapNotice" class="form-notice" style="display: none; margin-bottom: 1rem;">
<small>Your account is managed by LDAP. Some information cannot be changed here.</small>
<small>Il tuo account è gestito da LDAP. Alcune informazioni non possono essere modificate
qui.</small>
</div>
<form id="profileForm">
<div class="form-group">
<label for="name">Full Name</label>
<label for="name">Nome Completo</label>
<input type="text" id="name" required>
<small id="nameHelp" class="text-muted" style="display: none;">Managed by LDAP</small>
<small id="nameHelp" class="text-muted" style="display: none;">Gestito da LDAP</small>
</div>
<div class="form-group">
<label for="email">Email</label>
<input type="email" id="email" disabled>
<small class="text-muted">Email cannot be changed</small>
<small class="text-muted">L'email non può essere modificata</small>
</div>
<div class="form-group">
<label for="role">Role</label>
<label for="role">Ruolo</label>
<input type="text" id="role" disabled>
<small class="text-muted">Role is assigned by your administrator</small>
<small class="text-muted">Il ruolo è assegnato dal tuo amministratore</small>
</div>
<div class="form-group">
<label for="manager">Manager</label>
<input type="text" id="manager" disabled>
<small class="text-muted">Your manager is assigned by the administrator</small>
<small class="text-muted">Il tuo manager è assegnato dall'amministratore</small>
</div>
<div class="form-actions" id="profileActions">
<button type="submit" class="btn btn-dark">Save Changes</button>
<button type="submit" class="btn btn-dark">Salva Modifiche</button>
</div>
</form>
</div>
@@ -84,25 +88,25 @@
<!-- Password section - hidden for LDAP users -->
<div class="card" id="passwordCard">
<div class="card-header">
<h3>Change Password</h3>
<h3>Cambia Password</h3>
</div>
<div class="card-body">
<form id="passwordForm">
<div class="form-group">
<label for="currentPassword">Current Password</label>
<label for="currentPassword">Password Attuale</label>
<input type="password" id="currentPassword" required>
</div>
<div class="form-group">
<label for="newPassword">New Password</label>
<label for="newPassword">Nuova Password</label>
<input type="password" id="newPassword" required minlength="8">
<small>Minimum 8 characters</small>
<small>Minimo 8 caratteri</small>
</div>
<div class="form-group">
<label for="confirmPassword">Confirm New Password</label>
<label for="confirmPassword">Conferma Nuova Password</label>
<input type="password" id="confirmPassword" required>
</div>
<div class="form-actions">
<button type="submit" class="btn btn-dark">Change Password</button>
<button type="submit" class="btn btn-dark">Cambia Password</button>
</div>
</form>
</div>
@@ -135,7 +139,7 @@
document.getElementById('name').value = profile.name || '';
document.getElementById('email').value = profile.email;
document.getElementById('role').value = profile.role;
document.getElementById('manager').value = profile.manager_name || 'None';
document.getElementById('manager').value = profile.manager_name || 'Nessuno';
// LDAP mode adjustments
if (isLdapUser) {
@@ -154,7 +158,7 @@
e.preventDefault();
if (isLdapUser) {
utils.showMessage('Profile is managed by LDAP', 'error');
utils.showMessage('Il profilo è gestito da LDAP', 'error');
return;
}
@@ -164,13 +168,13 @@
const response = await api.put('/api/users/me/profile', data);
if (response && response.ok) {
utils.showMessage('Profile updated successfully', 'success');
utils.showMessage('Profilo aggiornato con successo', 'success');
// Update nav display
const nameEl = document.getElementById('userName');
if (nameEl) nameEl.textContent = data.name;
} else {
const error = await response.json();
utils.showMessage(error.detail || 'Failed to update profile', 'error');
utils.showMessage(error.detail || 'Impossibile aggiornare il profilo', 'error');
}
});
@@ -182,7 +186,7 @@
const confirmPassword = document.getElementById('confirmPassword').value;
if (newPassword !== confirmPassword) {
utils.showMessage('Passwords do not match', 'error');
utils.showMessage('Le password non corrispondono', 'error');
return;
}
@@ -193,14 +197,15 @@
const response = await api.post('/api/users/me/change-password', data);
if (response && response.ok) {
utils.showMessage('Password changed successfully', 'success');
utils.showMessage('Password cambiata con successo', 'success');
document.getElementById('passwordForm').reset();
} else {
const error = await response.json();
utils.showMessage(error.detail || 'Failed to change password', 'error');
utils.showMessage(error.detail || 'Impossibile cambiare la password', 'error');
}
});
}
</script>
</body>
</html>
</html>