Simple séléction de favoris

This commit is contained in:
theo@manjaro 2022-06-15 21:48:25 +02:00
parent a23d5735df
commit 333d2bf3d7
3 changed files with 18 additions and 3 deletions

2
app.py
View File

@ -150,7 +150,7 @@ def free_rooms() :
time_uf = time_uf.split(":")
# Récupére les IDs des salles favorites
favs_ids = request.args.get("favs")
favs_ids = request.args.getlist("favs")
if favs_ids==None:
favs_ids = []

View File

@ -211,6 +211,10 @@ input[type="checkbox"] {
height: 0px;
}
input[type=checkbox]:checked ~ .remove-check {
display: none;
}
.flex {
display: flex;
flex-wrap: wrap;

View File

@ -31,12 +31,13 @@
<div class="flex">
<a class="button" href='/app/date-select{{change_date_str}}'>Choisir une date</a>
</div>
<form action="/app/free-rooms" method="get">
<h1>Disponibles maintenant</h1>
<div class="flex-container">
<ul>
{% for room in free_rooms : %}
{% if room.is_free : %}
<dt>{{ room.name }} {% if DEBUG :%}( {{ room.id }} ){% endif %}
<dt>{{ room.name }} {% if DEBUG :%}( {{ room.id }} ){% endif %}{%if not favs:%}<input class="fav" type="checkbox" id="{{ room.id }}" name="favs" value="{{ room.id }}"> <label for="{{ room.id }}"></label>{% endif %}
{% if not(room.end.hour == 23 and room.end.minute == 59 and room.end.second == 59) : %}
<br><span class=details>Jusqu'à {{ frooms_disp[room.name]["end"] }} (dans {{ frooms_disp[room.name]["rtime"] }})</span>
{% endif %}
@ -51,7 +52,7 @@
<ul>
{% for room in free_rooms : %}
{% if not room.is_free : %}
<dt>{{ room.name }} {% if DEBUG :%}( {{ room.id }} ){% endif %}
<dt>{{ room.name }} {% if DEBUG :%}( {{ room.id }} ){% endif %}{%if not favs:%}<input class="fav" type="checkbox" id="{{ room.id }}" name="favs" value="{{ room.id }}"> <label for="{{ room.id }}"></label>{% endif %}
{% if room.end.hour == 23 and room.end.minute == 59 and room.end.second == 59 : %}
<br><span class=details>À {{ frooms_disp[room.name]["start"] }} (dans {{ frooms_disp[room.name]["rtime"] }})</span>
{% else %}
@ -62,6 +63,16 @@
{% endfor %}
</ul>
</div>
<div class="flex">
{% for d in dident_list : %} <!-- Magie noire pour conserver les départements séléctionnés -->
<span style="display: none;"><input type="text" name="dept" value="{{ d }}"/></span>
{% endfor %}
{% if not favs:%}
<input type="submit" value="Valider les favoris">
{% endif %}
</div>
</form>
</main>
{% include "footer.html" %}
</body>