diff --git a/app/modules/system_admin_dashboard/templates/system_admin_dashboard/dashboard.html b/app/modules/system_admin_dashboard/templates/system_admin_dashboard/dashboard.html
index 595eaed..8504db5 100644
--- a/app/modules/system_admin_dashboard/templates/system_admin_dashboard/dashboard.html
+++ b/app/modules/system_admin_dashboard/templates/system_admin_dashboard/dashboard.html
@@ -16,50 +16,7 @@
- {% set tabs = [
- ('overview', 'Overview'),
- ('firms', 'Firms'),
- ('firm-setup-health', 'Setup Health'),
- ('catalogue', 'Service Catalogue'),
- ('smtp', 'Platform SMTP'),
- ('storage', 'Storage'),
- ('billing', 'Billing Readiness'),
- ('reports', 'Reports'),
- ('wizards', 'Wizards'),
- ('audit-logs', 'Audit Logs')
- ] %}
-
-
(function () {
+ "use strict";
+
const panel = document.getElementById('system-admin-dashboard-panel');
- const tabs = Array.from(document.querySelectorAll('[data-dashboard-tab]'));
- if (!panel || !tabs.length) return;
+ if (!panel) return;
+
+ const dashboardLinks = Array.from(document.querySelectorAll(
+ '[data-uiux-v2-pilot="system-admin"] a[href^="/system-admin/dashboard?tab="]'
+ ));
+
+ function tabFromLink(link) {
+ try {
+ return new URL(link.href, window.location.origin).searchParams.get('tab') || 'overview';
+ } catch (error) {
+ return 'overview';
+ }
+ }
function setActive(tabName) {
- tabs.forEach((tab) => {
- const active = tab.dataset.dashboardTab === tabName;
- tab.classList.toggle('bg-brand-600', active);
- tab.classList.toggle('text-white', active);
- tab.classList.toggle('text-slate-600', !active);
- tab.classList.toggle('bg-white', !active && tab.closest('#system-admin-mobile-menu'));
- tab.classList.toggle('hover:bg-slate-100', !active);
+ dashboardLinks.forEach((link) => {
+ const active = tabFromLink(link) === tabName;
+ link.classList.toggle('bg-brand-50', active);
+ link.classList.toggle('text-brand-700', active);
+ link.classList.toggle('text-slate-700', !active);
+ if (active) {
+ link.setAttribute('aria-current', 'page');
+ } else {
+ link.removeAttribute('aria-current');
+ }
});
}
async function loadTab(tabName, pushState) {
setActive(tabName);
panel.innerHTML = '
Loading...
';
+
try {
const response = await fetch('/system-admin/dashboard/tab/' + encodeURIComponent(tabName), {
headers: { 'X-Requested-With': 'fetch' }
});
if (!response.ok) throw new Error('Tab load failed');
+
panel.innerHTML = await response.text();
+
if (pushState) {
const url = new URL(window.location.href);
url.searchParams.set('tab', tabName);
history.pushState({ tab: tabName }, '', url.toString());
}
- const mobileMenu = document.getElementById('system-admin-mobile-menu');
- if (mobileMenu) mobileMenu.open = false;
- } catch (err) {
- panel.innerHTML = '
Unable to load this tab. Please refresh the page.
';
+
+ document.querySelectorAll('[data-uiux-v2-pilot="system-admin"] details[open]').forEach((details) => {
+ details.open = false;
+ });
+ } catch (error) {
+ panel.innerHTML = '
Unable to load this dashboard section. Please refresh the page.
';
}
}
- tabs.forEach((tab) => {
- tab.addEventListener('click', function () {
- loadTab(tab.dataset.dashboardTab, true);
+ dashboardLinks.forEach((link) => {
+ link.addEventListener('click', function (event) {
+ if (window.location.pathname !== '/system-admin/dashboard') return;
+ event.preventDefault();
+ loadTab(tabFromLink(link), true);
});
});
diff --git a/app/ui/templates/components/system_admin_navigation_v2.html b/app/ui/templates/components/system_admin_navigation_v2.html
index d19d826..f77034d 100644
--- a/app/ui/templates/components/system_admin_navigation_v2.html
+++ b/app/ui/templates/components/system_admin_navigation_v2.html
@@ -7,9 +7,20 @@
{% set navigation_items_v2 = [
{
'label': 'Dashboard',
- 'url': '/system-admin/dashboard',
'visible': true,
- 'active': _system_admin_path.startswith('/system-admin/dashboard')
+ 'active': _system_admin_path.startswith('/system-admin/dashboard'),
+ 'children': [
+ {'label': 'Overview', 'url': '/system-admin/dashboard?tab=overview', 'active': _system_admin_path.startswith('/system-admin/dashboard') and (request.query_params.get('tab', 'overview') == 'overview')},
+ {'label': 'Firms', 'url': '/system-admin/dashboard?tab=firms', 'active': _system_admin_path.startswith('/system-admin/dashboard') and request.query_params.get('tab') == 'firms'},
+ {'label': 'Setup Health', 'url': '/system-admin/dashboard?tab=firm-setup-health', 'active': _system_admin_path.startswith('/system-admin/dashboard') and request.query_params.get('tab') == 'firm-setup-health'},
+ {'label': 'Service Catalogue', 'url': '/system-admin/dashboard?tab=catalogue', 'active': _system_admin_path.startswith('/system-admin/dashboard') and request.query_params.get('tab') == 'catalogue'},
+ {'label': 'Platform SMTP', 'url': '/system-admin/dashboard?tab=smtp', 'active': _system_admin_path.startswith('/system-admin/dashboard') and request.query_params.get('tab') == 'smtp'},
+ {'label': 'Storage', 'url': '/system-admin/dashboard?tab=storage', 'active': _system_admin_path.startswith('/system-admin/dashboard') and request.query_params.get('tab') == 'storage'},
+ {'label': 'Billing Readiness', 'url': '/system-admin/dashboard?tab=billing', 'active': _system_admin_path.startswith('/system-admin/dashboard') and request.query_params.get('tab') == 'billing'},
+ {'label': 'Reports', 'url': '/system-admin/dashboard?tab=reports', 'active': _system_admin_path.startswith('/system-admin/dashboard') and request.query_params.get('tab') == 'reports'},
+ {'label': 'Wizards', 'url': '/system-admin/dashboard?tab=wizards', 'active': _system_admin_path.startswith('/system-admin/dashboard') and request.query_params.get('tab') == 'wizards'},
+ {'label': 'Audit Logs', 'url': '/system-admin/dashboard?tab=audit-logs', 'active': _system_admin_path.startswith('/system-admin/dashboard') and request.query_params.get('tab') == 'audit-logs'}
+ ]
},
{
'label': 'Firms',
diff --git a/app/ui/templates/components/top_workspace_bar.html b/app/ui/templates/components/top_workspace_bar.html
index 493014b..3204eec 100644
--- a/app/ui/templates/components/top_workspace_bar.html
+++ b/app/ui/templates/components/top_workspace_bar.html
@@ -1,6 +1,7 @@
-