From 68a11538859026f7d43f39e3a0ba7a021934d31e Mon Sep 17 00:00:00 2001 From: philipp Date: Wed, 20 Mar 2024 13:58:42 +0100 Subject: [PATCH] improve boathouse functionality, fixes #261 --- migration.sql | 2 +- templates/board/boathouse.html.tera | 42 ++++++++++++++++++++--------- 2 files changed, 30 insertions(+), 14 deletions(-) diff --git a/migration.sql b/migration.sql index 2df76ef..11c7494 100644 --- a/migration.sql +++ b/migration.sql @@ -146,7 +146,7 @@ CREATE TABLE IF NOT EXISTS "boathouse" ( "boat_id" INTEGER NOT NULL REFERENCES boat(id), "aisle" TEXT NOT NULL CHECK (aisle in ('water', 'middle', 'mountain')), "side" TEXT NOT NULL CHECK(side IN ('mountain', 'water')), - "level" INTEGER NOT NULL CHECK(level BETWEEN 0 AND 3), + "level" INTEGER NOT NULL CHECK(level BETWEEN 0 AND 11), CONSTRAINT unq UNIQUE (aisle, side, level) -- only 1 boat allowed to rest at each space ); diff --git a/templates/board/boathouse.html.tera b/templates/board/boathouse.html.tera index 67bcad2..5f9e3b7 100644 --- a/templates/board/boathouse.html.tera +++ b/templates/board/boathouse.html.tera @@ -10,18 +10,22 @@ {{ place[level].1.name }} X {% elif boats | length > 0 %} -
- Kein Boot -
- {{ macros::select(label="Boot", data=boats, name="boat_id", id="boat_id", display=["name", " (","amount_seats", " x)"], wrapper_class="col-span-4") }} - - - - -
-
+ {% if "admin" in loggedin_user.roles %} +
+ Kein Boot +
+ {{ macros::select(label="Boot", data=boats, name="boat_id", id="boat_id", display=["name", " (","amount_seats", " x)"], wrapper_class="col-span-4") }} + + + + +
+
+ {% else %} + Kein Boot + {% endif %} {% else %} Kein Boot {% endif %} @@ -35,7 +39,9 @@ {{ self::show_place(aisle_name = aisle_name, side_name = side_name, level = 2) }} {{ self::show_place(aisle_name = aisle_name, side_name = side_name, level = 3) }} {{ self::show_place(aisle_name = aisle_name, side_name = side_name, level = 4) }} - {{ self::show_place(aisle_name = aisle_name, side_name = side_name, level = 5) }} + {% if aisle_name != 'water' or side_name != 'water' %} + {{ self::show_place(aisle_name = aisle_name, side_name = side_name, level = 5) }} + {% endif %} {% set show_additional = false %} {% if aisle_name == "mountain" %} {% set show_additional = true %} @@ -57,6 +63,16 @@ {% macro show_aisle(name, last=false) %}
+

+ {% if name == "water" %} + 🌊 + {% elif name == "middle" %} + ◯ + {% else %} + ⛰️ + {% endif %} + - Gang +

{{ self::show_side(aisle_name = name, side_name = "mountain") }} {{ self::show_side(aisle_name = name, side_name = "water") }}