Files
arrr-erp/app/ui/templates/components/consultant_navigation_v2.html
2026-07-13 10:12:19 +05:30

133 lines
4.8 KiB
HTML

{% if navigation_render_location_v2|default('page') == 'global-host' or not global_role_navigation_host_v2|default(false) %}
{#
UI/UX V2 Phase 1C.3 — Unified Consultant navigation.
Presentation only. Existing routes and route-level permissions remain authoritative.
#}
{% set _consultant_path = request.url.path %}
{% set _consultant_tab = request.query_params.get('tab', 'overview') %}
{% set navigation_aria_label_v2 = 'Consultant workspace navigation' %}
{% set navigation_items_v2 = [
{
'label': 'Dashboard',
'visible': true,
'active': _consultant_path.startswith('/consultant/dashboard'),
'children': [
{'label': 'Overview', 'url': '/consultant/dashboard?tab=overview', 'active': _consultant_path.startswith('/consultant/dashboard') and _consultant_tab == 'overview'},
{'label': 'Work Centre', 'url': '/consultant/dashboard?tab=work-centre', 'active': _consultant_path.startswith('/consultant/dashboard') and _consultant_tab == 'work-centre'},
{'label': 'Clients & Requests', 'url': '/consultant/dashboard?tab=clients-requests', 'active': _consultant_path.startswith('/consultant/dashboard') and _consultant_tab == 'clients-requests'},
{'label': 'Documents & Clarifications', 'url': '/consultant/dashboard?tab=documents-clarifications', 'active': _consultant_path.startswith('/consultant/dashboard') and _consultant_tab == 'documents-clarifications'},
{'label': 'Reports', 'url': '/consultant/dashboard?tab=reports', 'active': _consultant_path.startswith('/consultant/dashboard') and _consultant_tab == 'reports'}
]
},
{
'label': 'Work',
'url': '/consultant/work',
'visible': true,
'active': _consultant_path.startswith('/consultant/work') or _consultant_path.startswith('/consultant/assignments')
},
{
'label': 'Messages',
'url': '/consultant/communications',
'visible': true,
'active': _consultant_path.startswith('/consultant/communications')
},
{
'label': 'Documents',
'url': '/consultant/documents',
'visible': true,
'active': _consultant_path.startswith('/consultant/documents')
},
{
'label': 'Service Requests',
'url': '/consultant/service-requests',
'visible': true,
'active': _consultant_path.startswith('/consultant/service-requests')
},
{
'label': 'Managed Clients',
'url': '/consultant/managed-clients',
'visible': true,
'active': _consultant_path.startswith('/consultant/managed-clients')
},
{
'label': 'Workspace',
'url': '/consultant/workspace',
'visible': true,
'active': _consultant_path.startswith('/consultant/workspace')
},
{
'label': 'Profile',
'url': '/consultant/profile',
'visible': true,
'active': _consultant_path.startswith('/consultant/profile')
},
{
'label': 'Bank Analyzer',
'url': '/tools/bank-statement-analyzer',
'visible': true,
'active': _consultant_path.startswith('/tools/bank-statement-analyzer')
},
{
'label': 'Alerts',
'url': '/alerts',
'visible': true,
'active': _consultant_path.startswith('/alerts'),
'badge': unread_alert_count if unread_alert_count is defined and unread_alert_count > 0 else none
}
] %}
<div class="border-b border-slate-200 bg-white shadow-sm" data-uiux-v2-pilot="consultant">
{% include "ui/templates/components/navigation_v2.html" %}
{% include "ui/templates/components/mobile_navigation_v2.html" %}
</div>
<script>
(function () {
"use strict";
function initialiseConsultantDropdowns() {
var root = document.querySelector('[data-uiux-v2-pilot="consultant"]');
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', initialiseConsultantDropdowns, { once: true });
} else {
initialiseConsultantDropdowns();
}
})();
</script>
{% endif %}