{% extends "@FerienpassAdmin/layout/base.html.twig" %}
{% trans_default_domain 'admin' %}


{% block main %}

    <div class="relative">

        <div id="lock">
            {% if locked %}
                {{ block('lock') }}
            {% endif %}
        </div>

        <div>
            <twig:Admin:Edition:Header edition="{{ edition }}"/>

            <div class="mb-6 flex items-center justify-start space-x-3">
                <twig:Admin:Button href="{{ path('admin_editions_lotting', {alias: edition.alias}) }}" size="sm" data-turbo-frame="modal">
                    <twig:ux:icon name="ph:arrows-clockwise" class="-ml-0.5 mr-1 size-5 text-gray-500" />
                    {{ 'offers.autoAssignment'|trans({}, 'admin') }}
                </twig:Admin:Button>
                <twig:Admin:Button href="{{ path('admin_attendances_create') }}" size="sm" data-turbo-frame="slideover">
                    <twig:ux:icon name="ph:plus" class="-ml-0.5 mr-1 size-5 text-gray-500" />
                    {{ 'attendances.new'|trans({}, 'admin') }}
                </twig:Admin:Button>
            </div>

            <twig:Admin:OffersAssign edition="{{ edition }}"/>

        </div>
    </div>

{% endblock %}

{% block lock %}
    <div class="z-20 absolute inset-0 w-full h-full bg-gray-50/85 flex justify-center">
        <div class="flex flex-col space-y-4 items-center justify-center max-w-md">
            <twig:ux:icon name="ph:lock" class="text-gray-500 h-12 w-12" />

            <p class="text-gray-700 text-xl text-center">{{ 'offers.locked'|trans({}, 'admin') }}</p>
        </div>
    </div>
{% endblock %}

{% block auto_success_stream %}
    <twig:Turbo:Stream:Update target="#lock">
        {{ block('lock') }}
    </twig:Turbo:Stream:Update>
    <twig:Turbo:Stream:Prepend target="#notifications">
        <twig:Admin:Notification type="success" title="{{ 'offers.lotting_started'|trans({}, 'admin') }}"
                                 message="{{ 'offers.lotting_description'|trans({}, 'admin') }}"/>
    </twig:Turbo:Stream:Prepend>
{% endblock %}
