{% extends "wagtailadmin/generic/index.html" %}
{% load i18n wagtailadmin_tags %}

{% block main_header %}
    {% fragment as workflow_actions %}
        <a href="{% url "wagtailadmin_workflows:task_index" %}?show_disabled={% if showing_disabled %}false{% else %}true{% endif %}" class="button button-secondary button--icon w-inline-flex w-items-center w-gap-2">
            {% if showing_disabled %}
                {% icon name="no-view" %}{% trans "Hide disabled tasks" %}
            {% else %}
                {% icon name="view" %}{% trans "Show disabled tasks" %}
            {% endif %}
        </a>
        <a href="{% url view.add_url_name %}" class="button bicolor button--icon">{% icon name="plus" wrapped=1 %}{{ view.add_item_label }}</a>
    {% endfragment %}
    {% include "wagtailadmin/shared/header.html" with title=page_title icon=header_icon extra_actions=workflow_actions %}
{% endblock %}

{% block listing %}
    <div class="nice-padding">
        {% if tasks %}
            {% component table %}
        {% else %}
            {% url view.add_url_name as add_url %}
            {% if showing_disabled %}
                <p>{% blocktrans trimmed %}No tasks have been created. Why not <a href="{{ add_url }}">add one</a>?{% endblocktrans %}</p>
            {% else %}
                <p>{% blocktrans trimmed %}There are no enabled tasks. Why not <a href="{{ add_url }}">add one</a>?{% endblocktrans %}</p>
            {% endif %}
        {% endif %}
    </div>
{% endblock %}
