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:
12
script.js
12
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() {
|
||||
|
||||
Reference in New Issue
Block a user