{% extends "package/read_base.html" %}
{% import 'macros/form.html' as form %}

{% set default_group_type = h.default_group_type('group') %}

{% block primary_content_inner %}
  <h1>{{ h.humanize_entity_type('group', default_group_type, 'page title') or _('Groups') }}</h2>

  {% if group_dropdown %}
    <form class="add-to-group" method="post">
      {{ h.csrf_input() }}
      <select id="field-add_group" name="group_added" data-module="autocomplete">
        {% for option in group_dropdown %}
          <option value="{{ option[0] }}"> {{ option[1] }}</option>
        {% endfor %}
      </select>
      <button type="submit" class="btn btn-primary" aria-label="{{ _('Associate this group with this dataset') }}">{{ _('Add to group') }}</button>
    </form>
  {% endif %}

  {% if pkg_dict.groups %}
    <form method="post">
      {{ h.csrf_input() }}
      {% snippet 'group/snippets/group_list.html', groups=pkg_dict.groups %}
    </form>
  {% else %}
    <p class="empty">{{ h.humanize_entity_type('group', default_group_type, 'no associated label') or _('There are no groups associated with this dataset') }}</p>
  {% endif %}

{% endblock %}
