{% extends "base.html" %}

{% block content %}
   <ul class="nav nav-tabs nav-prestations">
      <li class="nav-item">
         <a class="nav-link" href="{% url 'prestation-menu' %}">Prestations par famille</a>
      </li>
      <li class="nav-item">
         <a class="nav-link active" href="{% url 'prestation-generale' %}">Prestations générales</a>
      </li>
      <li class="nav-item">
         <a class="nav-link" href="{% url 'prestation-personnelle' %}">Mes prestations</a>
      </li>
   </ul>
   <div class="row mt-3">
      <div class="col">
         <p class="lead">
            {% if prev_month %}
               <a class="btn btn-sm" href="?date={{ prev_month|date:'mY' }}"><button>&lt;</button></a>
            {% endif %}
            {{ current_date.month|month_name }} {{ current_date.year }}
            {% if next_month %}
               <a class="btn btn-sm" href="?date={{ next_month|date:'mY' }}"><button>&gt;</button></a>
            {% endif %}
         </p>
      </div>
      <div class="col text-end">
         <a class="btn btn-outline-primary" href="{% url 'prestation-gen-add' %}">
            <img src="{% static 'admin/img/icon-addlink.svg' %}"> Ajouter une prestation générale
         </a>
      </div>
   </div>
   <div class="row mt-2">
      <div class="col">
         <table class="table table-sm prestations">
            <thead class="table-light">
               <tr>
                  <th width="10%">Date</th>
                  <th>Durée</th>
                  <th>Participants</th>
                  <th>Texte</th>
                  <th width="5%">Auteur</th>
                  <th class="action">Action</th>
               </tr>
            </thead>
            <tbody>
               {% for prest in prestations %}
                  <tr>
                     <td>{{ prest.date_prestation }}</td>
                     <td>{{ prest.duree|format_duree }}</td>
                     <td>{{ prest|sigles_intervenants }}</td>
                     <td>{{ prest.texte|striptags }}</td>
                     <td>{{ prest.auteur|sigle_personne }}</td>
                     <td class="action">
                     {% if prest|can_edit:user %}
                        <a href="{% url 'prestation-edit' 0 prest.pk %}">
                           <img src="{% static 'admin/img/icon-changelink.svg' %}">
                        </a>
                     {% endif %}
                     </td>
                  </tr>
               {% endfor %}
            </tbody>
         </table>
      </div>
   </div>
{% endblock %}
