WIP
This commit is contained in:
+15
-1
@@ -96,6 +96,11 @@ function showMainApp() {
|
||||
if (locationsBtn) {
|
||||
locationsBtn.style.display = currentUser.role === 'admin' ? 'block' : 'none';
|
||||
}
|
||||
|
||||
const reportsBtn = document.getElementById('reportsBtn');
|
||||
if (reportsBtn) {
|
||||
reportsBtn.style.display = currentUser.role === 'admin' ? 'block' : 'none';
|
||||
}
|
||||
|
||||
// Hide action buttons for read-only users
|
||||
const isReadOnly = currentUser.role === 'readonly';
|
||||
@@ -223,6 +228,7 @@ function setupEventListeners() {
|
||||
const userMenuBtn = document.getElementById('userMenuBtn');
|
||||
const adminBtn = document.getElementById('adminBtn');
|
||||
const locationsBtn = document.getElementById('locationsBtn');
|
||||
const reportsBtn = document.getElementById('reportsBtn');
|
||||
const logoutBtn = document.getElementById('logoutBtn');
|
||||
const changePasswordBtn = document.getElementById('changePasswordBtn');
|
||||
|
||||
@@ -260,7 +266,7 @@ function setupEventListeners() {
|
||||
|
||||
const closeHistoryBtn = document.getElementById('closeHistoryBtn');
|
||||
if (closeHistoryBtn) closeHistoryBtn.addEventListener('click', () => closeModal(document.getElementById('historyModal')));
|
||||
|
||||
|
||||
const closeUserManagementBtn = document.getElementById('closeUserManagementBtn');
|
||||
if (closeUserManagementBtn) closeUserManagementBtn.addEventListener('click', () => closeModal(document.getElementById('userManagementModal')));
|
||||
|
||||
@@ -311,6 +317,7 @@ function setupEventListeners() {
|
||||
if (changePasswordBtn) changePasswordBtn.addEventListener('click', openChangePasswordModal);
|
||||
if (adminBtn) adminBtn.addEventListener('click', openUserManagement);
|
||||
if (locationsBtn) locationsBtn.addEventListener('click', openLocationManagement);
|
||||
if (reportsBtn) reportsBtn.addEventListener('click', openReportsPage);
|
||||
if (logoutBtn) logoutBtn.addEventListener('click', handleLogout);
|
||||
|
||||
// Search functionality
|
||||
@@ -1419,6 +1426,13 @@ function escapeHtml(text) {
|
||||
return div.innerHTML;
|
||||
}
|
||||
|
||||
async function openReportsPage() {
|
||||
const dropdown = document.getElementById('userDropdown');
|
||||
if (dropdown) dropdown.style.display = 'none';
|
||||
|
||||
window.location.href = 'reports.html';
|
||||
}
|
||||
|
||||
// User Management
|
||||
async function openUserManagement() {
|
||||
const modal = document.getElementById('userManagementModal');
|
||||
|
||||
Reference in New Issue
Block a user