{% 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) %} {# 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 and not is_system_admin_user %}
{% if not use_clean_top_nav %} {% endif %}
{% if use_clean_top_nav %} {% include "ui/templates/components/top_workspace_bar.html" %} {% 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 %}