{# Navigation des univers. Réutilise topbar et context-view-tabs ; aucune sous-navigation globale dans un projet. #}
{% set route = app.request.attributes.get('_route')|default('') %}
{% set projectContext = route starts with 'app_project_planning' or route starts with 'app_project_milestones' or route in ['app_project_cadrage', 'app_admin_project_access'] %}
{% set universe = 'home' %}
{% if route == 'app_my_projects' or projectContext %}
{% set universe = 'projects' %}
{% elseif route starts with 'app_my_workload' or route == 'app_team_workload' %}
{% set universe = 'charge' %}
{% elseif route == 'app_presence_index' %}
{% set universe = 'team' %}
{% elseif route starts with 'app_commercial' %}
{% set universe = 'commercial' %}
{% elseif route starts with 'app_billing' %}
{% set universe = 'billing' %}
{% elseif route == 'app_contacts' %}
{% set universe = 'contacts' %}
{% elseif route starts with 'app_admin' %}
{% set universe = 'admin' %}
{% endif %}
{# Portée du bouton global « + Tâche » selon la page : un projet → ses tâches ;
commercial → toutes les tâches commerciales ; ailleurs → mes tâches. #}
{% set todoScopeType = null %}
{% set todoScopeId = null %}
{% set todoScopeCategory = null %}
{% set todoScopeLabel = 'Mes tâches' %}
{% if projectContext and app.request.query.get('project') %}
{% set todoScopeType = 'project' %}
{% set todoScopeId = app.request.query.get('project') %}
{% set todoScopeLabel = 'Tâches du projet' %}
{% elseif universe == 'commercial' %}
{% set todoScopeCategory = 'commercial' %}
{% set todoScopeLabel = 'Tâches commerciales' %}
{% endif %}
{% set admin = is_granted('ROLE_ADMIN') %}
{% set commercial = admin or is_granted('ROLE_DIRECTION') or is_granted('ROLE_COMMERCIAL_DIRECTOR') or is_granted('ROLE_POLE_MANAGER') or is_granted('ROLE_PROJECT_MANAGER') or is_granted('ROLE_PROJECT_DIRECTOR') or (is_granted('ROLE_CONCEPTOR') and can_access_page('app_commercial_cockpit')) %}
{% set billing = admin or is_granted('ROLE_DIRECTION') or is_granted('ROLE_OFFICE_MANAGER') or is_granted('ROLE_COMMERCIAL_DIRECTOR') or is_granted('ROLE_PROJECT_MANAGER') or is_granted('ROLE_PROJECT_DIRECTOR') or (is_granted('ROLE_CONCEPTOR') and can_access_page('app_billing_index')) %}
{% set entries = [
{key:'home', label:'Accueil', route:'app_dashboard', visible:true},
{key:'charge', label:'Charge', route:'app_my_workload', visible:true},
{key:'team', label:'Team', route:'app_presence_index', visible:true},
{key:'commercial', label:'Commercial', route:'app_commercial_cockpit', visible:commercial},
{key:'projects', label:'Projets', route:'app_my_projects', visible:true},
{key:'billing', label:'Facturation', route:'app_billing_index', visible:billing},
{key:'contacts', label:'Contacts', route:'app_contacts', visible:true},
{key:'admin', label:'Admin', route:'app_admin_accounts', visible:admin}
] %}
{% if is_granted('IS_AUTHENTICATED_REMEMBERED') %}
{% endif %}