diff --git a/index.html b/index.html index 9281dc6..977f245 100644 --- a/index.html +++ b/index.html @@ -64,6 +64,7 @@
+
@@ -75,7 +76,6 @@ - diff --git a/script.js b/script.js index 64289d6..eefecf9 100644 --- a/script.js +++ b/script.js @@ -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() {