Browse Source

amélioration de la liste des services

Élie Bouttier 8 years ago
parent
commit
2e08a3c239
1 changed files with 25 additions and 29 deletions
  1. 25 29
      services/templates/services/service_list.html

+ 25 - 29
services/templates/services/service_list.html

@@ -5,34 +5,30 @@
 {% block servicestab %} class="active"{% endblock %}
 
 {% block content %}
-    {% if object_list %}
-    <table class="table">
-        <thead>
-            <tr>
-                <th>Identifiant</th>
-                <th>Type</th>
-                <th>Début</th>
-                <th>Fin</th>
-                <th>Actif</th>
-            </tr>
-        </thead>
-        {% for service in object_list %}
-        {% if forloop.first %}
-        <tbody>
+<div class="list-group">
+    {% for service in object_list %}
+    <div class="list-group-item {% if service.is_ongoing %}list-group-item-success{% else %}list-group-item-danger{% endif %}">
+        <h4 class="list-group-item-heading">
+            #{{ service.pk }} <b>{{ service.service_type }}</b>
+        </h4>
+        <p class="list-group-item-text">
+            {{ service.start|default:"depuis toujours" }} – {{ service.end|default:"présent" }}
+        </p>
+        {% if service.contribution.count == 1 %}
+        <p class="list-group-item-text">
+            {{ service.contribution.first }}
+        </p>
+        {% elif service.contribution.count > 1 %}
+        <p class="list-group-item-text">
+            multiples paiements
+        </p>
         {% endif %}
-            <tr class="{% if service.is_ongoing %}success{% else %}{% endif %}">
-                <td>{{ service.pk }}</td>
-                <td>{{ service.service_type }}</td>
-                <td>{{ service.start|default:"–" }}</td>
-                <td>{{ service.end|default:"–" }}</td>
-                <td>{{ service.is_ongoing|yesno:"✔,✘" }}</td>
-            </tr>
-        {% if forloop.last %}
-        </tbody>
-        {% endif %}
-        {% endfor %}
-    </table>
-    {% else %}
-    <p>Vous n’avez aucun services.</p>
-    {% endif %}
+        <p class="list-group-item-text">
+            {{ service.ip_resources.all|join:", " }}
+        </p>
+    </div>
+    {% empty %}
+    <div class="list-group-item">Vous n’avez aucun service.</div>
+    {% endfor %}
+</div>
 {% endblock %}