{# # Questionnaire answers, read-only. Expects `definition` (the version they were given under) and # `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({}) %}
{% for section in definition.sections %} {% set shown = section.questions|filter(question => answers[question.key] is defined and definition.isVisible(question, answers)) %} {% if shown is not empty %}
{% if section.title %}

{{ section.title }}

{% endif %}
{% for question in shown %} {% set answer = answers[question.key] %}
{{ question.label|nl2br }}
{% if question.type.value == 'rating' %} {% for grade in range(1, 5) %} {{ icon('star', html_classes('w-4 h-4', { 'text-gray-200': answer < grade, 'text-primary': answer >= grade })) }} {% endfor %} {{ answer }} von 5 {% elseif question.type.value == 'choice' %} {{ (question.option(answer).label ?? answer) }} {% elseif question.type.value == 'multi' %} {{ 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 #}
    {% for row in answer|filter(row => row.type is defined) %}
  • {{ context.teamers[row.disposition].name ?? row.disposition }} {{ 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 %}
  • {% endfor %}
{% elseif question.type.value == 'programme' %}
    {% for row in answer.items ?? [] %}
  • {{ question.option(row.item).label ?? row.item }}: {{ row.participants ?? '-' }} Teilnehmende
  • {% endfor %} {% if answer.other is defined %}
  • Sonstiges: {{ answer.other|nl2br }}
  • {% endif %}
{% else %} {{ answer|nl2br }} {% endif %}
{% endfor %}
{% endif %} {% endfor %}