{% extends "base.html" %}

{% block title %}Services{% endblock %}

{% block content %}

    <div class="row border-bottom mb-3">
        <div class="col"><p class="lead">Services partenaires</p></div>
        {% if perms.aemo.add_service %}
        <div class="col text-end"><a class="btn btn-sm btn-outline-primary" href="{% url 'service-add' %}">Nouveau service</a></div>
        {% endif %}
    </div>

    <div class="row">
        <div class="col">
            <table class="table table-sm table-hover">
                <thead class="table-light">
                    <tr>
                        <th>Sigle</th><th>Nom</th>
                    </tr>
                </thead>
                <tbody>
                    {% with can_edit=perms.aemo.change_service %}
                    {% for service in object_list %}
                        <tr>
                            <td>{% if can_edit %}<a href="{% url 'service-edit' service.pk %}">{% endif %}{{ service.sigle }}{% if can_edit %}</a>{% endif %}</td>
                            <td>{{ service.nom_complet }}</td>
                        </tr>
                    {% endfor %}
                    {% endwith %}
                </tbody>
            </table>
        </div>
    </div>
{% endblock %}

