Files
myep-team/templates/admin/teamer/modal_mailing_confirm.html.twig
T
2026-08-11 16:25:53 +02:00

45 lines
2.1 KiB
Twig

{% extends 'htmx_confirmation_modal.html.twig' %}
{% set sendable = valid 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 recipients.eligibleCount == 0 %}
<div class="pb-4">
Der aktuelle Filter trifft auf niemanden zu, dem geschrieben werden kann.
</div>
{% else %}
<div class="pb-4">
Die Mail geht an <strong>{{ recipients.eligibleCount }}</strong> Teamer:innen. 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>
{% 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 complete 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_admin_teamer_mailing_send') }}" hx-include="#mailing-confirm-fields"{% else %}{{ stimulus_action('modal', 'close') }}{% endif %}{% endblock %}