Host role navigation globally across authenticated pages

This commit is contained in:
A R R R Associates
2026-07-11 07:43:36 +05:30
parent 219263b16a
commit 8253726d61
8 changed files with 83 additions and 2 deletions
+68 -1
View File
@@ -107,6 +107,50 @@
{% set domain_context = get_domain_context(request) %} {% set domain_context = get_domain_context(request) %}
{% set is_system_admin_user = full_auth and ("System Admin" in ui_roles) %} {% 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) %} {% 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 {# Navigation UI Cleanup V2.1
Sidebar is retained only for System Admin users. Sidebar is retained only for System Admin users.
All other authenticated users use the floating top workspace bar on every page. All other authenticated users use the floating top workspace bar on every page.
@@ -404,8 +448,31 @@
<div class="min-h-screen"> <div class="min-h-screen">
{% if use_clean_top_nav %} {% if use_clean_top_nav %}
{% include "ui/templates/components/top_workspace_bar.html" %} {% include "ui/templates/components/top_workspace_bar.html" %}
{% if is_system_admin_user %} {% 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" %} {% 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 %}
<script>
(() => {
const workspace = {{ active_workspace_v2|tojson }};
if (!workspace) return;
document.cookie = `uiux_active_workspace=${encodeURIComponent(workspace)}; Path=/; SameSite=Lax`;
})();
</script>
{% endif %} {% endif %}
{% else %} {% else %}
<header class="border-b border-slate-200 bg-white/90 backdrop-blur"> <header class="border-b border-slate-200 bg-white/90 backdrop-blur">
@@ -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 UI/UX V2 Phase 1C — Client pilot navigation
@@ -57,3 +58,4 @@
{% include "ui/templates/components/navigation_v2.html" %} {% include "ui/templates/components/navigation_v2.html" %}
{% include "ui/templates/components/mobile_navigation_v2.html" %} {% include "ui/templates/components/mobile_navigation_v2.html" %}
</div> </div>
{% endif %}
@@ -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 UI/UX V2 Phase 1C — Consultant pilot navigation
@@ -69,3 +70,4 @@
{% include "ui/templates/components/navigation_v2.html" %} {% include "ui/templates/components/navigation_v2.html" %}
{% include "ui/templates/components/mobile_navigation_v2.html" %} {% include "ui/templates/components/mobile_navigation_v2.html" %}
</div> </div>
{% endif %}
@@ -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. UI/UX V2 Phase 1E.1 — Unified Firm Admin navigation.
Presentation only. Existing routes and route-level permissions remain authoritative. Presentation only. Existing routes and route-level permissions remain authoritative.
@@ -150,3 +151,4 @@
} }
})(); })();
</script> </script>
{% endif %}
@@ -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 UI/UX V2 Phase 1D — Manager pilot navigation
@@ -57,3 +58,4 @@
{% include "ui/templates/components/navigation_v2.html" %} {% include "ui/templates/components/navigation_v2.html" %}
{% include "ui/templates/components/mobile_navigation_v2.html" %} {% include "ui/templates/components/mobile_navigation_v2.html" %}
</div> </div>
{% endif %}
@@ -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 UI/UX V2 Phase 1D — Partner pilot navigation
@@ -57,3 +58,4 @@
{% include "ui/templates/components/navigation_v2.html" %} {% include "ui/templates/components/navigation_v2.html" %}
{% include "ui/templates/components/mobile_navigation_v2.html" %} {% include "ui/templates/components/mobile_navigation_v2.html" %}
</div> </div>
{% endif %}
@@ -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 UI/UX V2 Phase 1B — Staff pilot navigation
@@ -69,3 +70,4 @@
{% include "ui/templates/components/navigation_v2.html" %} {% include "ui/templates/components/navigation_v2.html" %}
{% include "ui/templates/components/mobile_navigation_v2.html" %} {% include "ui/templates/components/mobile_navigation_v2.html" %}
</div> </div>
{% endif %}
@@ -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. UI/UX V2 Phase 1F — System Admin workspace navigation.
Presentation only. Existing routes and route-level permissions remain authoritative. Presentation only. Existing routes and route-level permissions remain authoritative.
@@ -193,3 +194,4 @@
} }
})(); })();
</script> </script>
{% endif %}