{% extends "petitscours/base_title.html" %}
{% load static %}

{% block realcontent %}
    <h2>Demandes de petits cours</h2>
{% if object_list %}
    <table class="table table-stripped">
        <thead>
            <th>Nom</th>
            <th>Matières</th>
            <th>Date</th>
            <th>Traitée</th>
            <th>par</th>
            <th></th>
        </thead>
        <tbody>
        {% for demande in object_list %}
            <tr>
                <td>{{ demande.name }}</td>
                <td>{% for matiere in demande.matieres.all %}{% if forloop.counter0 > 0 %}, {% endif %}{{ matiere }}{% endfor %}</td>
                <td>{{ demande.created|date:"d E Y" }}</td>
		<td style="text-align: center;"><img src="{% if demande.traitee %}{% static "vendor/font-awesome/images/yes.png" %}{% else %}{% static "vendor/font-awesome/images/no.png" %}{% endif %}" /></td>
                <td>{% if demande.traitee_par %}{{ demande.traitee_par.username }}{% else %}<span class="glyphicon glyphicon-ban-circle"></span>{% endif %}</td>
                <td><a href="{% url "petits-cours-demande-details" demande.id %}" class="see_detail">Détails</a></td>
            </tr>
        {% endfor %}
        </tbody>
    </table>
    {% if is_paginated %}
        <div class="pagination">
            <span class="page-links">
                {% if page_obj.has_previous %}
                    <a href="{% url "petits-cours-demandes-list" %}?page={{ page_obj.previous_page_number }}">&lt;</a>
                {% endif %}
                <span class="page-current">
                    Page {{ page_obj.number }} sur {{ page_obj.paginator.num_pages }}
                </span>
                {% if page_obj.has_next %}
                    <a href="{% url "petits-cours-demandes-list" %}?page={{ page_obj.next_page_number }}">&gt;</a>
                {% endif %}
            </span>
        </div>
    {% endif %}
{% else %}
    <p>Aucune demande :(</p>
{% endif %}
{% endblock %}
