{% extends "controlpanel/base.html" %}
{% load lucide %}

{% block heading %}{% if show_archived %}Archived clubs{% else %}Clubs{% endif %}{% endblock heading %}

{% block actions %}
    {% if show_archived %}
        <a class="btn btn-outline" href="{% url 'controlpanel:club_list' %}">{% lucide "archive-x" size=16 %} Hide archived clubs</a>
    {% else %}
        <a class="btn btn-outline" href="{% url 'controlpanel:club_list' %}?archived=1">{% lucide "archive" size=16 %} Show archived clubs</a>
    {% endif %}
    <a class="btn btn-primary gap-2" href="{% url 'controlpanel:club_create' %}">{% lucide "plus" size=16 %} New club</a>
{% endblock actions %}

{% block panel %}
    <form method="get" class="mb-4 flex gap-2">
        {% if show_archived %}<input type="hidden" name="archived" value="1">{% endif %}
        <label class="input">
            <span class="opacity-50">{% lucide "search" size=16 %}</span>
            <input type="search"
                   name="q"
                   value="{{ search }}"
                   placeholder="Search clubs…"
                   class="input input-bordered w-full max-w-xs">
        </label>

        <button class="btn btn-outline gap-2" type="submit">{% lucide "search" size=16 %} Search</button>
        {% if search %}
            <a class="btn btn-primary gap-2" href="{% url "controlpanel:club_list" %}">{% lucide "x" size=16 %} Clear filter</a>
        {% endif %}
    </form>
    <div class="card bg-base-100 shadow">
        <div class="card-body">
            {% if show_archived %}
                {% include "controlpanel/_club_health_table.html" with empty_message="No archived clubs." %}
            {% else %}
                {% include "controlpanel/_club_health_table.html" %}
            {% endif %}
        </div>
    </div>
{% endblock panel %}
