{% extends "base.html" %}

{% block title %}Rôles{% endblock %}

{% block content %}
    <div class="row border-bottom mb-3">
        <div class="col"><p class="lead">Rôles</p></div>
        {% if perms.aemo.add_role %}
        <div class="col text-end">
            <a class="btn btn-sm btn-outline-primary" href="{% url 'role-add' %}">Nouveau</a>
        </div>
        {% endif %}
    </div>
    <div class="row">
        <div class="col">
            <table class="table table-sm table-hover">
                <thead class="table-light">
                    <tr>
                        <th>Nom</th>
                        <th>Rôle familial</th>
                        <th>Rôle intervenant</th>
                        <th>Éditeur ? {% help_tooltip editeur_help %}</th>
                    </tr>
                </thead>
                <tbody>
                    {% with can_edit=perms.aemo.change_role %}
                    {% for role in object_list %}
                    <tr>
                        <td>{% if can_edit and role.editable %}<a href="{% url 'role-edit' role.pk %}">{% endif %}{{ role.nom }}{% if can_edit and role.editable %}</a>{% endif %}</td>
                        <td>{{ role.est_famille|boolean_icon }}</td>
                        <td>{{ role.est_intervenant|boolean_icon }}</td>
                        <td>{{ role.est_editeur|boolean_icon }}</td>
                    </tr>
                    {% endfor %}
                    {% endwith %}
                </tbody>
            </table>
        </div>
    </div>
{% endblock %}
