{% load render_table from django_tables2 %}
{% load i18n %}
{% load perms %}
<div class="card">
    <div class="card-header text-center">
        <h4>WEI</h4>
    </div>
    <div class="card-body">
        <p>LE WEI, c'est cool !</p>
    </div>

    {% if club.is_current_wei %}
        <div class="card-footer text-center">
            {% if not my_registration %}
                {% if not not_first_year %}
                    <a href="{% url "wei:wei_register_1A_myself" wei_pk=club.pk %}" data-turbolinks="false"><button class="btn btn-success">{% trans "Register to the WEI! – 1A" %}</button></a>
                {% endif %}
                <a href="{% url "wei:wei_register_2A_myself" wei_pk=club.pk %}" data-turbolinks="false"><button class="btn btn-success">{% trans "Register to the WEI! – 2A+" %}</button></a>
            {% else %}
                <a href="{% url "wei:wei_update_registration" pk=my_registration.pk %}" data-turbolinks="false"><button class="btn btn-warning">{% trans "Update my registration" %}</button></a>
            {% endif %}
        </div>
    {% endif %}
</div>

<hr>

{% if buses.data %}
    <div class="card">
        <div class="card-header position-relative" id="clubListHeading">
            <a class="font-weight-bold">
                <i class="fa fa-bus"></i> {% trans "Buses" %}
            </a>
        </div>
        {% render_table buses %}
    </div>

    <hr>
{% endif %}

{% if member_list.data %}
    <div class="card">
        <div class="card-header position-relative" id="clubListHeading">
            <a class="stretched-link font-weight-bold" href="{% url "wei:wei_memberships" pk=club.pk %}">
                <i class="fa fa-users"></i> {% trans "Members of the WEI" %}
            </a>
        </div>
        {% render_table member_list %}
    </div>

    <hr>
{% endif %}

{% if history_list.data %}
    <div class="card">
        <div class="card-header position-relative" id="historyListHeading">
            <a class="stretched-link font-weight-bold" {% if "note.view_note"|has_perm:club.note %} href="{% url 'note:transactions' pk=club.note.pk %}" {% endif %}>
                <i class="fa fa-euro"></i> {% trans "Transaction history" %}
            </a>
        </div>
        <div id="history_list">
            {% render_table history_list %}
        </div>
    </div>

    <hr>
{% endif %}

{% if pre_registrations.data %}
    <div class="card">
        <div class="card-header position-relative" id="historyListHeading">
            <a class="stretched-link font-weight-bold" href="{% url 'wei:wei_registrations' pk=club.pk %}">
                <i class="fa fa-user-plus"></i> {% trans "Unvalidated registrations" %}
            </a>
        </div>
        <div id="history_list">
            {% render_table pre_registrations %}
        </div>
    </div>

    <hr>
{% endif %}
