{% extends 'django_spire/item/item.html' %}
{% load spire_core_tags %}

{% block item_title %}
    {% if perms.django_spire_auth_group.view_authgroup %}
        {% url 'django_spire:auth:group:page:detail' pk=group.pk as group_detail_url %}
    {% endif %}
    {% include 'django_spire/element/attribute_element.html' with attribute_href=group_detail_url attribute_title='Name' attribute_value=group.name %}
{% endblock %}

{% block item_row_content %}
    {% for perm in perm_data %}
        <div class="col-lg-4 col-sm-3 col-4 mb-2">
            {% include 'django_spire/element/attribute_element.html' with attribute_title=perm.verbose_app_name|default:perm.app_name|title %}
            {% include 'django_spire/auth/group/element/group_perm_level_badge.html' with permission_level=perm.level_verbose|title %}
        </div>
    {% endfor %}
{% endblock %}

{% block item_button %}
    {% if location == 'group' and group.name != 'All Users' %}
        {% if perms.django_spire_auth_group.change_authgroup %}
            {% url 'django_spire:auth:group:page:detail' pk=group.pk as view_url %}
            {% url 'django_spire:auth:group:form:update' pk=group.pk as edit_url %}
            {% if perms.django_spire_auth_group.delete_authgroup %}
                {% url 'django_spire:auth:group:form:delete' pk=group.pk as delete_url %}
            {% endif %}
            {% include 'django_spire/dropdown/ellipsis_dropdown.html' with view_url=view_url edit_url=edit_url delete_url=delete_url %}
        {% endif %}
    {% endif %}
{% endblock %}
