feat: render the floor plan in html instead of svg

This commit is contained in:
fromme committed 2026-09-17 16:10:50 +02:00
1 parent 5a01054b0e
commit ad5d5acb00
20 files changed
+256 -356

No files matched your search

+30 -4
View File
@@ -1,7 +1,6 @@
{#
The frame around a plan: heading, legend, span picker. The drawing itself lives in
board/plan/_<type>.html.twig and is included by convention, so a new ResourceType needs a new
partial there and nothing else.
The plan: heading, legend, span picker, then one section per room with a card per spot.
Every ResourceType renders the same way, so a new one needs no template of its own.
Colouring needs no JavaScript at all: the plan is re-rendered server side for the selected day
and span, so free/taken/yours is decided in Twig. Note "free" is always relative to the span
@@ -28,6 +27,33 @@
{% if resources is empty %}
<p class="py-8 text-center text-sm text-gray-500">Für diesen Bereich ist noch nichts eingerichtet.</p>
{% else %}
{% include 'board/plan/_' ~ type.value ~ '.html.twig' %}
{% import 'board/_spot.html.twig' as plan %}
{% set time_params = selected_time.allDay ? {} : { from: selected_time.start, to: selected_time.end } %}
<div class="space-y-6">
{#
Rooms in their configured order, then anything without one. Ungrouped spots get no
heading: a kind of resource that is not split across rooms (the car park) has
nothing to say there that the page heading has not already said.
#}
{% for spot_group in spot_groups %}
<section>
{% if spot_group.group %}
{% set free = spot_group.freeCount %}
<h3 class="!mb-0 pb-2 text-sm font-semibold text-gray-500 md:text-sm">
{{- spot_group.group.label -}}
{%- if free > 0 %} <span class="text-emerald-600">· {{ free }} frei</span>
{%- else %} <span>· belegt</span>{% endif -%}
</h3>
{% endif %}
<div class="grid grid-cols-2 gap-3 sm:grid-cols-3 lg:grid-cols-4">
{% for spot in spot_group.spots %}
{{ plan.spot(spot, selected_date, is_past, time_params) }}
{% endfor %}
</div>
</section>
{% endfor %}
</div>
{% endif %}
</div>