style: show the received form submission in cards with a processing aside
This commit is contained in:
1 parent
ebad54e989
commit
99e6119311
1 file changed
+101
-76
@@ -1,13 +1,10 @@
|
|||||||
{% extends 'admin/layout.html.twig' %}
|
{% extends 'admin/layout.html.twig' %}
|
||||||
|
|
||||||
|
{% set name = [submission.firstName, submission.lastName]|filter(part => part is not empty)|join(' ') %}
|
||||||
|
|
||||||
{% block title %}Eingegangenes Formular{% endblock %}
|
{% block title %}Eingegangenes Formular{% endblock %}
|
||||||
|
|
||||||
{% macro row(label, value) %}
|
{% macro value(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) %}
|
{% if value is same as(true) %}
|
||||||
ja
|
ja
|
||||||
{% elseif value is same as(false) %}
|
{% elseif value is same as(false) %}
|
||||||
@@ -17,48 +14,84 @@
|
|||||||
{% else %}
|
{% else %}
|
||||||
{{ value|nl2br }}
|
{{ value|nl2br }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</dd>
|
{% endmacro %}
|
||||||
</div>
|
|
||||||
|
{# 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 %}
|
{% endmacro %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
{{ include('_partials/_back_link.html.twig', { 'url': returnUrl }) }}
|
{{ include('_partials/_back_link.html.twig', { 'url': returnUrl }) }}
|
||||||
<h1 class="text-2xl font-bold pb-8">
|
<h1 class="text-2xl font-bold pb-1">
|
||||||
{{ submission.formLabel }}
|
{{ submission.formLabel }}{% if name %} - {{ name }}{% endif %}
|
||||||
{% if submission.lastName or submission.firstName %}
|
|
||||||
- {{ [submission.firstName, submission.lastName]|filter(part => part is not empty)|join(' ') }}
|
|
||||||
{% endif %}
|
|
||||||
</h1>
|
</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">
|
<div class="grid lg:grid-cols-3 gap-6 items-start">
|
||||||
<dl class="divide-y divide-gray-100">
|
<div class="lg:col-span-2 flex flex-col gap-y-6">
|
||||||
{{ _self.row('eingegangen am', submission.submittedAt|date('d.m.Y, H:i')) }}
|
<section class="card p-5">
|
||||||
{{ _self.row('Name', [submission.firstName, submission.lastName]|filter(part => part is not empty)|join(' ')) }}
|
<h2 class="section-title pb-4">
|
||||||
{{ _self.row('Geburtsdatum', submission.dateOfBirth ? submission.dateOfBirth|date('d.m.Y') : submission.birthDate) }}
|
Stammdaten
|
||||||
{{ _self.row('Geschlecht', submission.gender) }}
|
</h2>
|
||||||
{# Three states: the form said yes, said no, or never asked - and only the first one
|
{{ _self.fields({
|
||||||
earns the automatic receipt mail, so "-" is not the same as "nein" here. #}
|
'Name': name,
|
||||||
{{ _self.row('EU (inkl. Schweiz)', submission.eu) }}
|
'Geburtsdatum': submission.dateOfBirth ? submission.dateOfBirth|date('d.m.Y') : submission.birthDate,
|
||||||
{{ _self.row('E-Mail', submission.email) }}
|
'Geschlecht': submission.gender,
|
||||||
{{ _self.row('Telefon', submission.phone) }}
|
'EU (inkl. Schweiz)': submission.eu,
|
||||||
{{ _self.row('Mobil', submission.mobile) }}
|
'E-Mail': submission.email,
|
||||||
{{ _self.row('Adresse', [submission.street, [submission.zipCode, submission.city]|filter(part => part is not empty)|join(' ')]|filter(part => part is not empty)|join(', ')) }}
|
'Telefon': submission.phone,
|
||||||
</dl>
|
'Mobil': submission.mobile,
|
||||||
<dl class="divide-y divide-gray-100">
|
'Adresse': [submission.street, [submission.zipCode, submission.city]|filter(part => part is not empty)|join(' ')]|filter(part => part is not empty)|join(', '),
|
||||||
{{ _self.row('Formularkennung', submission.form) }}
|
}) }}
|
||||||
{{ _self.row('Quelle', submission.pageUrl) }}
|
{# 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>
|
||||||
|
|
||||||
|
<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>
|
</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>
|
</div>
|
||||||
|
|
||||||
<h2 class="font-bold text-lg pb-4">
|
<aside class="card p-5">
|
||||||
Bearbeitung
|
<h2 class="section-title pb-3">
|
||||||
|
Mails
|
||||||
</h2>
|
</h2>
|
||||||
<div class="grid lg:grid-cols-2 gap-x-8 gap-y-8 pb-8">
|
{{ _self.fields({
|
||||||
<div>
|
'1. Mail': submission.firstMailSentAt ? submission.firstMailSentAt|date('d.m.Y, H:i') : null,
|
||||||
<dl class="divide-y divide-gray-100">
|
'2. Mail': submission.secondMailSentAt ? submission.secondMailSentAt|date('d.m.Y, H:i') : null,
|
||||||
{{ _self.row('1. Mail versendet', submission.firstMailSentAt ? submission.firstMailSentAt|date('d.m.Y, H:i') : null) }}
|
}, true) }}
|
||||||
{{ _self.row('2. Mail versendet', submission.secondMailSentAt ? submission.secondMailSentAt|date('d.m.Y, H:i') : null) }}
|
|
||||||
</dl>
|
|
||||||
{% if submission.email %}
|
{% if submission.email %}
|
||||||
<div class="flex flex-wrap items-center gap-2 pt-4">
|
<div class="flex flex-wrap items-center gap-2 pt-4">
|
||||||
<button type="button"
|
<button type="button"
|
||||||
@@ -81,72 +114,64 @@
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
{% else %}
|
{% 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.
|
Dieses Formular enthält keine E-Mail-Adresse - es kann keine Mail versendet werden.
|
||||||
</div>
|
</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
|
||||||
<div>
|
<h2 class="section-title mt-5 border-t border-line pt-4 pb-3">
|
||||||
|
Calls
|
||||||
|
</h2>
|
||||||
{{ form_start(callsForm) }}
|
{{ 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) }}
|
{{ form_row(callsForm.firstCallHeld) }}
|
||||||
{% if submission.firstCallHeldAt %}
|
{% 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 %}
|
{% endif %}
|
||||||
{{ form_row(callsForm.secondCallHeld) }}
|
{{ form_row(callsForm.secondCallHeld) }}
|
||||||
{% if submission.secondCallHeldAt %}
|
{% 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 %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
{{ form_widget(callsForm.save, { 'attr': { 'class': 'btn-tool' } }) }}
|
{{ form_widget(callsForm.save, { 'attr': { 'class': 'btn-tool' } }) }}
|
||||||
{{ form_rest(callsForm) }}
|
{{ form_rest(callsForm) }}
|
||||||
{{ form_end(callsForm) }}
|
{{ form_end(callsForm) }}
|
||||||
</div>
|
|
||||||
<div>
|
<h2 class="section-title mt-5 border-t border-line pt-4 pb-3">
|
||||||
<dl class="divide-y divide-gray-100">
|
Teamer:in
|
||||||
{{ _self.row('übernommen am', submission.teamerCreatedAt ? submission.teamerCreatedAt|date('d.m.Y, H:i') : null) }}
|
</h2>
|
||||||
</dl>
|
{{ _self.fields({
|
||||||
|
'übernommen am': submission.teamerCreatedAt ? submission.teamerCreatedAt|date('d.m.Y, H:i') : null,
|
||||||
|
}, true) }}
|
||||||
<div class="pt-4">
|
<div class="pt-4">
|
||||||
{% if submission.user and submission.user.teamer %}
|
{% if submission.user and submission.user.teamer %}
|
||||||
<a href="{{ path('app_administrative_teamer_profile', { 'uuid': submission.user.teamer.uuid, 'r': forwarded_return_url() }) }}"
|
<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
|
Teamer:innenprofil öffnen
|
||||||
</a>
|
</a>
|
||||||
{% elseif submission.email %}
|
{% 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"
|
<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-get="{{ path('app_admin_application_form_submission_create_teamer', { 'uuid': submission.uuid, 'r': forwarded_return_url() }) }}"
|
||||||
hx-target="body"
|
hx-target="body"
|
||||||
hx-swap="beforeend">
|
hx-swap="beforeend">
|
||||||
Teamer:in anlegen
|
Teamer:in anlegen
|
||||||
</button>
|
</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 %}
|
{% else %}
|
||||||
<div class="text-sm">
|
<p class="text-muted">
|
||||||
Ohne E-Mail-Adresse kann kein Teamer:innenkonto angelegt werden.
|
Ohne E-Mail-Adresse kann kein Teamer:innenkonto angelegt werden.
|
||||||
</div>
|
</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
</aside>
|
||||||
</div>
|
</div>
|
||||||
</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 %}
|
{% endblock %}
|
||||||
Reference in new issue
Block a user