{% extends "base.html" %}

{% block content %}
    <div class="row border-bottom mb-3">
        <div class="col"><p class="lead">Centres scolaires</p></div>
        {% if perms.aemo.add_cerclescolaire %}
        <div class="col text-end">
            <a class="btn btn-sm btn-outline-primary" href="{% url 'cercle-add' %}">Nouveau</a>
        </div>
        {% endif %}
    </div>
    <div class="row">
        <div class="col">
            <table class="table table-sm table-hover stat_table">
                <thead class="table-light">
                    <tr>
                        <th>Nom</th>
                        <th>Téléphone</th>
                    </tr>
                </thead>
                <tbody>
                    {% with can_edit=perms.aemo.change_cerclescolaire %}
                    {% for item in object_list %}
                    <tr>
                        <td>{% if can_edit %}<a href="{% url 'cercle-edit' item.pk %}">{% endif %}{{ item.nom }}{% if can_edit %}</a>{% endif %}</td>
                        <td>{{ item.telephone }}</td>
                    </tr>
                    {% endfor %}
                    {% endwith %}
                </tbody>
            </table>
        </div>
    </div>
{% endblock %}