control.html 4.25 KB
Newer Older
Gabriel Detraz's avatar
Gabriel Detraz committed
1 2 3 4 5 6 7
{% extends "panier/sidebar.html" %}
{% load bootstrap3 %}
{% load staticfiles%}

{% block title %}Controle des livraisons{% endblock %}

{% block content %}
8

Gabriel Detraz's avatar
Gabriel Detraz committed
9
<form class="form" method="post">
Amap's avatar
Amap committed
10 11 12
 {% csrf_token %}

{% if livraisonform %}
Amap's avatar
Amap committed
13 14
<h2>Séléctioner une date de livraison</h2>
    <a type="button" class="btn btn-success" href="{% url 'panier:plusProcheLivraison' %}">Livraison la plus proche</a>
15 16
    {% bootstrap_form livraisonform %}

Amap's avatar
Amap committed
17

Amap's avatar
Amap committed
18 19 20
{% else %}
<h2>Résumé</h2>

21 22 23 24 25 26 27
    <table class="table table-inverse">
        <tr>
            <th>Commandes pour la livraison</th>
            <td>{{ livraison_commandes }}</td>
            <th>Paniers pour la livraison</th>
            <td>{{ livraison_paniers }}</td>
        </tr>
Amap's avatar
Amap committed
28
    </table>
29
    <table class="table table-inverse">
30 31
	    <tr>
            {% for key,value in livraison_quantite.items %}
32 33
            <td>{{ key }} panier</td>
            <td><p class="text-success">{{ value }}</p></td>
34 35 36
            {%endfor%}
        </tr>
    </table>
Amap's avatar
Amap committed
37 38 39



40
<h2>Utilisateurs non livrés</h2>
Gabriel Detraz's avatar
Gabriel Detraz committed
41
    {{ controlform.management_form }}
42
    <table class="table table-striped table-hover">
Gabriel Detraz's avatar
Gabriel Detraz committed
43 44
        <thead>
            <tr>
45
                <th>  </th>
Gabriel Detraz's avatar
Gabriel Detraz committed
46 47 48 49 50
                <th>Utilisateur</th>
                <th>Designation</th>
                <th>Prix unitaire</th>
                <th>Quantite</th>
                <th>Date de livraison</th>
51 52 53 54
                <th>Livré</th>
                <th>Sac à disposition</th>
                <th>Gérer les sacs</th>
                <th></th>
Gabriel Detraz's avatar
Gabriel Detraz committed
55 56 57
            </tr>
        </thead>
        {% for form in controlform.forms %}
58
        {% if not form.instance.livre %}
Gabriel Detraz's avatar
Gabriel Detraz committed
59 60
        {% bootstrap_form_errors form %}
        <tr>
61
            <td><a href="{% url "users:profil" form.instance.user.id%}" class="btn btn-primary btn-sm" role="button"><i class="glyphicon glyphicon-user"></i></a>
Gabriel Detraz's avatar
Gabriel Detraz committed
62 63 64 65 66 67
            <td>{{ form.instance.user }}</td>
            <td>{{ form.instance.nom }}</td>
            <td>{{ form.instance.prix_unitaire }}</td>
            <td>{{ form.instance.quantite }}</td>
            <td>{{ form.instance.date }}</td>
            <td>{{ form.livre }}</td>
68 69 70
	    <td>{{ form.instance.user.sac_consignes }}</td>
            <td><a class="btn btn-primary btn-sm" role="button" href="{% url 'panier:add-sac' form.instance.user.id %}"><i class="glyphicon glyphicon-plus"></i> Ajouter</a></td>
            <td> <a class="btn btn-primary btn-sm" role="button" href="{% url 'panier:del-sac' form.instance.user.id %}"><i class="glyphicon glyphicon-minus"></i> Retirer</a></td>
Gabriel Detraz's avatar
Gabriel Detraz committed
71 72 73 74
            {% for hidden in form.hidden_fields %}
            {{ hidden }}
            {% endfor %}
        </tr>
75
        {% endif %}
Gabriel Detraz's avatar
Gabriel Detraz committed
76 77
        {% endfor %}
    </table>
78 79 80

<h2>Utilisateurs déjà livrés</h2>
    {{ controlform.management_form }}
81
    <table class="table table-striped table-hover">
82 83 84 85 86 87 88 89 90 91 92 93 94 95
        <thead>
            <tr>
                <th>Utilisateur</th>
                <th>Designation</th>
                <th>Prix unitaire</th>
                <th>Quantite</th>
                <th>Date de livraison</th>
                <th>Livré</th>
                <th>Sac à disposition</th>
                <th>Gérer les sacs</th>
                <th></th>
            </tr>
        </thead>
        {% for form in controlform.forms %}
96
        {% if form.instance.livre %}
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115
        {% bootstrap_form_errors form %}
        <tr>
            <td>{{ form.instance.user }}</td>
            <td>{{ form.instance.nom }}</td>
            <td>{{ form.instance.prix_unitaire }}</td>
            <td>{{ form.instance.quantite }}</td>
            <td>{{ form.instance.date }}</td>
            <td>{{ form.livre }}</td>
        <td>{{ form.instance.user.sac_consignes }}</td>
            <td><a class="btn btn-primary btn-sm" role="button" href="{% url 'panier:add-sac' form.instance.user.id %}"><i class="glyphicon glyphicon-plus"></i> Ajouter</a></td>
            <td> <a class="btn btn-primary btn-sm" role="button" href="{% url 'panier:del-sac' form.instance.user.id %}"><i class="glyphicon glyphicon-minus"></i> Retirer</a></td>
            {% for hidden in form.hidden_fields %}
            {{ hidden }}
            {% endfor %}
        </tr>
        {% endif %}
        {% endfor %}
    </table>

Amap's avatar
Amap committed
116
{% endif %}
117
{% bootstrap_button "Valider" button_type="submit"  icon="star" %}
Amap's avatar
Amap committed
118 119


Gabriel Detraz's avatar
Gabriel Detraz committed
120 121 122
</form>

{% endblock %}