{% extends "@FerienpassAdmin/layout/base.html.twig" %}
{% set title = 'Dashboard' %}

{% block main %}
    <div class="flex flex-col lg:flex-row">
        <div class="flex-1 {% if is_granted('ROLE_ADMIN') %}lg:pr-12{% endif %}">
            <div>
                <h1 class="text-gray-900 dark:text-gray-50 tracking-tight text-3xl font-extrabold">Hi <span data-controller="ferienpass--admin-personalize"></span>!</h1>
            </div>

            {# The data widgets are ESI fragments tagged CacheTag::dashboard: the
               surrounding page stays cached for a year while each fragment is kept
               fresh by attendance lifecycle events (see CacheInvalidationListener).
               The includes are gated by ROLE_ADMIN — the fragments are cached
               publicly and shared across the tenant's admins, so a non-admin must
               never prime them (cf. the stash-count badge in _header.html.twig). #}
            {% if is_granted('ROLE_ADMIN') %}
                <div class="mt-6 space-y-24">
                    {% for widget in widgets %}
                        {{ render_esi(controller(widget)) }}
                    {% endfor %}
                </div>
            {% endif %}
        </div>
        {% if is_granted('ROLE_ADMIN') %}
            {{ render_esi(controller('Ferienpass\\AdminBundle\\Controller\\Dashboard\\ActivityFeedController')) }}
        {% endif %}
    </div>
{% endblock %}
