<div class="accordion" id="accordion-{{ ent_type }}">
  <div class="accordion-item">
    <h2 class="accordion-header" id="heading-{{ ent_type }}">
      <button class="accordion-button p-2" type="button" data-bs-toggle="collapse" data-bs-target="#{{ ent_type }}"
        aria-expanded="true" aria-controls="{{ ent_type }}">
        {% if ent_type == "package" %} <i class='fa fa-sitemap p-2'></i>
          {% elif ent_type == 'group' %} <i class='fa fa-group p-2'></i>
          {% else %} <i class="fa fa-building p-2"></i>
        {% endif %}
        {% if ent_type == 'package' %}
          {{ _('Deleted datasets') }}
        {% elif ent_type == 'organization' %}
          {{ _('Deleted organizations') }}
        {% elif ent_type == 'group' %}
          {{ _('Deleted groups') }}
        {% endif %}
      </button>
    </h2>

{# entities list can be of different types #}
{% set items = [] %}

    <!-- expanded by default to prevent problems with disabled js -->
    <div id="{{ ent_type }}" class="accordion-collapse collapse show p-2" aria-labelledby="heading-{{ ent_type }}"
      data-bs-parent="#accordion-{{ ent_type }}">
      <ul class="{{ ent_type }}-list">
        {% for entity in entities %}
        {% set title = entity.title or entity.name %}
          {% do items.append(title) %}
        <li>
          <a href="{{ h.url_for(entity.type + '.read', id=entity.name) }}" title="{{ title }}">
            {{ title|truncate(80) }}
          </a>
        </li>
        {% else %}
        <p>
          {{ _(messages.empty[ent_type]) }}
        </p>
        {% endfor %}
      </ul>

      <!-- show button only if there is entity to purge -->
      {% if items|length > 0 %}
      <form method="POST" class="d-flex justify-content-end" action="{{ h.url_for('admin.trash') }}"
        id="form-purge-{{ ent_type }}">
        {{ h.csrf_input() }}
        <input type="hidden" name="action" value="{{ent_type}}">
        <a href="{{ h.url_for('admin.trash', name=ent_type) }}" class="btn btn-danger purge-all"
          data-module="confirm-action" data-module-with-data=true
          data-module-content="{{ _(messages.confirm[ent_type]) }}">
          {{ _('Purge') }}
        </a>
      </form>
      {% endif %}
    </div>
  </div>
</div>
