rowt/templates/board/boathouse.html.tera

74 lines
3.7 KiB
Plaintext
Raw Normal View History

2024-03-08 13:13:20 +01:00
{% import "includes/macros" as macros %}
{% import "includes/forms/log" as log %}
{% import "includes/forms/boat" as boat %}
{% extends "base" %}
{% macro show_place(aisle_name, side_name, level) %}
2024-03-09 16:49:04 +01:00
<li class="truncate p-2 flex relative w-full">
2024-03-08 13:13:20 +01:00
{% set aisle = aisle_name ~ "-aisle" %}
{% set place = boathouse[aisle][side_name] %}
{% if place[level] %}
{{ place[level].1.name }} <a class="btn btn-primary absolute end-0"
href="/board/boathouse/{{ place[level].0 }}/delete">X</a>
2024-03-08 13:46:00 +01:00
{% elif boats | length > 0 %}
<details>
<summary>Kein Boot</summary>
<form action="/board/boathouse" method="post" class="grid gap-3">
{{ 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="aisle" value="{{ aisle_name }}" />
<input type="hidden" name="side" value="{{ side_name }}" />
<input type="hidden" name="level" value="{{ level }}" />
<input type="submit"
class="btn btn-primary w-full col-span-4"
value="Boot eintragen" />
</form>
</details>
2024-03-08 13:13:20 +01:00
{% else %}
2024-03-08 13:46:00 +01:00
Kein Boot
2024-03-08 13:13:20 +01:00
{% endif %}
</li>
{% endmacro show_place %}
{% macro show_side(aisle_name, side_name) %}
<div class="{{ side_name }}-side">
<ol>
{{ self::show_place(aisle_name = aisle_name, side_name = side_name, level = 0) }}
{{ self::show_place(aisle_name = aisle_name, side_name = side_name, level = 1) }}
{{ 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) }}
{% set show_additional = false %}
{% if aisle_name == "mountain" %}
{% set show_additional = true %}
{% elif aisle_name == "middle" and side_name == "mountain" %}
{% set show_additional = true %}
{% endif %}
{% if show_additional %}
2024-03-15 10:52:13 +01:00
<hr />
{{ self::show_place(aisle_name = aisle_name, side_name = side_name, level = 6) }}
{{ self::show_place(aisle_name = aisle_name, side_name = side_name, level = 7) }}
{{ self::show_place(aisle_name = aisle_name, side_name = side_name, level = 8) }}
{{ self::show_place(aisle_name = aisle_name, side_name = side_name, level = 9) }}
{{ self::show_place(aisle_name = aisle_name, side_name = side_name, level = 10) }}
{{ self::show_place(aisle_name = aisle_name, side_name = side_name, level = 11) }}
{% endif %}
2024-03-08 13:13:20 +01:00
</ol>
</div>
{% endmacro show_side %}
2024-03-09 16:49:04 +01:00
{% macro show_aisle(name, last=false) %}
<div id="{{ name }}-aisle"
class="grid grid-cols-2 gap-4 {% if not last %}md:border-r{% endif %}">
2024-03-08 13:13:20 +01:00
{{ self::show_side(aisle_name = name, side_name = "mountain") }}
{{ self::show_side(aisle_name = name, side_name = "water") }}
</div>
{% endmacro show_aisle %}
{% block content %}
2024-03-09 16:15:47 +01:00
<div class="max-w-screen-lg w-full dark:text-white">
2024-03-08 13:13:20 +01:00
<h1 class="h1">Bootshaus</h1>
2024-03-09 16:49:04 +01:00
<div class="grid md:grid-cols-3 gap-4">
2024-03-09 16:15:47 +01:00
{{ self::show_aisle(name = "mountain") }}
{{ self::show_aisle(name = "middle") }}
2024-03-09 16:49:04 +01:00
{{ self::show_aisle(name = "water", last = true) }}
2024-03-09 16:15:47 +01:00
</div>
2024-03-08 13:13:20 +01:00
</div>
{% endblock content %}