{% extends 'wagtailadmin/bulk_actions/confirmation/base.html' %}
{% load i18n wagtailusers_tags wagtailadmin_tags %}

{% block titletag %}
    {% with counter_val=items|length %}
        {% blocktrans trimmed with counter=counter_val|intcomma count counter_val=counter_val %}Change active state for 1 user {% plural %}Change active state for {{ counter }} users{% endblocktrans %}
    {% endwith %}
{% endblock %}

{% block header %}
    {% trans "Set active state" as header_str %}
    {% include "wagtailadmin/shared/header.html" with title=header_str icon="doc-empty-inverse" %}
{% endblock header %}

{% block items_with_access %}
    {% if items %}
        <p>{% trans "Are you sure you want to change the active state for these users?" %}</p>
        <ul>
            {% for user in items %}
                <li>
                    <a href="{% url 'wagtailusers_users:edit' user.item.pk %}" target="_blank" rel="noreferrer">{{user.item|user_display_name }}</a>
                </li>
            {% endfor %}
        </ul>
    {% endif %}
{% endblock items_with_access %}

{% block items_with_no_access %}

    {% blocktrans trimmed asvar no_access_msg count counter=items_with_no_access|length %}You don't have permission to edit this user{% plural %}You don't have permission to edit these users{% endblocktrans %}
    {% include 'wagtailusers/bulk_actions/list_items_with_no_access.html' with items=items_with_no_access no_access_msg=no_access_msg %}

    {% trans "You cannot change your own active status" as no_access_msg %}
    {% include 'wagtailusers/bulk_actions/list_items_with_no_access.html' with items=mark_self_as_inactive no_access_msg=no_access_msg %}

{% endblock items_with_no_access %}

{% block form_section %}
    {% if items %}
        {% trans 'Yes, change state' as action_button_text %}
        {% trans "No, don't change state" as no_action_button_text %}
        {% include 'wagtailadmin/bulk_actions/confirmation/form_with_fields.html' %}
    {% else %}
        {% include 'wagtailadmin/bulk_actions/confirmation/go_back.html' %}
    {% endif %}
{% endblock form_section %}
