feat: let the office test the questionnaire on any assignment

This commit is contained in:
fromme committed 2026-10-27 17:07:17 +01:00
1 parent a35f91ac63
commit 9fedc5b5d3
13 files changed
+337 -29

No files matched your search

@@ -256,8 +256,15 @@
</table>
</div>
</div>
<a href="{{ returnUrl }}" class="btn">
zurück
</a>
<div class="flex flex-wrap items-center gap-4">
<a href="{{ returnUrl }}" class="btn">
zurück
</a>
<a href="{{ path('app_administrative_questionnaire_test', { 'uuid': assignment.uuid, 'r': return_url() }) }}"
class="btn btn--secondary"
title="Den Fragebogen nach einer Busbegleitung für diesen Einsatz ausprobieren, ohne etwas zu speichern">
Fragebogen testen
</a>
</div>
</div>
{% endblock %}
@@ -12,7 +12,7 @@
</p>
<div class="grid lg:grid-cols-3 gap-8 items-start">
<div class="lg:col-span-2">
{% include 'questionnaire/_answers.html.twig' %}
{% include 'questionnaire/_answers.html.twig' with { 'answers': response.answers } %}
</div>
<div>
{# the snapshot taken on submit, so it shows the placement as the teamer answered for it #}
@@ -0,0 +1,59 @@
{% extends 'administrative/layout.html.twig' %}
{% block title %}{{ definition.title }} (Testmodus){% endblock %}
{% block content %}
<h1 class="text-2xl font-bold pb-4">
{{ definition.title }}
</h1>
{% include '_partials/_alert.html.twig' with {
'type': 'warning',
'message': 'Testmodus: Der Fragebogen verhält sich wie für Teamer:innen, es wird aber nichts gespeichert.'
} %}
{% if not assignment.hasBusEscort %}
{% include '_partials/_alert.html.twig' with {
'type': 'info',
'message': 'Dieser Einsatz hat keine Busbegleitung. Teamer:innen bekommen den Fragebogen hier nicht.'
} %}
{% endif %}
<div class="grid lg:grid-cols-3 gap-8 items-start">
<div class="lg:col-span-2">
{% if submitted is not null %}
{% include '_partials/_alert.html.twig' with {
'type': 'success',
'message': 'So würde der abgeschickte Fragebogen gespeichert. Ausgeblendete Fragen fallen dabei weg.'
} %}
{% include 'questionnaire/_answers.html.twig' with { 'answers': submitted } %}
<div class="pt-8">
<a href="{{ path('app_administrative_questionnaire_test', { 'uuid': assignment.uuid, 'r': app.request.query.get('r') }) }}" class="btn btn--secondary">
Erneut testen
</a>
</div>
{% else %}
{% if definition.description %}
<p class="pb-8 text-gray-700">
{{ definition.description|nl2br }}
</p>
{% endif %}
{% if draft %}
{% include '_partials/_alert.html.twig' with {
'type': 'success',
'message': 'Der Entwurf wäre jetzt gespeichert. Im Testmodus bleiben die Angaben nur im Formular.'
} %}
{% endif %}
{% include 'questionnaire/_form.html.twig' %}
{% endif %}
</div>
<div>
<h2 class="text-lg font-bold pb-4">
Einsatz
</h2>
{% include '_partials/_assignment_info.html.twig' %}
<div class="pt-8">
<a href="{{ returnUrl }}" class="underline">
zurück
</a>
</div>
</div>
</div>
{% endblock %}
+3 -4
View File
@@ -1,10 +1,9 @@
{#
# 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
# 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
# answer the definition does not know (an option key since renamed) is shown as stored rather
# than dropped.
#}
{% set answers = response.answers %}
<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)) %}
+17
View File
@@ -0,0 +1,17 @@
{#
# A questionnaire form (App\Form\QuestionnaireType) with its two buttons. Shared by the teamer's
# page and the office's test mode, so a test shows exactly what a teamer gets.
#}
{{ form_start(form, { attr: { 'data-controller': 'questionnaire', 'data-action': 'change->questionnaire#update' } }) }}
{% for child in form|filter(child => child.vars.name not in ['draft', 'submit']) %}
{{ form_row(child) }}
{% endfor %}
<div class="flex flex-wrap items-center gap-4 pt-4">
{{ form_widget(form.submit, { attr: { class: 'btn' } }) }}
{{ form_widget(form.draft, { attr: { class: 'btn btn--secondary' } }) }}
</div>
<p class="pt-2 text-sm text-gray-500">
Als Entwurf kannst du den Fragebogen jederzeit speichern und später weiter ausfüllen.
Abgeschickt ist er endgültig.
</p>
{{ form_end(form) }}
@@ -11,7 +11,7 @@
</p>
<div class="grid lg:grid-cols-3 gap-8 items-start">
<div class="lg:col-span-2">
{% include 'questionnaire/_answers.html.twig' %}
{% include 'questionnaire/_answers.html.twig' with { 'answers': response.answers } %}
</div>
<div>
<h2 class="text-lg font-bold pb-4">
+1 -13
View File
@@ -13,19 +13,7 @@
{% endif %}
<div class="grid lg:grid-cols-3 gap-8 items-start">
<div class="lg:col-span-2">
{{ form_start(form, { attr: { 'data-controller': 'questionnaire', 'data-action': 'change->questionnaire#update' } }) }}
{% for child in form|filter(child => child.vars.name not in ['draft', 'submit']) %}
{{ form_row(child) }}
{% endfor %}
<div class="flex flex-wrap items-center gap-4 pt-4">
{{ form_widget(form.submit, { attr: { class: 'btn' } }) }}
{{ form_widget(form.draft, { attr: { class: 'btn btn--secondary' } }) }}
</div>
<p class="pt-2 text-sm text-gray-500">
Als Entwurf kannst du den Fragebogen jederzeit speichern und später weiter ausfüllen.
Abgeschickt ist er endgültig.
</p>
{{ form_end(form) }}
{% include 'questionnaire/_form.html.twig' %}
</div>
<div>
<h2 class="text-lg font-bold pb-4">