initial demo mode

This commit is contained in:
theo@manjaro 2024-02-12 15:36:07 +01:00
parent 912dd9b5ca
commit c5e0582f21
3 changed files with 162 additions and 2 deletions

9
app.py
View File

@ -412,7 +412,12 @@ def free_rooms(api = False, rq = None) :
return response
else :
url_for("static", filename="style.css")
return render_template("free-rooms.html", **context, **GLOBAL_CONTEXT)
# Vérifie si le mode demo est demandé
demo = str(rq.args.get("demo"))
if demo in ("1", "true", "True"):
return render_template("demo.html", **context, **GLOBAL_CONTEXT)
else:
return render_template("free-rooms.html", **context, **GLOBAL_CONTEXT)
@app.route("/app/date-select", methods=["POST", "GET"])
def date_select() :
@ -492,4 +497,4 @@ def error(e):
flask.render_template
"""
return render_template("error.html", error="Page non trouvée !", **GLOBAL_CONTEXT)
return render_template("error.html", error="Page non trouvée !", **GLOBAL_CONTEXT)

0
static/demostyle.css Normal file
View File

155
templates/demo.html Normal file
View File

@ -0,0 +1,155 @@
<!DOCTYPE html>
<html lang="">
<head>
<meta charset="utf-8">
<title>UniSquat</title>
<link rel="stylesheet" type="text/css" href="../static/demostyle.css">
<meta name="viewport" content="width=300, initial-scale=1" />
</head>
<body>
<main>
<div class="flex">
<p>
DEMO!!!!!Départements sélectionnés : <br>
<b>{{ depts_str }}</b>
</p>
</div>
<div class="flex">
{% if date_str != "" : %}
<b>Le {{ date_str }}</b>
{% endif %}
</div>
<div class="flex" style="margin: 10px">
<a class="button" href='/app/date-select{{ change_date_str }}'>Choisir une date</a>
</div>
{% if favs: %}
<div class="flex" style="margin: 10px">
<a class="button" href="{{ nofavslink }}">Retirer les favoris</a>
</div>
{% endif %}
<form action="/app/free-rooms" method="get">
<div class="flex" style="margin: 10px">
<input style="font-size: 16px;" type="submit" value="Enregistrer les favoris">
</div>
{% if favs: %}
<div class="flex-pc">
{% if favs_free_rooms|length>0: %}
<div class="room-column">
<br>
<h1>Favoris disponibles maintenant</h1>
<div class="flex-container">
<ul>
{% for room in favs_free_rooms : %}
<dt>
<div class="room-row">
<div>
{{ room.name }} {% if DEBUG :%}( {{ room.id }} ){% endif %}
{% if not(room.noend) : %}
<p class=details>Jusqu'à {{ frooms_disp[room.name]["end"] }} (dans {{ frooms_disp[room.name]["rtime"] }})</p>
{% endif %}
</div>
<div>
<input class="fav" type="checkbox" id="{{ room.id }}" name="favs" value="{{ room.id }}" checked> <label style="width:30px;height:30px" for="{{ room.id }}"></label>
</div>
</div>
</dt>
{% endfor %}
</ul>
</div>
</div>
{% endif %}
{% if favs_soon_rooms|length>0: %}
<div class="room-column">
<br>
<h1>Favoris disponibles prochainement</h1>
<div class="flex-container">
<ul>
{% for room in favs_soon_rooms: %}
<dt>
<div class="room-row">
<div>
{{ room.name }} {% if DEBUG :%}( {{ room.id }} ){% endif %}
{% if room.noend : %}
<p class=details>À {{ frooms_disp[room.name]["start"] }} (dans {{ frooms_disp[room.name]["rtime"] }})</p>
{% else %}
<p class=details>De {{ frooms_disp[room.name]["start"] }} à {{ frooms_disp[room.name]["end"] }} (dans {{ frooms_disp[room.name]["rtime"] }})</p>
{% endif %}
</div>
<div>
<input class="fav" type="checkbox" id="{{ room.id }}" name="favs" value="{{ room.id }}" checked> <label style="width:30px;height:30px" for="{{ room.id }}"></label>
</div>
</div>
</dt>
{% endfor %}
</ul>
</div>
</div>
{% endif %}
</div>
{% endif %}
<div class="flex-pc">
{% if free_rooms|length>0 %}
<div class="room-column">
<br>
<h1>Disponibles maintenant</h1>
<div class="flex-container">
<ul>
{% for room in free_rooms: %}
<dt>
<div class="room-row">
<div>
{{ room.name }} {% if DEBUG :%}( {{ room.id }} ){% endif %}
{% if not room.noend : %}
<p class=details>Jusqu'à {{ frooms_disp[room.name]["end"] }} (dans {{ frooms_disp[room.name]["rtime"] }})</p>
{% endif %}
</div>
<div>
<input class="fav" type="checkbox" id="{{ room.id }}" name="favs" value="{{ room.id }}"> <label style="width:30px;height:30px" for="{{ room.id }}"></label>
</div>
</div>
</dt>
{% endfor %}
</ul>
</div>
</div>
{% endif %}
{% if soon_rooms|length>0 %}
<div class="room-column">
<br>
<h1>Disponibles prochainement</h1>
<div class="flex-container">
<ul>
{% for room in soon_rooms: %}
<dt>
<div class="room-row">
<div>
{{ room.name }} {% if DEBUG :%}( {{ room.id }} ){% endif %}
{% if room.noend : %}
<p class=details>À {{ frooms_disp[room.name]["start"] }} (dans {{ frooms_disp[room.name]["rtime"] }})</p>
{% else %}
<p class=details>De {{ frooms_disp[room.name]["start"] }} à {{ frooms_disp[room.name]["end"] }} (dans {{ frooms_disp[room.name]["rtime"] }})</p>
{% endif %}
</div>
<div>
<input class="fav" type="checkbox" id="{{ room.id }}" name="favs" value="{{ room.id }}"> <label style="width:30px;height:30px" for="{{ room.id }}"></label>
</div>
</div>
</dt>
{% endfor %}
</ul>
</div>
</div>
{% endif %}
</div>
<div class="flex">
<!-- Magie noire pour conserver les départements et date-heure séléctionnés (FIXME !!!!) -->
{% for d in dident_list : %}
<span style="display: none;"><input type="text" name="dept" value="{{ d }}"/></span>
{% endfor %}
<span style="display: none;"><input type="text" name="date" value="{{ date_uf_sav }}"/></span>
<span style="display: none;"><input type="text" name="time" value="{{ time_uf_sav }}"/></span>
</div>
</form>
</main>
</body>
</html>