style: show the received form submission in cards with a processing aside

This commit is contained in:
fromme committed 2026-11-12 15:27:12 +01:00
1 parent ebad54e989
commit 99e6119311
1 file changed
+113 -88
@@ -1,64 +1,97 @@
{% extends 'admin/layout.html.twig' %}
{% set name = [submission.firstName, submission.lastName]|filter(part => part is not empty)|join(' ') %}
{% block title %}Eingegangenes Formular{% endblock %}
{% macro row(label, value) %}
<div class="py-6 first:pt-0 last:pb-0 sm:grid sm:grid-cols-4 sm:gap-4">
<dt class="text-sm font-bold leading-6 text-gray-900">
{{ label }}
</dt>
<dd class="mt-1 text-sm leading-6 text-gray-700 sm:col-span-3 sm:mt-0">
{% if value is same as(true) %}
ja
{% elseif value is same as(false) %}
nein
{% elseif value is empty %}
-
{% else %}
{{ value|nl2br }}
{% endif %}
</dd>
</div>
{% macro value(value) %}
{% if value is same as(true) %}
ja
{% elseif value is same as(false) %}
nein
{% elseif value is empty %}
-
{% else %}
{{ value|nl2br }}
{% endif %}
{% endmacro %}
{# label and value side by side, as on the teamer profile; `narrow` for the aside #}
{% macro fields(fields, narrow = false) %}
<dl class="{{ html_classes('grid gap-x-4 gap-y-2', { 'grid-cols-[minmax(0,10rem)_minmax(0,1fr)]': not narrow, 'grid-cols-[minmax(0,7rem)_minmax(0,1fr)]': narrow }) }}">
{% for label, value in fields %}
<dt class="text-muted">{{ label }}</dt>
<dd class="break-words">{{ _self.value(value) }}</dd>
{% endfor %}
</dl>
{% endmacro %}
{% block content %}
{{ include('_partials/_back_link.html.twig', { 'url': returnUrl }) }}
<h1 class="text-2xl font-bold pb-8">
{{ submission.formLabel }}
{% if submission.lastName or submission.firstName %}
- {{ [submission.firstName, submission.lastName]|filter(part => part is not empty)|join(' ') }}
{% endif %}
<h1 class="text-2xl font-bold pb-1">
{{ submission.formLabel }}{% if name %} - {{ name }}{% endif %}
</h1>
<p class="pb-6 text-muted">
eingegangen am {{ submission.submittedAt|date('d.m.Y, H:i') }} Uhr
</p>
<div class="grid lg:grid-cols-2 gap-x-8 gap-y-4 pb-8">
<dl class="divide-y divide-gray-100">
{{ _self.row('eingegangen am', submission.submittedAt|date('d.m.Y, H:i')) }}
{{ _self.row('Name', [submission.firstName, submission.lastName]|filter(part => part is not empty)|join(' ')) }}
{{ _self.row('Geburtsdatum', submission.dateOfBirth ? submission.dateOfBirth|date('d.m.Y') : submission.birthDate) }}
{{ _self.row('Geschlecht', submission.gender) }}
{# Three states: the form said yes, said no, or never asked - and only the first one
earns the automatic receipt mail, so "-" is not the same as "nein" here. #}
{{ _self.row('EU (inkl. Schweiz)', submission.eu) }}
{{ _self.row('E-Mail', submission.email) }}
{{ _self.row('Telefon', submission.phone) }}
{{ _self.row('Mobil', submission.mobile) }}
{{ _self.row('Adresse', [submission.street, [submission.zipCode, submission.city]|filter(part => part is not empty)|join(' ')]|filter(part => part is not empty)|join(', ')) }}
</dl>
<dl class="divide-y divide-gray-100">
{{ _self.row('Formularkennung', submission.form) }}
{{ _self.row('Quelle', submission.pageUrl) }}
</dl>
</div>
<div class="grid lg:grid-cols-3 gap-6 items-start">
<div class="lg:col-span-2 flex flex-col gap-y-6">
<section class="card p-5">
<h2 class="section-title pb-4">
Stammdaten
</h2>
{{ _self.fields({
'Name': name,
'Geburtsdatum': submission.dateOfBirth ? submission.dateOfBirth|date('d.m.Y') : submission.birthDate,
'Geschlecht': submission.gender,
'EU (inkl. Schweiz)': submission.eu,
'E-Mail': submission.email,
'Telefon': submission.phone,
'Mobil': submission.mobile,
'Adresse': [submission.street, [submission.zipCode, submission.city]|filter(part => part is not empty)|join(' ')]|filter(part => part is not empty)|join(', '),
}) }}
{# EU has three states: the form said yes, said no, or never asked - and only the
first one earns the automatic receipt mail, so "-" is not the same as "nein". #}
</section>
<h2 class="font-bold text-lg pb-4">
Bearbeitung
</h2>
<div class="grid lg:grid-cols-2 gap-x-8 gap-y-8 pb-8">
<div>
<dl class="divide-y divide-gray-100">
{{ _self.row('1. Mail versendet', submission.firstMailSentAt ? submission.firstMailSentAt|date('d.m.Y, H:i') : null) }}
{{ _self.row('2. Mail versendet', submission.secondMailSentAt ? submission.secondMailSentAt|date('d.m.Y, H:i') : null) }}
</dl>
<section class="card p-5">
<h2 class="section-title pb-2">
Angaben aus dem Formular
</h2>
{% if submission.details is empty %}
<p class="text-muted">Das Formular hat über die Stammdaten hinaus nichts erfasst.</p>
{% else %}
<dl class="divide-y divide-line">
{% for label, answer in submission.details %}
<div class="py-3 first:pt-1 last:pb-0 sm:grid sm:grid-cols-2 sm:gap-4">
<dt class="text-muted">{{ label }}</dt>
<dd class="mt-1 sm:mt-0 break-words">{{ _self.value(answer is iterable ? answer|join(', ') : answer) }}</dd>
</div>
{% endfor %}
</dl>
{% endif %}
</section>
<section class="card p-5">
<h2 class="section-title pb-4">
Formular
</h2>
{{ _self.fields({
'Formularkennung': submission.form,
'Quelle': submission.pageUrl,
}) }}
</section>
</div>
<aside class="card p-5">
<h2 class="section-title pb-3">
Mails
</h2>
{{ _self.fields({
'1. Mail': submission.firstMailSentAt ? submission.firstMailSentAt|date('d.m.Y, H:i') : null,
'2. Mail': submission.secondMailSentAt ? submission.secondMailSentAt|date('d.m.Y, H:i') : null,
}, true) }}
{% if submission.email %}
<div class="flex flex-wrap items-center gap-2 pt-4">
<button type="button"
@@ -81,72 +114,64 @@
</button>
</div>
{% else %}
<div class="pt-4 text-sm">
<p class="pt-4 text-muted">
Dieses Formular enthält keine E-Mail-Adresse - es kann keine Mail versendet werden.
</div>
</p>
{% endif %}
</div>
<div>
<h2 class="section-title mt-5 border-t border-line pt-4 pb-3">
Calls
</h2>
{{ form_start(callsForm) }}
<div class="flex flex-col space-y-2 pb-4">
<div class="flex flex-col gap-y-2 pb-4">
{{ form_row(callsForm.firstCallHeld) }}
{% if submission.firstCallHeldAt %}
<div class="text-sm">geführt am {{ submission.firstCallHeldAt|date('d.m.Y') }}</div>
<div class="-mt-1 pl-7 text-sm text-muted">geführt am {{ submission.firstCallHeldAt|date('d.m.Y') }}</div>
{% endif %}
{{ form_row(callsForm.secondCallHeld) }}
{% if submission.secondCallHeldAt %}
<div class="text-sm">geführt am {{ submission.secondCallHeldAt|date('d.m.Y') }}</div>
<div class="-mt-1 pl-7 text-sm text-muted">geführt am {{ submission.secondCallHeldAt|date('d.m.Y') }}</div>
{% endif %}
</div>
{{ form_widget(callsForm.save, { 'attr': { 'class': 'btn-tool' } }) }}
{{ form_rest(callsForm) }}
{{ form_end(callsForm) }}
</div>
<div>
<dl class="divide-y divide-gray-100">
{{ _self.row('übernommen am', submission.teamerCreatedAt ? submission.teamerCreatedAt|date('d.m.Y, H:i') : null) }}
</dl>
<h2 class="section-title mt-5 border-t border-line pt-4 pb-3">
Teamer:in
</h2>
{{ _self.fields({
'übernommen am': submission.teamerCreatedAt ? submission.teamerCreatedAt|date('d.m.Y, H:i') : null,
}, true) }}
<div class="pt-4">
{% if submission.user and submission.user.teamer %}
<a href="{{ path('app_administrative_teamer_profile', { 'uuid': submission.user.teamer.uuid, 'r': forwarded_return_url() }) }}"
class="btn-tool">
class="btn-secondary">
Teamer:innenprofil öffnen
</a>
{% elseif submission.email %}
{% if submission.busProAddressId %}
{# Step 1 is done and the rest is not: naming it here is what makes a
retry a resume rather than a guess. #}
{% include '_partials/_alert.html.twig' with {
type: 'warning',
message: 'Die BusPro-Adresse ' ~ submission.busProAddressId ~ ' wurde schon angelegt, die Übernahme wurde aber nicht abgeschlossen.',
} %}
{% endif %}
{# turning the application into a teamer is what this page is for #}
<button type="button"
class="btn-tool"
class="btn-primary"
hx-get="{{ path('app_admin_application_form_submission_create_teamer', { 'uuid': submission.uuid, 'r': forwarded_return_url() }) }}"
hx-target="body"
hx-swap="beforeend">
Teamer:in anlegen
</button>
{% if submission.busProAddressId %}
{# Step 1 is done and the rest is not: naming it here is what makes a
retry a resume rather than a guess. #}
<div class="pt-2 text-sm">
Die BusPro-Adresse {{ submission.busProAddressId }} wurde schon angelegt,
die Übernahme wurde aber nicht abgeschlossen.
</div>
{% endif %}
{% else %}
<div class="text-sm">
<p class="text-muted">
Ohne E-Mail-Adresse kann kein Teamer:innenkonto angelegt werden.
</div>
</p>
{% endif %}
</div>
</div>
</aside>
</div>
<h2 class="font-bold text-lg pb-4">
Angaben aus dem Formular
</h2>
{% if submission.details is empty %}
<p>Das Formular hat über die Stammdaten hinaus nichts erfasst.</p>
{% else %}
<dl class="divide-y divide-gray-100">
{% for label, answer in submission.details %}
{{ _self.row(label, answer is iterable ? answer|join(', ') : answer) }}
{% endfor %}
</dl>
{% endif %}
{% endblock %}