{# # A submitted questionnaire response, read-only. Expects `definition` (the version the response # was submitted under) and `response`. 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 answers = response.answers %}
{% 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') }} {% else %} {{ answer|nl2br }} {% endif %}
{% endfor %}
{% endif %} {% endfor %}