Files
ephub/templates/board/plan/_desk.html.twig
T

48 lines
2.5 KiB
Twig

{#
The office. Hand-authored geometry in two maps: `rooms` is keyed by ResourceGroup.svgElementId
and `geometry` by Resource.svgElementId, so a row whose id is missing from its map is simply
not drawn (and vice versa) -- app:seed and these maps have to agree.
Box height is set by what goes inside it, not by taste: _spot.html.twig puts the label at
+18 and up to three lines at +34, +47 and +60, so 86 leaves a comfortable margin below the
last one. Changing MAX_LINES there means changing the height here.
A room band is 118 high: 16 of margin, an 86-high desk, 16 again. The 30 between two bands is
what the next room's caption sits in, since room() draws it above the rect. Moving a desk
between rooms therefore means moving its y here as well as its group in the database -- the
drawing is artwork, and no amount of indirection changes that.
Found by convention from ResourceType::DESK->value, see board/_floorplan.html.twig.
#}
{% import 'board/plan/_spot.html.twig' as plan %}
{% set rooms = {
'room-01': { x: 10, y: 22, width: 500, height: 118 },
'room-02': { x: 10, y: 170, width: 500, height: 118 },
'room-03': { x: 10, y: 318, width: 500, height: 118 },
'room-04': { x: 10, y: 466, width: 500, height: 118 }
} %}
{% set geometry = {
'desk-01': { x: 40, y: 38 }, 'desk-02': { x: 200, y: 38 }, 'desk-03': { x: 360, y: 38 },
'desk-04': { x: 40, y: 186 }, 'desk-05': { x: 200, y: 186 }, 'desk-06': { x: 360, y: 186 },
'desk-07': { x: 40, y: 334 }, 'desk-08': { x: 200, y: 334 }, 'desk-09': { x: 360, y: 334 },
'desk-10': { x: 40, y: 482 }, 'desk-11': { x: 200, y: 482 }, 'desk-12': { x: 360, y: 482 }
} %}
{% set time_params = selected_time.allDay ? {} : { from: selected_time.start, to: selected_time.end } %}
<svg viewBox="0 0 520 594" class="w-full h-auto" role="group" aria-label="Raumplan Büro">
{% for spot_group in spot_groups %}
{% if spot_group.group and rooms[spot_group.group.svgElementId] is defined %}
{{ plan.room(spot_group.group.label, rooms[spot_group.group.svgElementId], spot_group.freeCount) }}
{% endif %}
{% for spot in spot_group.spots %}
{% if spot.resource.svgElementId and geometry[spot.resource.svgElementId] is defined %}
{{ plan.spot(spot, geometry[spot.resource.svgElementId], 140, 86,
selected_date, is_past, time_params) }}
{% endif %}
{% endfor %}
{% endfor %}
</svg>