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:
@@ -64,6 +64,7 @@
|
||||
</div>
|
||||
<div class="header-right">
|
||||
<span id="user-info" class="user-info"></span>
|
||||
<button id="btn-users" class="btn-secondary" style="display:none">Käyttäjät</button>
|
||||
<button id="btn-add" class="btn-primary">+ Lisää asiakas</button>
|
||||
<button id="btn-logout" class="btn-secondary">Kirjaudu ulos</button>
|
||||
</div>
|
||||
@@ -75,7 +76,6 @@
|
||||
<button class="tab" data-tab="leads">Liidit</button>
|
||||
<button class="tab" data-tab="archive">Arkisto</button>
|
||||
<button class="tab" data-tab="changelog">Muutosloki</button>
|
||||
<button class="tab" data-tab="users" id="tab-users" style="display:none">Käyttäjät</button>
|
||||
<button class="tab" data-tab="settings" id="tab-settings" style="display:none">API</button>
|
||||
</div>
|
||||
|
||||
|
||||
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