{% comment %}
Re2o est un logiciel d'administration développé initiallement au rezometz. Il
se veut agnostique au réseau considéré, de manière à être installable en
quelques clics.

Copyright © 2017  Gabriel Détraz
Copyright © 2017  Goulven Kermarec
Copyright © 2017  Augustin Lemesle

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
{% endcomment %}

{% if emprunts_list.paginator %}
{% include "pagination.html" with list=emprunts_list %} 
{% endif %}

    <table class="table table-striped">
        <thead>
            <tr>
	    <th>Media</th>
 	    <th>Utilisateur</th>
 	    <th>Date emprunt</th>
	    <th>Permanencier emprunt</th>
 	    <th>Date rendu</th>
 	    <th>Permanencier rendu</th>
            <th></th>
            </tr>
        </thead>
        {% for emprunt in emprunts_list %}
        <tr>
            <td>{{ emprunt.media }}</td>
            <td>
                <a href="{% url 'users:profil' userid=emprunt.user.id %}"><b>{{ emprunt.user }}</b></a>
            </td>
            <td>{{ emprunt.date_emprunt }}</td>
            <td>{{ emprunt.permanencier_emprunt }}</td>
            <td>{% if not emprunt.date_rendu %}{% if is_perm %}<a class="btn btn-primary btn-sm" role="button" href="{% url 'media:retour-emprunt' emprunt.id  %}"><i class="glyphicon glyphicon-ok"></i> Retour</a>{% endif %}{% else %}{{ emprunt.date_rendu }}{% endif %}</td>
            <td>{{ emprunt.permanencier_rendu }}</td>
            <td>
             <div class="dropdown">
             <button class="btn btn-default dropdown-toggle" type="button" id="editionemprunt" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
             Modifier
             <span class="caret"></span>
             </button>
             <ul class="dropdown-menu" aria-labelledby="editionemprunt">
                 {% if is_perm %}
                 <li><a href="{% url 'media:edit-emprunt' emprunt.id %}"><i class="glyphicon glyphicon-edit"></i> Editer</a></li>
                 <li><a href="{% url 'media:del-emprunt' emprunt.id %}"><i class="glyphicon glyphicon-trash"></i> Supprimer</a></li>
                 {% endif %}
                 <li><a href="{% url 'media:history' 'emprunt' emprunt.id %}"><i class="glyphicon glyphicon-time"></i> Historique</a></li>
             </ul>
             </div>
             </td>
        </tr>
        {% endfor %}
    </table>
