improve boathouse functionality, fixes #261 #281
@ -146,7 +146,7 @@ CREATE TABLE IF NOT EXISTS "boathouse" (
|
|||||||
"boat_id" INTEGER NOT NULL REFERENCES boat(id),
|
"boat_id" INTEGER NOT NULL REFERENCES boat(id),
|
||||||
"aisle" TEXT NOT NULL CHECK (aisle in ('water', 'middle', 'mountain')),
|
"aisle" TEXT NOT NULL CHECK (aisle in ('water', 'middle', 'mountain')),
|
||||||
"side" TEXT NOT NULL CHECK(side IN ('mountain', 'water')),
|
"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
|
CONSTRAINT unq UNIQUE (aisle, side, level) -- only 1 boat allowed to rest at each space
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -10,18 +10,22 @@
|
|||||||
{{ place[level].1.name }} <a class="btn btn-primary absolute end-0"
|
{{ place[level].1.name }} <a class="btn btn-primary absolute end-0"
|
||||||
href="/board/boathouse/{{ place[level].0 }}/delete">X</a>
|
href="/board/boathouse/{{ place[level].0 }}/delete">X</a>
|
||||||
{% elif boats | length > 0 %}
|
{% elif boats | length > 0 %}
|
||||||
<details>
|
{% if "admin" in loggedin_user.roles %}
|
||||||
<summary>Kein Boot</summary>
|
<details>
|
||||||
<form action="/board/boathouse" method="post" class="grid gap-3">
|
<summary>Kein Boot</summary>
|
||||||
{{ macros::select(label="Boot", data=boats, name="boat_id", id="boat_id", display=["name", " (","amount_seats", " x)"], wrapper_class="col-span-4") }}
|
<form action="/board/boathouse" method="post" class="grid gap-3">
|
||||||
<input type="hidden" name="aisle" value="{{ aisle_name }}" />
|
{{ macros::select(label="Boot", data=boats, name="boat_id", id="boat_id", display=["name", " (","amount_seats", " x)"], wrapper_class="col-span-4") }}
|
||||||
<input type="hidden" name="side" value="{{ side_name }}" />
|
<input type="hidden" name="aisle" value="{{ aisle_name }}" />
|
||||||
<input type="hidden" name="level" value="{{ level }}" />
|
<input type="hidden" name="side" value="{{ side_name }}" />
|
||||||
<input type="submit"
|
<input type="hidden" name="level" value="{{ level }}" />
|
||||||
class="btn btn-primary w-full col-span-4"
|
<input type="submit"
|
||||||
value="Boot eintragen" />
|
class="btn btn-primary w-full col-span-4"
|
||||||
</form>
|
value="Boot eintragen" />
|
||||||
</details>
|
</form>
|
||||||
|
</details>
|
||||||
|
{% else %}
|
||||||
|
Kein Boot
|
||||||
|
{% endif %}
|
||||||
{% else %}
|
{% else %}
|
||||||
Kein Boot
|
Kein Boot
|
||||||
{% endif %}
|
{% 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 = 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 = 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 = 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 %}
|
{% set show_additional = false %}
|
||||||
{% if aisle_name == "mountain" %}
|
{% if aisle_name == "mountain" %}
|
||||||
{% set show_additional = true %}
|
{% set show_additional = true %}
|
||||||
@ -57,6 +63,16 @@
|
|||||||
{% macro show_aisle(name, last=false) %}
|
{% macro show_aisle(name, last=false) %}
|
||||||
<div id="{{ name }}-aisle"
|
<div id="{{ name }}-aisle"
|
||||||
class="grid grid-cols-2 gap-4 {% if not last %}md:border-r{% endif %}">
|
class="grid grid-cols-2 gap-4 {% if not last %}md:border-r{% endif %}">
|
||||||
|
<h1 class="col-span-2 text-center">
|
||||||
|
{% if name == "water" %}
|
||||||
|
🌊
|
||||||
|
{% elif name == "middle" %}
|
||||||
|
◯
|
||||||
|
{% else %}
|
||||||
|
⛰️
|
||||||
|
{% endif %}
|
||||||
|
- Gang
|
||||||
|
</h1>
|
||||||
{{ self::show_side(aisle_name = name, side_name = "mountain") }}
|
{{ self::show_side(aisle_name = name, side_name = "mountain") }}
|
||||||
{{ self::show_side(aisle_name = name, side_name = "water") }}
|
{{ self::show_side(aisle_name = name, side_name = "water") }}
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user