rowt/templates/board/boathouse.html.tera
philipp 69edb63ddd
All checks were successful
CI/CD Pipeline / test (push) Successful in 10m9s
CI/CD Pipeline / deploy-staging (push) Has been skipped
CI/CD Pipeline / deploy-main (push) Has been skipped
styling
2024-03-08 13:46:00 +01:00

54 lines
2.4 KiB
Plaintext

{% 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) %}
<li>
{% set aisle = aisle_name ~ "-aisle" %}
{% set place = boathouse[aisle][side_name] %}
{% if place[level] %}
{{ place[level].1.name }} <a href="/board/boathouse/{{ place[level].0 }}/delete">X</a>
{% 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>
{% else %}
Kein Boot
{% 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) }}
</ol>
</div>
{% endmacro show_side %}
{% macro show_aisle(name) %}
<div id="{{ name }}-aisle">
{{ self::show_side(aisle_name = name, side_name = "mountain") }}
{{ self::show_side(aisle_name = name, side_name = "water") }}
</div>
{% endmacro show_aisle %}
{% block content %}
{% if flash %}{{ macros::alert(message=flash.1, type=flash.0, class="sm:col-span-2 lg:col-span-3") }}{% endif %}
<div class="max-w-screen-lg w-full">
<h1 class="h1">Bootshaus</h1>
{{ self::show_aisle(name = "mountain") }}
{{ self::show_aisle(name = "middle") }}
{{ self::show_aisle(name = "water") }}
</div>
{% endblock content %}