This commit is contained in:
HotSwapp
2025-08-18 20:20:04 -05:00
parent 89b2bc0aa2
commit bac8cc4bd5
114 changed files with 30258 additions and 1341 deletions

View File

@@ -32,10 +32,18 @@
<h2 class="text-2xl font-bold mb-0" id="customer-count">-</h2>
</div>
</div>
<a href="/customers" class="text-primary-200 hover:text-white text-xs font-medium flex items-center gap-1 mt-2 transition-colors">
View all
<i class="fa-solid fa-arrow-right"></i>
</a>
<div class="flex items-center gap-3 mt-2">
<a href="/customers" class="text-primary-200 hover:text-white text-xs font-medium flex items-center gap-1 transition-colors">
View all
<i class="fa-solid fa-arrow-right"></i>
</a>
<a href="/customers#phone-dir"
class="inline-flex items-center gap-1 text-xs font-medium px-2 py-1 rounded bg-white/10 hover:bg-white/20 transition-colors"
title="Download Phone Directory">
<i class="fa-solid fa-address-book"></i>
Phone Directory
</a>
</div>
</div>
<div class="bg-success-600 text-white rounded-xl shadow-soft p-4">
@@ -145,11 +153,19 @@
<p>Loading recent imports...</p>
</div>
</div>
<div id="recent-activity">
<div class="flex flex-col items-center justify-center py-4 text-neutral-500 dark:text-neutral-400">
<i class="fa-solid fa-hourglass-half text-2xl mb-2"></i>
<p>Loading recent activity...</p>
</div>
<div id="recent-activity" class="space-y-3">
<div class="flex items-center justify-between">
<div class="flex items-center gap-2 text-sm text-neutral-600 dark:text-neutral-300">
<i class="fa-regular fa-bell"></i>
<span>Live document events</span>
</div>
<div class="flex items-center gap-2 text-xs">
<span class="text-neutral-500">Connection:</span>
<span id="adminDocConnBadge"></span>
<button id="adminDocReconnectBtn" type="button" class="px-2 py-1 rounded bg-neutral-100 dark:bg-neutral-700 hover:bg-neutral-200 dark:hover:bg-neutral-600 text-neutral-700 dark:text-neutral-300 border border-neutral-300 dark:border-neutral-600">Reconnect</button>
</div>
</div>
<div id="adminDocEvents" class="space-y-2" aria-live="polite"></div>
</div>
</div>
</div>
@@ -242,11 +258,32 @@ document.addEventListener('DOMContentLoaded', function() {
loadDashboardData(); // Uncomment when authentication is implemented
loadRecentImports();
loadRecentActivity();
try { setupAdminNotificationCenter(); } catch (_) {}
});
async function loadRecentActivity() {
// Placeholder: existing system would populate; if an endpoint exists, hook it here.
}
function setupAdminNotificationCenter() {
const host = document.getElementById('adminDocConnBadge');
const feed = document.getElementById('adminDocEvents');
const btn = document.getElementById('adminDocReconnectBtn');
if (!host || !feed || !window.notifications) return;
const badge = window.notifications.createConnectionBadge();
host.innerHTML = '';
host.appendChild(badge.element);
const mgr = window.notifications.connectAdminDocumentStream({
onEvent: (payload) => {
window.notifications.appendEvent(feed, payload);
},
onState: (s) => badge.update(s)
});
if (btn) btn.addEventListener('click', () => { try { mgr.reconnectNow(); } catch(_) {} });
}
async function loadRecentImports() {
try {
const [statusResp, recentResp] = await Promise.all([