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

{% block main %}

    <twig:Admin:PageHeader title="email_delivery_errors.title" subtitle="Prüfen Sie, welche E-Mail-Adressen Fehlermeldungen produzieren." />

    <div class="-ml-3 mt-6">
        <nav class="flex overflow-hidden" aria-label="">

            <a href="{{ path('email_delivery_errors') }}"
               class="bg-gray-100 dark:bg-gray-900 text-gray-700 dark:text-gray-100/80 rounded-md px-3 py-2 whitespace-nowrap text-sm font-medium"
               aria-current="page">
                <span>E-Mails mit Fehlern</span>
            </a>

            <a href="{{ path('blocked_contacts') }}"
               class="text-gray-500 dark:text-gray-100/50 hover:text-gray-700 dark:hover:text-gray-100/80 rounded-md px-3 py-2 whitespace-nowrap text-sm font-medium"
            >
                <span>
                    Blockierte Accounts
                    {% if numberBlocked %}
                        <span class="inline-flex items-center rounded-full aspect-square bg-red-100 px-1.5 py-0.5 text-xs font-medium text-red-700">{{ numberBlocked }}</span>
                    {% endif %}
                </span>
            </a>

        </nav>
    </div>

    <div class="mt-3 divide-y">

        {% for message in messages %}
            <div class="py-4 flex items-center justify-between">

                <div class="flex-1">
                    <p class="text-sm font-semibold text-gray-900 dark:text-white">{{ message.to|default("") }}</p>
                    <p class="text-gray-500 dark:text-gray-400 text-xs font-medium mt-1">
                        <span>{{ message.subject|default("") }}</span>
                    <span class="font-normal">{{ message.createdAt|default ? message.createdAt|ago : "" }}</span>
                    </p>
                    <a href="{{ path('admin_outbox', { message: message.id }) }}" class="mt-1 text-gray-500 hover:text-gray-700 dark:text-gray-400 text-xs flex items-center space-x-1">
                        <span>
                            E-Mail öffnen
                        </span>
                        <twig:ux:icon name="ph:arrow-square-out" class="h-4 w-4" />

                    </a>
                </div>

                <div>

                    <div class="flex items-center space-x-2">
                        {% for engagement in message.engagements %}
                            <twig:Admin:Badge :notification="engagement" size="sm" />
                        {% endfor %}
                    </div>

                </div>

            </div>
        {% endfor %}

    </div>

{% endblock %}
