{% load wagtailadmin_tags i18n %}

{% block extra_css %}
    <style>
        .overview-list {
            display: flex;
            flex-wrap: wrap;
        }
        .margin-start-1 {
            margin-bottom: 15px;
            margin-inline-start: 1rem;
        }
    </style>
{% endblock %}

{% block before_results %}
    {% if actions.items %}
        <form method="post">
            {% csrf_token %}
            <div class="nice-padding">
                {% block task_title %}
                    <h2>{% trans "All Tasks" %}</h2>
                {% endblock task_title %}
                <p class="overview-list">
                    {% for code, action in actions.items %}
                        <button class="margin-start-1 button nice-padding mb-2" type="submit" name="action" value="{{code}}" {% if action.is_disabled %}disabled{% endif %}>{{action.get_name}}</button>
                    {% endfor %}
                </p>
            </div>
        </form>
    {% endif %}
{% endblock %}

{% if object_list %}
    <div class="nice-padding">
        {% block results %}
            {% component table %}
        {% endblock %}
        {% block pagination %}
            {% if is_paginated %}
                <div class="nice-padding">
                    {% include "wagtailadmin/shared/pagination_nav.html" with items=page_obj linkurl=index_url %}
                </div>
            {% endif %}
        {% endblock %}
    </div>
{% else %}
    <div class="nice-padding w-mt-8">
        {% block no_results_message %}<p>{% trans "There are no results." %}</p>{% endblock %}
    </div>
{% endif %}
