{% 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 class="truncate p-2 flex relative w-full"> {% set aisle = aisle_name ~ "-aisle" %} {% set place = boathouse[aisle][side_name] %} {% if place[level] %} {{ place[level].1.name }} {% if "admin" in loggedin_user.roles %} <a class="btn btn-primary absolute end-0" href="/board/boathouse/{{ place[level].0 }}/delete">X</a> {% endif %} {% elif boats | length > 0 %} {% if "admin" in loggedin_user.roles %} <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 %} {% 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) }} {{ self::show_place(aisle_name = aisle_name, side_name = side_name, level = 4) }} {% 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 %} {% elif aisle_name == "middle" and side_name == "mountain" %} {% set show_additional = true %} {% endif %} {% if show_additional %} <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 %} </ol> </div> {% endmacro show_side %} {% macro show_aisle(name, last=false) %} <div id="{{ name }}-aisle" 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 = "water") }} </div> {% endmacro show_aisle %} {% block content %} <div class="max-w-screen-lg w-full dark:text-white"> <h1 class="h1">Bootshaus</h1> <div class="grid md:grid-cols-3 gap-4"> {{ self::show_aisle(name = "mountain") }} {{ self::show_aisle(name = "middle") }} {{ self::show_aisle(name = "water", last = true) }} </div> </div> {% endblock content %}