{% extends app.request.headers.get('turbo-frame') == 'modal' ? '@FerienpassAdmin/layout/modalFrame.html.twig' : '@FerienpassAdmin/layout/base.html.twig' %}
{% trans_default_domain 'admin' %}

{% block main %}
    <div class="overflow-hidden">
        <h3 class="text-base font-semibold leading-6 text-gray-900 dark:text-white" id="modal-title">
            {{ notify ? 'E-Mail-Versand starten' : 'Zulosung festschreiben' }}
        </h3>
        <div class="mt-2">
            <p class="text-sm text-gray-500 dark:text-gray-400">Sind Sie sicher, dass Sie fortfahren wollen?</p>
        </div>
    </div>
    <div class="mt-4 sm:flex sm:gap-3">
        <form action="{{ path('admin_commit_attendances_confirm', { stash: stash.id, notify: notify ? 1 : 0 }) }}"
              method="POST">
            <twig:Admin:Button variant="destructive" type="submit" class="inline-flex w-full justify-center sm:w-auto">{{ notify ? 'E-Mails versenden' : 'Festschreiben' }}</twig:Admin:Button>
        </form>
        <twig:Admin:Button command="close" commandfor="admin-modal-dialog" class="mt-3 sm:mt-0 inline-flex w-full justify-center sm:w-auto">Abbrechen</twig:Admin:Button>
    </div>
{% endblock %}

{% block success_stream %}
    <twig:Turbo:Stream:Update target="#modal"/>
    <twig:Turbo:Stream:Replace target="#notify-container">
        <twig:Admin:Alert type="confirm"
                          class="shadow border border-green-700/30 dark:border-green-400/30"
                          message="Dieser Stapel wurde gerade abgearbeitet!"/>

    </twig:Turbo:Stream:Replace>
    {% if notify and uuid %}
        <twig:Turbo:Stream:Prepend target="#notifications">
            <twig:Admin:Notification type="mail_sent" title="Rundmail versendet" dismissAfter="0"
                                     primaryActionTitle="Versandnachweis öffnen"
                                     primaryActionLink="{{ path('admin_tools_dispatch', {uuid: uuid}) }}"/>
        </twig:Turbo:Stream:Prepend>
    {% endif %}
{% endblock %}
