From 8253726d6169bacd3498424782746d7a67af538e Mon Sep 17 00:00:00 2001 From: A R R R Associates Date: Sat, 11 Jul 2026 07:43:36 +0530 Subject: [PATCH] Host role navigation globally across authenticated pages --- app/ui/templates/base/layout.html | 71 ++++++++++++++++++- .../components/client_navigation_v2.html | 2 + .../components/consultant_navigation_v2.html | 2 + .../components/firm_admin_navigation_v2.html | 2 + .../components/manager_navigation_v2.html | 2 + .../components/partner_navigation_v2.html | 2 + .../components/staff_navigation_v2.html | 2 + .../system_admin_navigation_v2.html | 2 + 8 files changed, 83 insertions(+), 2 deletions(-) diff --git a/app/ui/templates/base/layout.html b/app/ui/templates/base/layout.html index 7b04dfc..a2213cd 100644 --- a/app/ui/templates/base/layout.html +++ b/app/ui/templates/base/layout.html @@ -107,6 +107,50 @@ {% set domain_context = get_domain_context(request) %} {% set is_system_admin_user = full_auth and ("System Admin" in ui_roles) %} {% set can_manage_local_storage_agent = full_auth and can_view_documents(current_user, ui_perms, ui_roles) and can_upload_documents(current_user, ui_perms, ui_roles) and (ui_roles|select("in", ["Firm Admin", "Partner", "Branch Manager"])|list|length > 0) %} + + {# UI/UX V2 Phase 1G — Global Role Navigation Host. + Role navigation is rendered once, immediately below the shared header, so it + remains available on dashboards, shared modules, forms, detail pages and + submenu pages. Existing page-level navigation includes are suppressed by the + global_role_navigation_host_v2 flag inside each V2 navigation component. #} + {% set global_role_navigation_host_v2 = full_auth %} + {% set _workspace_cookie_v2 = request.cookies.get('uiux_active_workspace', '') if full_auth else '' %} + {% set _workspace_path_v2 = '' %} + {% if full_auth %} + {% if current_path.startswith('/system-admin') %} + {% set _workspace_path_v2 = 'system-admin' %} + {% elif current_path.startswith('/firm-admin') %} + {% set _workspace_path_v2 = 'firm-admin' %} + {% elif current_path.startswith('/partner') %} + {% set _workspace_path_v2 = 'partner' %} + {% elif current_path.startswith('/manager') %} + {% set _workspace_path_v2 = 'manager' %} + {% elif current_path.startswith('/employee/') or current_path == '/employee' %} + {% set _workspace_path_v2 = 'employee' %} + {% elif current_path.startswith('/consultant') %} + {% set _workspace_path_v2 = 'consultant' %} + {% elif current_path.startswith('/client') %} + {% set _workspace_path_v2 = 'client' %} + {% endif %} + {% endif %} + {% set active_workspace_v2 = _workspace_path_v2 or _workspace_cookie_v2 %} + {% if active_workspace_v2 == 'system-admin' and 'System Admin' not in ui_roles %}{% set active_workspace_v2 = '' %}{% endif %} + {% if active_workspace_v2 == 'firm-admin' and 'Firm Admin' not in ui_roles %}{% set active_workspace_v2 = '' %}{% endif %} + {% if active_workspace_v2 == 'partner' and 'Partner' not in ui_roles %}{% set active_workspace_v2 = '' %}{% endif %} + {% if active_workspace_v2 == 'manager' and not ('Manager' in ui_roles or 'Branch Manager' in ui_roles) %}{% set active_workspace_v2 = '' %}{% endif %} + {% if active_workspace_v2 == 'consultant' and 'Consultant' not in ui_roles %}{% set active_workspace_v2 = '' %}{% endif %} + {% if active_workspace_v2 == 'client' and 'Client' not in ui_roles %}{% set active_workspace_v2 = '' %}{% endif %} + {% if active_workspace_v2 == 'employee' and not (('Staff' in ui_roles) or ('Employee' in ui_roles) or can_view_employee_portal(current_user, ui_perms, ui_roles) or can_view_own_employee_work(current_user, ui_perms, ui_roles)) %}{% set active_workspace_v2 = '' %}{% endif %} + {% if full_auth and not active_workspace_v2 %} + {% if 'System Admin' in ui_roles %}{% set active_workspace_v2 = 'system-admin' %} + {% elif 'Firm Admin' in ui_roles %}{% set active_workspace_v2 = 'firm-admin' %} + {% elif 'Partner' in ui_roles %}{% set active_workspace_v2 = 'partner' %} + {% elif 'Manager' in ui_roles or 'Branch Manager' in ui_roles %}{% set active_workspace_v2 = 'manager' %} + {% elif 'Consultant' in ui_roles %}{% set active_workspace_v2 = 'consultant' %} + {% elif 'Client' in ui_roles %}{% set active_workspace_v2 = 'client' %} + {% elif ('Staff' in ui_roles) or ('Employee' in ui_roles) or can_view_employee_portal(current_user, ui_perms, ui_roles) or can_view_own_employee_work(current_user, ui_perms, ui_roles) %}{% set active_workspace_v2 = 'employee' %} + {% endif %} + {% endif %} {# Navigation UI Cleanup V2.1 Sidebar is retained only for System Admin users. All other authenticated users use the floating top workspace bar on every page. @@ -404,8 +448,31 @@
{% if use_clean_top_nav %} {% include "ui/templates/components/top_workspace_bar.html" %} - {% if is_system_admin_user %} - {% include "ui/templates/components/system_admin_navigation_v2.html" %} + {% if full_auth and active_workspace_v2 %} + {% with navigation_render_location_v2='global-host' %} + {% if active_workspace_v2 == 'system-admin' %} + {% include "ui/templates/components/system_admin_navigation_v2.html" %} + {% elif active_workspace_v2 == 'firm-admin' %} + {% include "ui/templates/components/firm_admin_navigation_v2.html" %} + {% elif active_workspace_v2 == 'partner' %} + {% include "ui/templates/components/partner_navigation_v2.html" %} + {% elif active_workspace_v2 == 'manager' %} + {% include "ui/templates/components/manager_navigation_v2.html" %} + {% elif active_workspace_v2 == 'employee' %} + {% include "ui/templates/components/staff_navigation_v2.html" %} + {% elif active_workspace_v2 == 'consultant' %} + {% include "ui/templates/components/consultant_navigation_v2.html" %} + {% elif active_workspace_v2 == 'client' %} + {% include "ui/templates/components/client_navigation_v2.html" %} + {% endif %} + {% endwith %} + {% endif %} {% else %}
diff --git a/app/ui/templates/components/client_navigation_v2.html b/app/ui/templates/components/client_navigation_v2.html index 84180c9..86c02ec 100644 --- a/app/ui/templates/components/client_navigation_v2.html +++ b/app/ui/templates/components/client_navigation_v2.html @@ -1,3 +1,4 @@ +{% 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 @@ -57,3 +58,4 @@ {% include "ui/templates/components/navigation_v2.html" %} {% include "ui/templates/components/mobile_navigation_v2.html" %}
+{% endif %} diff --git a/app/ui/templates/components/consultant_navigation_v2.html b/app/ui/templates/components/consultant_navigation_v2.html index 325ad86..5e6f627 100644 --- a/app/ui/templates/components/consultant_navigation_v2.html +++ b/app/ui/templates/components/consultant_navigation_v2.html @@ -1,3 +1,4 @@ +{% if navigation_render_location_v2|default('page') == 'global-host' or not global_role_navigation_host_v2|default(false) %} {# UI/UX V2 Phase 1C — Consultant pilot navigation @@ -69,3 +70,4 @@ {% include "ui/templates/components/navigation_v2.html" %} {% include "ui/templates/components/mobile_navigation_v2.html" %} +{% endif %} diff --git a/app/ui/templates/components/firm_admin_navigation_v2.html b/app/ui/templates/components/firm_admin_navigation_v2.html index 406f7b0..be483c4 100644 --- a/app/ui/templates/components/firm_admin_navigation_v2.html +++ b/app/ui/templates/components/firm_admin_navigation_v2.html @@ -1,3 +1,4 @@ +{% if navigation_render_location_v2|default('page') == 'global-host' or not global_role_navigation_host_v2|default(false) %} {# UI/UX V2 Phase 1E.1 — Unified Firm Admin navigation. Presentation only. Existing routes and route-level permissions remain authoritative. @@ -150,3 +151,4 @@ } })(); +{% endif %} diff --git a/app/ui/templates/components/manager_navigation_v2.html b/app/ui/templates/components/manager_navigation_v2.html index ff07a74..bff70fa 100644 --- a/app/ui/templates/components/manager_navigation_v2.html +++ b/app/ui/templates/components/manager_navigation_v2.html @@ -1,3 +1,4 @@ +{% if navigation_render_location_v2|default('page') == 'global-host' or not global_role_navigation_host_v2|default(false) %} {# UI/UX V2 Phase 1D — Manager pilot navigation @@ -57,3 +58,4 @@ {% include "ui/templates/components/navigation_v2.html" %} {% include "ui/templates/components/mobile_navigation_v2.html" %} +{% endif %} diff --git a/app/ui/templates/components/partner_navigation_v2.html b/app/ui/templates/components/partner_navigation_v2.html index c91fa74..9462fdc 100644 --- a/app/ui/templates/components/partner_navigation_v2.html +++ b/app/ui/templates/components/partner_navigation_v2.html @@ -1,3 +1,4 @@ +{% if navigation_render_location_v2|default('page') == 'global-host' or not global_role_navigation_host_v2|default(false) %} {# UI/UX V2 Phase 1D — Partner pilot navigation @@ -57,3 +58,4 @@ {% include "ui/templates/components/navigation_v2.html" %} {% include "ui/templates/components/mobile_navigation_v2.html" %} +{% endif %} diff --git a/app/ui/templates/components/staff_navigation_v2.html b/app/ui/templates/components/staff_navigation_v2.html index d69cef8..75b3696 100644 --- a/app/ui/templates/components/staff_navigation_v2.html +++ b/app/ui/templates/components/staff_navigation_v2.html @@ -1,3 +1,4 @@ +{% if navigation_render_location_v2|default('page') == 'global-host' or not global_role_navigation_host_v2|default(false) %} {# UI/UX V2 Phase 1B — Staff pilot navigation @@ -69,3 +70,4 @@ {% include "ui/templates/components/navigation_v2.html" %} {% include "ui/templates/components/mobile_navigation_v2.html" %} +{% endif %} diff --git a/app/ui/templates/components/system_admin_navigation_v2.html b/app/ui/templates/components/system_admin_navigation_v2.html index f77034d..a1e5f41 100644 --- a/app/ui/templates/components/system_admin_navigation_v2.html +++ b/app/ui/templates/components/system_admin_navigation_v2.html @@ -1,3 +1,4 @@ +{% if navigation_render_location_v2|default('page') == 'global-host' or not global_role_navigation_host_v2|default(false) %} {# UI/UX V2 Phase 1F — System Admin workspace navigation. Presentation only. Existing routes and route-level permissions remain authoritative. @@ -193,3 +194,4 @@ } })(); +{% endif %}