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

{% block page_size %}col-sm-8{% endblock %}

{% block realcontent %}
    <h2>
        Demande de petits cours&nbsp;
        <a style="float: right" href="{% url 'admin:gestioncof_petitcoursdemande_change' demande.id %}">
            <span class="glyphicon glyphicon-edit"></span> Modifier
        </a>
    </h2>
    {% include "petitscours/details_demande_infos.html" %}
    <hr />
    <table class="table table-striped">
        <tr><td><strong>Traitée</strong></td><td> <img src="{% if demande.traitee %}{% static "vendor/font-awesome/images/yes.png" %}{% else %}{% static "vendor/font-awesome/images/no.png" %}{% endif %}" /></td></tr>
        {% if demande.traitee %}
        <tr><td><strong>Traitée par</strong></td><td> {{ demande.traitee_par }}</td></tr>
        <tr><td><strong>Traitée le</strong></td><td> {{ demande.processed }}</td></tr>
        <tr><td>
            <strong>Attributions</strong></td><td>
            <ul>
            {% for attrib in attributions %}
                <li>{{ attrib.user.get_full_name }} pour {{ attrib.matiere }}, {{ attrib.date|date:"d E Y" }}</li>
            {% endfor %}
            </ul>
        </td>
        </tr>
        {% endif %}
    </table>
    <div>
        <a href="{% url 'petits-cours-demandes-list' %}">Retour à la liste des demandes</a>

        {% if demande.traitee %}
        <form
            style="float: right"
            action="{% url "petits-cours-demande-retraitement" demande.id %}"
        >
            <input class="btn btn-primary" type="submit" value="Retraiter">
        </form>
        {% else %}
        <form
            style="float: right"
            action="{% url "petits-cours-demande-traitement" demande.id %}"
        >
            <input class="btn btn-primary" type="submit" value="Traiter">
        </form>
        {% endif %}
    </div>
{% endblock %}
