Files
myep-team/templates/administrative/assignment_mailing/modal_confirm.html.twig
T

57 lines
2.8 KiB
Twig

{% extends 'htmx_confirmation_modal.html.twig' %}
{% set sendable = valid and attachmentError is null and recipients.eligibleCount > 0 %}
{% block title %}Mail wirklich senden?{% endblock %}
{% block content %}
{% if not valid %}
<div class="pb-4">
Betreff und Nachricht müssen ausgefüllt sein, bevor die Mail gesendet werden kann.
</div>
{% elseif attachmentError is not null %}
<div class="pb-4">
{{ attachmentError }}
</div>
{% elseif recipients.eligibleCount == 0 %}
<div class="pb-4">
Auf den ausgewählten Einsätzen ist niemand bestätigt eingeteilt, dem geschrieben werden kann.
</div>
{% else %}
<div class="pb-4">
Die Mail geht an <strong>{{ recipients.eligibleCount }}</strong> Teamer:innen auf
{{ mailingDto.assignments|length }} {{ mailingDto.assignments|length == 1 ? 'Einsatz' : 'Einsätzen' }}.
Das lässt sich nicht zurücknehmen.
</div>
<div class="p-4 bg-gray-50 border border-gray-200 rounded-md">
<div class="font-bold pb-2">{{ mailingDto.subject }}</div>
<div class="text-sm">{{ mailingDto.message | u.truncate(400, '…', false) | nl2br }}</div>
</div>
{% set attachmentNames = (mailingDto.template ? mailingDto.template.attachments|map(a => a.displayName ?? a.originalFilename) : [])|merge(pending|map(u => u.originalFilename)) %}
{% if attachmentNames is not empty %}
<div class="pt-4 text-sm">
<span class="font-bold">Anhänge ({{ attachmentSize|file_size(1) }}):</span>
{{ attachmentNames|join(', ') }}
</div>
{% endif %}
{% if recipients.hasSkipped %}
<div class="pt-4 text-sm text-gray-500">
{{ include('admin/teamer/_mailing_skipped.html.twig', { 'recipients': recipients }) }}
</div>
{% endif %}
<div id="mailing-confirm-fields" class="hidden">
<input type="hidden" name="{{ field_name(form.subject) }}" value="{{ field_value(form.subject) }}">
{# a textarea keeps the line breaks of the message intact #}
<textarea name="{{ field_name(form.message) }}">{{ field_value(form.message) }}</textarea>
{% if form._token is defined %}
{{ form_widget(form._token) }}
{% endif %}
</div>
{% endif %}
{% endblock %}
{# without a sendable mail there is nothing to confirm, the button only leads back to the draft #}
{% block button_confirm %}{{ sendable ? 'Jetzt senden' : 'Zurück zum Entwurf' }}{% endblock %}
{% block button_attribute %}{% if sendable %}hx-post="{{ path('app_administrative_assignment_mailing_send') }}" hx-include="#mailing-confirm-fields"{% else %}{{ stimulus_action('modal', 'close') }}{% endif %}{% endblock %}