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


{% block list %}

{% component 'Admin:SearchableQueryableList' with {
        qb: qb,
        filterType: filterType,
        routeName: app.current_route,
        routeParameters: app.current_route_parameters|merge(app.request.query.all),
        searchable: searchable|default([]),
        exports: exports|default([]),
        createUrl: null,
        viewKey: 'admin_hosts',
        viewPathPrefix: '/admin/veranstaltende',
        config: {
            title: '{{ item.name|default("") }}',
            info: [
                '{{ item.offers|length }} Angebote',
            ],
            columns: {
                name: '<a href="{{ path("admin_hosts_show", { uuid: item.uuid.toBase58 }) }}" class="hover:bg-gray-200/75 dark:hover:bg-gray-800 hover:text-gray-900 dark:hover:text-gray-100 rounded-md px-1.5 py-1 -mx-1.5 -my-1 transition-colors font-medium text-gray-900 dark:text-gray-100" data-turbo-frame="slideover">{{ item.name|default("") }}</a>',
                accounts: '{{ item.users|map(u => "#{u.firstname} #{u.lastname}")|join(", ") }}',
                phone: '{{ [item.phone, item.mobile]|filter(v => v)|join(" / ") }}',
                email: '{{ item.email }}',
                numberOffers: '{{ item.offers|length }}',
            }
        }
    } %}
        {% block page_header %}
            <div class="flex items-center justify-between gap-4 flex-wrap py-5 border-b border-gray-200 dark:border-gray-800 mb-2">
                <div class="flex items-center gap-4 flex-wrap min-w-0">
                    <twig:Admin:EditionSwitcher :editions="editions|default([])" :selected="selectedEditions|default([])" baseLabel="Veranstaltende" unscopedRoute="admin_hosts_index" scopedRoute="admin_hosts_index" />
                </div>

                <twig:Admin:Button href="{{ path('admin_hosts_create') }}" variant="primary">
                    <span class="flex items-center space-x-1">
                        <span class="size-4"><twig:ux:icon name="ph:plus" /></span>
                        <span>Neu anlegen</span>
                    </span>
                </twig:Admin:Button>
            </div>
        {% endblock %}
    {% endcomponent %}
{% endblock %}
