{% set __title_user = current_user if current_user is defined else None %} {% set __firm_branding = get_current_firm_branding(request, __title_user) %} {% if __firm_branding.favicon_url %}{% endif %} {% set __title_auth = __title_user and request.session.get("otp_verified", False) %} {% if __title_auth %} {% set __title_firm = get_current_tenant_name(request, __title_user) %} {% set __title_branch = get_current_branch_name(request, __title_user) %} {{ title or "Workspace" }} | {{ __title_firm }}{% if __title_branch and __title_branch != "-" %} - {{ __title_branch }}{% endif %} {% else %} {{ title or "Welcome" }} | {{ __firm_branding.firm_name or "Audit Firm ERP" }} {% endif %} {% set otp_ok = request.session.get("otp_verified", False) %} {% set full_auth = current_user and otp_ok %} {% set ui_perms = current_user_permissions if full_auth else [] %} {% set ui_roles = current_user_roles if full_auth else [] %} {% set active_tenant_id = get_active_tenant_id(request, current_user) if full_auth else None %} {% set active_branch_id = get_active_branch_id(request, current_user) if full_auth else None %} {% set active_financial_year = get_active_financial_year(request, current_user) if full_auth else None %} {% set active_assessment_year = get_active_assessment_year(request, current_user) if full_auth else None %} {% set unread_alert_count = get_unread_alert_count(request, current_user) if full_auth else 0 %} {% set current_path = request.url.path %} {% set document_menu_roles = ["System Admin", "Firm Admin", "Partner"] %} {% set can_view_documents_menu = full_auth and can_view_documents(current_user, ui_perms, ui_roles) and (ui_roles|select("in", document_menu_roles)|list|length > 0) %} {% set management_menu_roles = ["System Admin", "Firm Admin", "Partner", "Manager", "Branch Manager"] %} {% set can_view_management_menus = full_auth and (ui_roles|select("in", management_menu_roles)|list|length > 0) %} {% set firm_branding = get_current_firm_branding(request, current_user) if full_auth else __firm_branding %} {% set current_user_photo_url = get_user_profile_photo_url(current_user) if full_auth else None %} {% set current_user_initials = get_user_initials(current_user) if full_auth else "U" %} {% set current_firm_name = firm_branding.firm_name if firm_branding else "Audit Firm ERP" %} {% set current_branch_name = firm_branding.branch_name if firm_branding else "" %} {% 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. Existing routes and old sidebar code are kept intact. #} {% set use_clean_top_nav = full_auth %}
{% if not use_clean_top_nav %} {% endif %}
{% if use_clean_top_nav %} {% include "ui/templates/components/top_workspace_bar.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 %}

{{ title or "Module Workspace" }}

{% if full_auth %}
{{ current_user.full_name or current_user.email }}
{{ current_user.email }}
{% if current_user.qualification or current_user.designation %}
{{ current_user.qualification or '' }}{% if current_user.qualification and current_user.designation %} • {% endif %}{{ current_user.designation or '' }}
{% endif %}
Your Firm: {{ current_firm_name }} • Branch: {{ current_branch_name }}{% if active_financial_year %} • FY: {{ active_financial_year }}{% endif %}
{% include "ui/templates/components/workspace_switcher.html" %}
{% if "Consultant" in ui_roles %} My Profile {% elif "Client" in ui_roles %} My Profile {% else %} My Profile {% endif %} Change Password Logout
{% if current_user_photo_url %} Profile photo {% else %}
{{ current_user_initials }}
{% endif %}
{% else %} {% if domain_context.is_resolved %}
{{ current_firm_name }}{% if current_branch_name %} • {{ current_branch_name }}{% endif %}
{% endif %} Login {% endif %}
{% if full_auth and (can_switch_service_tenant(current_user, ui_perms, ui_roles) or can_switch_service_branch(current_user, ui_perms, ui_roles) or can_switch_employee_tenant(current_user, ui_perms, ui_roles) or can_switch_employee_branch(current_user, ui_perms, ui_roles) or can_view_settings(current_user, ui_perms, ui_roles)) %}
{% if can_switch_service_tenant(current_user, ui_perms, ui_roles) or can_switch_employee_tenant(current_user, ui_perms, ui_roles) %} {% set context_tenants = get_context_tenants(request, current_user, ui_perms, ui_roles) %}
{% endif %} {% if can_switch_service_branch(current_user, ui_perms, ui_roles) or can_switch_employee_branch(current_user, ui_perms, ui_roles) %} {% set context_branches = get_context_branches(request, current_user, ui_perms, ui_roles) %}
{% endif %} {% if can_view_settings(current_user, ui_perms, ui_roles) %} {% set context_financial_years = get_context_financial_years(request, current_user, ui_perms, ui_roles) %}
{% endif %}
Active Scope: {{ current_firm_name }} • {{ current_branch_name if active_branch_id else "All Branches" }}{% if active_financial_year %} • FY {{ active_financial_year }}{% endif %}
{% endif %}
{% endif %}
{% if flash %}
{{ flash }}
{% endif %} {% if current_path == '/employee/attendance' or current_path == '/mobile/attendance' %} {% endif %} {% block content %}{% endblock %}
{% if full_auth %}
{% endif %} {% if full_auth %} {% endif %}