Move user management button to header

Users button now appears next to the logged-in user info
in the top right header instead of as a tab. Only visible
to admin users.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-10 02:59:30 +02:00
parent ddc96f4164
commit db8b64cd5b
2 changed files with 11 additions and 3 deletions

View File

@@ -167,8 +167,8 @@ async function showDashboard() {
loginScreen.style.display = 'none';
dashboard.style.display = 'block';
document.getElementById('user-info').textContent = currentUser.nimi || currentUser.username;
// Näytä Käyttäjät-tab vain adminille
document.getElementById('tab-users').style.display = currentUser.role === 'admin' ? '' : 'none';
// Näytä admin-toiminnot vain adminille
document.getElementById('btn-users').style.display = currentUser.role === 'admin' ? '' : 'none';
document.getElementById('tab-settings').style.display = currentUser.role === 'admin' ? '' : 'none';
await loadCustomers();
}
@@ -191,6 +191,14 @@ document.querySelectorAll('.tab').forEach(tab => {
});
});
// Käyttäjät-nappi headerissa
document.getElementById('btn-users').addEventListener('click', () => {
document.querySelectorAll('.tab').forEach(t => t.classList.remove('active'));
document.querySelectorAll('.tab-content').forEach(c => c.classList.remove('active'));
document.getElementById('tab-content-users').classList.add('active');
loadUsers();
});
// ==================== CUSTOMERS ====================
async function loadCustomers() {