{% if groups %}
  <table class="table">
    <thead>
      <tr>
        <th class="sortByColumn clickable">
            {{ "fom.user.group.index.title" | trans }}
            <span class="fa fa-sort-amount-asc" title="{{ 'mb.actions.sort_descending'|trans }}"></span>
        </th>
        <th class="sortByColumn clickable">
            {{ "fom.user.group.index.description" | trans }}
            <span class="fa fa-sort" title="{{ 'mb.actions.sort_ascending'|trans }}"></span>
        </th>
        <th></th>
      </tr>
    </thead>
    <tbody id="listFilterGroups">
      {% for group in groups|sort((a,b) => a.title|lower <=> b.title|lower) %}
      <tr class="filterItem">
        <td>
          {% if is_granted(constant('FOM\\UserBundle\\Security\\Permission\\ResourceDomainInstallation::ACTION_EDIT_GROUPS')) %}
            <a href="{{ path('fom_user_group_edit', {'id': group.id}) }}" title="{{ 'fom.user.group.index.edit_group' | trans }} {{ group.title }}">{{ group.title }}</a>
          {% else %}{{ group.title }}{% endif %}
        </td>
        <td>{{ group.description }}</td>
        <td class="iconColumn">
            {% if is_granted(constant('FOM\\UserBundle\\Security\\Permission\\ResourceDomainInstallation::ACTION_EDIT_GROUPS')) %}
              <a class="hover-highlight-effect"  href="{{ path('fom_user_group_edit',  {'id': group.id }) }}" title="{{ 'fom.user.group.index.edit_group' | trans }} {{ group.title }}"><i class="fas fa-pencil"></i></a>
            {% endif %}
            {% if is_granted(constant('FOM\\UserBundle\\Security\\Permission\\ResourceDomainInstallation::ACTION_DELETE_GROUPS')) %}
            <span class="-fn-delete hover-highlight-effect"
              data-title="{{"fom.user.group.index.delete_group"|trans({'{group_title}': group.title})}}"
              title="{{"fom.security.resource.installation.delete_groups"|trans}}"
              data-url="{{ path('fom_user_group_delete', { 'id': group.id}) }}"
              data-id="{{ group.id }}"
              data-token="{{ csrf_token('group_delete') }}"
              data-test="{{ group.title }}-group-delete"
            ><i class="far fa-trash-can"></i></span>
            {% endif %}
        </td>
      </tr>
      {% endfor %}
    </tbody>
  </table>
{% else %}
  <p>{{"fom.user.group.index.no_groups_available"|trans}}</p>
{% endif %}
