{% trans_default_domain "base" %}
<div class="justify-content-center d-flex">
<div class="main-menu">
{% if app.user %}
<div class="title">
{{ app.user.username }}
</div>
<p class="text-muted mb-3">
ROLE_USER
</p>
{% endif %}
{% if menu|length > 1 %}
<ul class="nav nav-tabs" id="myTab" role="tablist">
{% for projectName, projectMenu in menu %}
<li class="nav-item">
<a class="nav-link {% if projectName == activeProject %}active{% endif %}"
id="{{ projectName }}-tab"
data-toggle="tab"
href="#{{ projectName }}"
role="tab"
aria-controls="{{ projectName }}"
aria-selected="{% if projectName == activeProject %}true{% else %}false{% endif %}"
>{{ projectName|trans }}</a>
</li>
{% endfor %}
</ul>
{% endif %}
<div class="tab-content" id="menuContent">
{% for projectName, projectMenu in menu %}
<div class="tab-pane fade {% if projectName == activeProject %}active show{% endif%}"
id="{{ projectName }}"
role="tabpanel"
aria-labelledby="{{ projectName }}-tab"
>
<ul class="list-unstyled text-left">
{% for categoryName, reportsByCategory in projectMenu %}
{% set showMenuCategory = reportsByCategory.granted is null %}
{% for role in reportsByCategory.granted %}
{% if not showMenuCategory %}
{% set showMenuCategory = is_granted(role) %}
{% endif %}
{% endfor %}
{% if showMenuCategory %}
<li class="mt-2 text-center">
{{ categoryName|trans }}
<hr class="mt-0">
</li>
{% for reportPath, report in reportsByCategory.reports %}
{% set showMenuRow = report.granted is null %}
{% for role in report.granted %}
{% if not showMenuRow %}
{% set showMenuRow = is_granted(role) %}
{% endif %}
{% endfor %}
{% if showMenuRow %}
<li>
<a {{ currentRoute == reportPath ? 'class="active"' : '' }} href="{{ path(reportPath) }}">
{{ report.name|trans }}
</a>
</li>
{% endif %}
{% endfor %}
{% endif %}
{% endfor %}
<li class="mt-2 text-center">
{{ 'system'|trans }}
<hr class="mt-0">
</li>
{% if is_granted("ROLE_BI_APP_ROLES") or is_granted("ROLE_USER_EDIT") %}
<li>
<a {{ currentRoute == 'app_roles' ? 'class="active"' : '' }} href="{{ path('app_roles') }}">{{ 'roles'|trans }}</a>
</li>
{% if is_granted("ROLE_USER_EDIT") %}
<li>
<a {{ currentRoute == 'app_role_groups' ? 'class="active"' : '' }} href="{{ path('app_role_groups') }}">{{ 'role_groups'|trans }}</a>
</li>
{% endif %}
{% endif %}
<li>
<a href="{{ path('app_logout') }}">{{ 'logout'|trans }}</a>
</li>
</ul>
</div>
{% endfor %}
{% if not menu|length %}
<ul class="list-unstyled text-left">
<li>
<a href="{{ path('app_logout') }}">{{ 'logout'|trans }}</a>
</li>
</ul>
{% endif %}
</div>
</div>
</div>