feat: add mailing templates and mail the confirmed teamers of selected assignments

This commit is contained in:
fromme committed 2026-11-11 14:02:55 +01:00
1 parent 6c89f1b8a9
commit e285646bb2
57 files changed
+3525 -31

No files matched your search

@@ -0,0 +1,67 @@
{# Swapped as a whole whenever an assignment is added or removed, so the recipient count is
always the one for the list shown with it. #}
<div id="mailing-assignments" class="pb-6">
<div class="text-xl font-bold">
{{ recipients.eligibleCount }} Empfänger:innen
</div>
<div class="text-sm text-gray-500">
Teamer:innen mit bestätigter Einteilung, auch auf mehreren Einsätzen nur eine Mail.
Einsätze ohne bestätigte Teamer:innen werden weggelassen.
{% if recipients.hasSkipped %}
{{ include('admin/teamer/_mailing_skipped.html.twig', { 'recipients': recipients }) }}
{% endif %}
</div>
{% if recipients.eligibleCount > 0 %}
<div class="pt-2 text-sm">
{{ recipients.eligible|map(recipient => recipient.fullName)|join(', ') }}
</div>
{% endif %}
<ul class="flex flex-col space-y-1 py-4">
{% for assignment in mailingDto.assignments %}
<li class="flex items-center space-x-2 border rounded-sm px-2 py-1">
{{ icon('flag-' ~ assignment.destination.country, 'w-5 h-5 shrink-0') }}
<div class="flex-1">
<span class="whitespace-nowrap">
{{ assignment.destination.dateFrom|date('d.m.Y') }} - {{ assignment.destination.dateTo|date('d.m.Y') }}
</span>
{{ assignment.destination.hotel }}, {{ assignment.jobProfile.name }}
{# who is confirmed here, so a teamer on two of the assignments - counted once
above - is plain to see. Never empty: assignments nobody is confirmed on are
left out of the mailing, see AssignmentRepository::findForMailing(). #}
<div class="text-sm text-gray-500">
bestätigt: {{ assignment.dispositions
|filter(disposition => disposition.status == constant('App\\Entity\\Disposition::STATUS_CONFIRMED'))
|map(disposition => disposition.teamer.fullName)
|join(', ') }}
</div>
</div>
<button type="button"
class="text-red-500"
title="Einsatz entfernen"
hx-post="{{ path('app_administrative_assignment_mailing_remove', { 'uuid': assignment.uuid }) }}"
hx-target="#mailing-assignments"
hx-swap="outerHTML">
{{ icon('delete', 'w-5 h-5') }}
</button>
</li>
{% else %}
<li class="text-gray-500">
Noch kein Einsatz ausgewählt.
</li>
{% endfor %}
</ul>
{# Its own form, outside the mailing form: forms cannot nest, and typing here must not park
the search as a draft. The autocomplete dispatches a "select" event of its own; the
[detail] filter keeps out the native one a text selection in the input fires. #}
{{ form_start(addForm, { 'action': path('app_administrative_assignment_mailing_add') }) }}
{{ form_row(addForm.assignment, { 'attr': {
'hx-post': path('app_administrative_assignment_mailing_add'),
'hx-trigger': 'select[detail]',
'hx-target': '#mailing-assignments',
'hx-swap': 'outerHTML',
} }) }}
{{ form_rest(addForm) }}
{{ form_end(addForm) }}
</div>