{% extends "base.html" %}
{% comment %}
SPDX-License-Identifier: GPL-3.0-or-later
{% endcomment %}
{% load i18n pretty_money perms %}

{# Use a fluid-width container #}
{% block containertype %}container-fluid{% endblock %}

{% block content %}
<div class="row mt-4">
    <div class="col-xl-4">
        {% block profile_info %}
        {% if club %}
        <div class="card bg-light">
            <h4 class="card-header text-center">
                {{ club.name }}
            </h4>
            <div class="card-top text-center">
                <a href="{% url 'member:club_update_pic' club.pk  %}">
                    <img src="{{ club.note.display_image.url }}" class="img-thumbnail mt-2">
                </a>
            </div>
            <div class="card-body" id="profile_infos">
                <dl class="row">
                    <dt class="col-xl-6">{% trans 'name'|capfirst %}</dt>
                    <dd class="col-xl-6">{{ club.name }}</dd>

                    {% if club.require_memberships %}
                    <dt class="col-xl-6">{% trans 'date start'|capfirst %}</dt>
                    <dd class="col-xl-6">{{ club.date_start }}</dd>

                    <dt class="col-xl-6">{% trans 'date end'|capfirst %}</dt>
                    <dd class="col-xl-6">{{ club.date_end }}</dd>

                    <dt class="col-xl-6">{% trans 'year'|capfirst %}</dt>
                    <dd class="col-xl-6">{{ club.year }}</dd>

                    {% if club.membership_fee_paid == club.membership_fee_unpaid %}
                    <dt class="col-xl-6">{% trans 'membership fee'|capfirst %}</dt>
                    <dd class="col-xl-6">{{ club.membership_fee_paid|pretty_money }}</dd>
                    {% else %}

                    <dt class="col-xl-6">{% trans 'WEI fee (paid students)'|capfirst %}</dt>
                    <dd class="col-xl-6">{{ club.membership_fee_paid|pretty_money }}

                    <dt class="col-xl-6">{% trans 'WEI fee (unpaid students)'|capfirst %}</dt>
                    <dd class="col-xl-6">{{ club.membership_fee_unpaid|pretty_money }}
                    {% endif %}
                    {% endif %}

                    {% if club.deposit_amount > 0 %}
                    <dt class="col-xl-6">{% trans 'deposit amount'|capfirst %}</dt>
                    <dd class="col-xl-6">{{ club.deposit_amount|pretty_money }}</dd>
                    {% endif %}

                    {% if "note.view_note"|has_perm:club.note %}
                    <dt class="col-xl-6">{% trans 'balance'|capfirst %}</dt>
                    <dd class="col-xl-6">{{ club.note.balance | pretty_money }}</dd>
                    {% endif %}

                    {% if "note.change_alias"|has_perm:club.note.alias.first %}
                    <dt class="col-xl-4"><a
                            href="{% url 'member:club_alias' club.pk %}">{% trans 'aliases'|capfirst %}</a></dt>
                    <dd class="col-xl-8 text-truncate">{{ club.note.alias.all|join:", " }}</dd>
                    {% endif %}

                    <dt class="col-xl-4">{% trans 'email'|capfirst %}</dt>
                    <dd class="col-xl-8"><a href="mailto:{{ club.email }}">{{ club.email }}</a></dd>
                </dl>
            </div>
            <div class="card-footer text-center">
                {% if True %}
                <a class="btn btn-primary btn-sm my-1" href="{% url 'wei:wei_list' %}"> {% trans "WEI list" %}</a>
                {% endif %}
                {% if club.is_current_wei %}
                {% if can_add_first_year_member %}
                <a class="btn btn-primary btn-sm my-1" href="{% url 'wei:wei_register_1A' wei_pk=club.pk %}"
                    data-turbolinks="false"> {% trans "Register 1A" %}</a>
                {% endif %}
                {% if can_add_any_member %}
                <a class="btn btn-primary btn-sm my-1" href="{% url 'wei:wei_register_2A' wei_pk=club.pk %}"
                    data-turbolinks="false"> {% trans "Register 2A+" %}</a>
                {% endif %}
                {% if "wei.change_"|has_perm:club %}
                <a class="btn btn-primary btn-sm my-1" href="{% url 'wei:wei_update' pk=club.pk %}"
                    data-turbolinks="false"> {% trans "Edit" %}</a>
                {% endif %}
                {% if can_add_bus %}
                <a class="btn btn-primary btn-sm my-1" href="{% url 'wei:add_bus' pk=club.pk %}"
                    data-turbolinks="false"> {% trans "Add bus" %}</a>
                {% endif %}
                {% url 'wei:wei_detail' club.pk as club_detail_url %}
                {%if request.path_info != club_detail_url %}
                <a class="btn btn-primary btn-sm my-1" href="{{ club_detail_url }}">{% trans 'View WEI' %}</a>
                {% endif %}
                {% endif %}
            </div>
        </div>
        {% endif %}
        {% endblock %}
    </div>
    <div class="col-xl-8">
        {% block profile_content %}{% endblock %}
    </div>
</div>
{% endblock %}
