feat: add dashboard feature with modular API endpoints and UI integration

This commit is contained in:
Syariffullah
2026-06-11 09:17:48 +07:00
parent b77d4f6869
commit db3ff299c1
13 changed files with 1054 additions and 17 deletions
+14
View File
@@ -52,6 +52,8 @@
function updateAuthUI() {
if (!authWidget) return;
const dashboardBtn = document.getElementById('menuDashboard');
if (window.currentUser) {
// Logged In state
const roleLabel = window.currentUser.role === 'admin' ? 'Admin' : 'Pengelola';
@@ -71,6 +73,9 @@
document.getElementById('authLogoutBtn').addEventListener('click', logout);
// Show Dashboard button for all logged-in users
if (dashboardBtn) dashboardBtn.style.display = 'flex';
// Show user management button in sidebar for Admin
const adminDivider = document.getElementById('sidebarAdminDivider');
if (window.currentUser.role === 'admin') {
@@ -87,6 +92,7 @@
`;
document.getElementById('authLoginBtn').addEventListener('click', showLoginModal);
if (menuUsersBtn) menuUsersBtn.style.display = 'none';
if (dashboardBtn) dashboardBtn.style.display = 'none';
const adminDivider = document.getElementById('sidebarAdminDivider');
if (adminDivider) adminDivider.style.display = 'none';
}
@@ -177,6 +183,14 @@
});
}
// Dashboard Button
const menuDashboardBtn = document.getElementById('menuDashboard');
if (menuDashboardBtn) {
menuDashboardBtn.addEventListener('click', function() {
if (typeof window.openDashboard === 'function') window.openDashboard();
});
}
if (closeUserManagementModal) {
closeUserManagementModal.addEventListener('click', function() {
userManagementModal.classList.remove('show');