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

{% block list %}

{{ component('Admin:SearchableQueryableList', {
        qb: qb,
        routeName: app.current_route,
        routeParameters: app.current_route_parameters|merge(app.request.query.all),
        searchable: searchable|default([]),
        headline: (headline == "#{translationPrefix}.#{action}.title") ? "#{translationPrefix}.title"|trans : headline,
        createUrl: createUrl|default(null),
        viewKey: 'admin_editions',
        viewPathPrefix: '/admin/saisons',
        exports: exports|default([]),
        config: {
            title: '{{ item.name|default("") }}
    {% if item.archived %}
    <span class="ml-2 px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-red-100 text-red-800">archiviert</span>
    {% endif %}
',
            info: [
                "{{ item.holiday ? item.holiday.periodBegin|date('d.m.Y') ~ ' - ' ~  item.holiday.periodEnd|date('d.m.Y') : '' }}"
            ],
            groupBy: '{% if item.holiday and item.holiday.periodBegin %}{{ item.holiday.periodBegin|date("Y") }}{% else %}Ohne Zeitraum{% endif %}',
            columns: {
                name: '<a href="{{ path("admin_editions_show", { alias: item.alias }) }}" 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>',
                offers: '{{ item.offers|length }} Angebote'
            }
        }
    }) }}
{% endblock %}
