{% extends "admin/change_list.html" %}
{% load i18n %}

{% block object-tools-items %}
<div class="d-flex align-items-center mb-2">
    <form id="lotterySelectForm" method="get" class="form-inline mr-3">
        <select name="lottery_id" id="lotterySelect" class="form-control mr-2">
            <option value="">{% trans "-- Выберите розыгрыш --" %}</option>
            {% for lottery in active_lotteries %}
                <option value="{{ lottery.id }}" {% if request.GET.lottery_id == lottery.id|stringformat:"s" %}selected{% endif %}>
                    {{ lottery.name }}
                </option>
            {% endfor %}
        </select>
        <button type="submit" class="btn btn-primary">{% trans "Выбрать" %}</button>
    </form>
    <a href="{% url 'admin:add_participants' %}?lottery_id={{ request.GET.lottery_id|default:'' }}" class="btn btn-success">
        {% trans "Добавить участников" %}
    </a>
</div>
{{ block.super }}
{% endblock %}
