feat: add the house manager questionnaire per travel and compact the questionnaire layout

This commit is contained in:
fromme committed 2026-11-11 11:16:37 +01:00
1 parent d760ed3cdf
commit bfef08b519
50 files changed
+2763 -180

No files matched your search

+30 -1
View File
@@ -1,9 +1,11 @@
{#
# Questionnaire answers, read-only. Expects `definition` (the version they were given under) and
# `answers`, keyed by question key. Questions that are hidden or were left open are skipped; an
# `answers`, keyed by question key; optionally the response's `context`, whose `teamers` name the
# placements the house manager's teamer questions are keyed by. Questions that are hidden or were left open are skipped; an
# answer the definition does not know (an option key since renamed) is shown as stored rather
# than dropped.
#}
{% set context = context|default({}) %}
<div class="flex flex-col gap-y-8">
{% for section in definition.sections %}
{% set shown = section.questions|filter(question => answers[question.key] is defined and definition.isVisible(question, answers)) %}
@@ -37,6 +39,33 @@
{{ answer|map(key => (question.option(key).label ?? key))|join(', ') }}
{% elseif question.type.value == 'date' %}
{{ answer|date('d.m.Y') }}
{% elseif question.type.value in ['teamer_guidings', 'teamer_courses'] %}
{# one row per teamer and type; a draft's teamer without a type has nothing to show #}
<ul>
{% for row in answer|filter(row => row.type is defined) %}
<li>
<span class="font-bold">{{ context.teamers[row.disposition].name ?? row.disposition }}</span>
{{ question.option(row.type).label ?? row.type }}:
{% if question.type.value == 'teamer_guidings' %}
{{ row.count ?? '-' }} × mit je {{ row.participants ?? '-' }} Teilnehmenden
{% else %}
{{ row.days ?? '-' }} × {{ (row.hours_per_day ?? '-')|replace({'.': ','}) }} Stunden
{%- if row.dates ?? [] is not empty %},
{{ row.dates|map(date => date|format_datetime(pattern='EEEEEE dd.MM.', locale='de'))|join(', ') }}
{%- endif %}
{% endif %}
</li>
{% endfor %}
</ul>
{% elseif question.type.value == 'programme' %}
<ul>
{% for row in answer.items ?? [] %}
<li>{{ question.option(row.item).label ?? row.item }}: {{ row.participants ?? '-' }} Teilnehmende</li>
{% endfor %}
{% if answer.other is defined %}
<li>Sonstiges: {{ answer.other|nl2br }}</li>
{% endif %}
</ul>
{% else %}
{{ answer|nl2br }}
{% endif %}