Unify Client navigation and align full-width header
This commit is contained in:
@@ -1,19 +1,23 @@
|
||||
{% if navigation_render_location_v2|default('page') == 'global-host' or not global_role_navigation_host_v2|default(false) %}
|
||||
{#
|
||||
UI/UX V2 Phase 1C — Client pilot navigation
|
||||
|
||||
This component preserves the existing client portal URLs and visibility.
|
||||
It changes presentation only and does not grant access, change routes, or
|
||||
replace the client dashboard's existing AJAX content tabs.
|
||||
UI/UX V2 Phase 1C.2 — Unified Client navigation.
|
||||
Presentation only. Existing routes and route-level permissions remain authoritative.
|
||||
#}
|
||||
{% set _client_path = request.url.path %}
|
||||
{% set _client_tab = request.query_params.get('tab', 'overview') %}
|
||||
{% set navigation_aria_label_v2 = 'Client workspace navigation' %}
|
||||
{% set navigation_items_v2 = [
|
||||
{
|
||||
'label': 'Dashboard',
|
||||
'url': '/client/dashboard',
|
||||
'visible': true,
|
||||
'active': _client_path == '/client/dashboard'
|
||||
'active': _client_path.startswith('/client/dashboard'),
|
||||
'children': [
|
||||
{'label': 'Overview', 'url': '/client/dashboard?tab=overview', 'active': _client_path.startswith('/client/dashboard') and _client_tab == 'overview'},
|
||||
{'label': 'Action Centre', 'url': '/client/dashboard?tab=action-centre', 'active': _client_path.startswith('/client/dashboard') and _client_tab == 'action-centre'},
|
||||
{'label': 'Services & Documents', 'url': '/client/dashboard?tab=services-documents', 'active': _client_path.startswith('/client/dashboard') and _client_tab == 'services-documents'},
|
||||
{'label': 'Billing & Messages', 'url': '/client/dashboard?tab=billing-messages', 'active': _client_path.startswith('/client/dashboard') and _client_tab == 'billing-messages'},
|
||||
{'label': 'Reports', 'url': '/client/dashboard?tab=reports', 'active': _client_path.startswith('/client/dashboard') and _client_tab == 'reports'}
|
||||
]
|
||||
},
|
||||
{
|
||||
'label': 'Compliance',
|
||||
@@ -54,8 +58,57 @@
|
||||
}
|
||||
] %}
|
||||
|
||||
<div class="mb-6 overflow-hidden rounded-2xl border border-slate-200 bg-white shadow-soft" data-uiux-v2-pilot="client">
|
||||
<div class="border-b border-slate-200 bg-white shadow-sm" data-uiux-v2-pilot="client">
|
||||
{% include "ui/templates/components/navigation_v2.html" %}
|
||||
{% include "ui/templates/components/mobile_navigation_v2.html" %}
|
||||
</div>
|
||||
|
||||
<script>
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
function initialiseClientDropdowns() {
|
||||
var root = document.querySelector('[data-uiux-v2-pilot="client"]');
|
||||
if (!root || root.dataset.dropdownAutoCloseInitialised === 'true') return;
|
||||
|
||||
var desktopNav = root.querySelector('nav[data-uiux-v2="desktop-navigation"]');
|
||||
if (!desktopNav) return;
|
||||
|
||||
root.dataset.dropdownAutoCloseInitialised = 'true';
|
||||
var dropdowns = Array.from(desktopNav.querySelectorAll('details'));
|
||||
|
||||
function closeAllExcept(exception) {
|
||||
dropdowns.forEach(function (details) {
|
||||
if (details !== exception) details.removeAttribute('open');
|
||||
});
|
||||
}
|
||||
|
||||
dropdowns.forEach(function (details) {
|
||||
details.addEventListener('toggle', function () {
|
||||
if (details.open) closeAllExcept(details);
|
||||
});
|
||||
|
||||
details.querySelectorAll('a[href]').forEach(function (link) {
|
||||
link.addEventListener('click', function () {
|
||||
details.removeAttribute('open');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
document.addEventListener('click', function (event) {
|
||||
if (!root.contains(event.target)) closeAllExcept(null);
|
||||
});
|
||||
|
||||
document.addEventListener('keydown', function (event) {
|
||||
if (event.key === 'Escape') closeAllExcept(null);
|
||||
});
|
||||
}
|
||||
|
||||
if (document.readyState === 'loading') {
|
||||
document.addEventListener('DOMContentLoaded', initialiseClientDropdowns, { once: true });
|
||||
} else {
|
||||
initialiseClientDropdowns();
|
||||
}
|
||||
})();
|
||||
</script>
|
||||
{% endif %}
|
||||
|
||||
Reference in New Issue
Block a user