{% extends "@FerienpassAdmin/layout/modalBase.html.twig" %}

{% trans_default_domain 'admin' %}
{% set translationPrefix = app.request.get('_route')|split('_')[1] %}

{% block main %}



    {% embed '@FerienpassAdmin/fragment/deleteModal.html.twig' with {
        metadata: {
            name: '{{ item.name }}',
            hosts: '{{ item.hosts|map(h => h.name)|join(", ") }}',
            date: '
{% if item.dates is not empty %}
    {% set startDate = item.dates|first.begin %}
    {% if startDate %}
        <time datetime="{{ startDate|date(\'c\') }}">{{ startDate|format_datetime(pattern="E, dd.MM.yyyy HH:mm") }}</time>
    {% else %}
        <span class="inline-flex items-center text-orange-600">
            {{ ux_icon(\'ph:warning\', {class: \'mr-1 size-4\'}) }}
            <span>Termin fehlt</span>
        </span>
    {% endif %}
{% else %}
    <span>Dauerangebot</span>
{% endif %}
',
            attendances: '
                <p class="flex items-center space-x-1" title="aktuelle Anmeldungen">
                    <span class="{{ (item.maxParticipants and item.attendancesConfirmed|length >= item.maxParticipants) ? \'text-red-700\' : \'text-green-700\' }}">
                        <svg viewBox="0 0 2 2" class="h-2 w-2 fill-current">
                            <circle cx="1" cy="1" r="1"/>
                        </svg>
                    </span>

                    <span>
                        {{ item.attendancesNotHidden|length ~ \' / \' ~ (item.maxParticipants ?: \'∞\') ~ \'\' }}
                    </span>
                </p>
',
        }
    } %}

        {% block content %}
            {% if item.attendances|length %}
                <div class="mt-2 flex">
                    <div class="flex-shrink-0">
                        <twig:ux:icon name="ph:warning" class="h-5 w-5 text-yellow-700 dark:text-yellow-500" aria-hidden="true" />
                    </div>
                    <div class="ml-2">
                        <p class="text-sm text-yellow-700 dark:text-yellow-500">
                            <span class="font-semibold">Anmeldungen werden mitgelöscht!</span>
                        </p>
                    </div>
                </div>
            {% endif %}
        {% endblock %}

{% endembed %}


{% endblock %}

{#   {% if not offer.isVariantBase %}
        <div class="mb-12">
            <twig:Admin:Alert type="info">
                <span>
                    Sie bearbeiten eine Variante von <a class="underline hover:no-underline"
                                                        href="{{ path(app.request.get('_route'), {'id':offer.variantBase.id, edition: offer.variantBase.edition.alias}) }}">
                        Angebot ID {{ offer.variantBase.id }}</a> und können deswegen nicht alle Felder
                    bearbeiten.
                </span>
            </twig:Admin:Alert>
        </div>
    {% endif %}
#}
{#

    {% for error in form.errors(true)|default %}
        <div class="space-y-4">
            <twig:Admin:Alert type="error">
                {{ error.message }}
            </twig:Admin:Alert>
        </div>
    {% endfor %}

#}

           {# {% if offer.image is not empty %}
                <div class="col-span-6">
                    <h4 class="text-gray-500 uppercase tracking-wide text-sm">Aktuelles Bild</h4>
                    <div class="mt-1 mb-4 bg-gray-100 border-2 border-dashed px-6 py-4">
                        {{ contao_figure(offer.image, '_host_details_logo') }}
                    </div>
                </div>
            {% endif %}

            <div class="col-span-3">
                {{ form_widget(form.image) }}
            </div>
            <div class="col-span-4">
                {{ form_row(form.imgCopyright) }}
            </div>
            </div>
#}

