{% for groupedPermissions in grouped_permissions(menu|parent_permission.code|parent_permission.code|default(null)) %}
  <div class="list-group">
    {% for m in groupedPermissions if not m.visable is defined or (m.visable is defined and eval_expression(m.visable)) %}
      {% set menuClass = (m.code == menu|parent_permission.code|default(null) ? 'list-group-item active' : 'list-group-item') %}

      {% set tabMenu = first_child_permission(m) %}
      {% if tabMenu.mode|default('') == 'capsules' %}
        {% set tabMenu = first_child_permission(tabMenu) %}
      {% endif %}

      <a
          title="{{ m.name|trans }}"
          class="{{ menuClass }}"
          href="{{ permission_path(tabMenu) }}"
      >
        {{ m.name|trans }}
      </a>
    {% endfor %}
  </div>
{% endfor %}
