{% extends 'layouts/admin.twig' %}

{% block content %}

    <ul class="breadcrumbs el">
        <li><a href="/admin/">Home</a> /</li>
        <li class="end">Unio</li>
    </ul>

    <h1>{{ title }}</h1>

    <ul class="tabnav el">
        <li class="{{ selected_tab == 'to_unio' ? 'selected' : '' }}">
            <a href="{{ route('admin-unio-queue-to-unio') }}">To Unio</a>
        </li>
        <li class="{{ selected_tab == 'from_unio' ? 'selected' : '' }}">
            <a href="{{ route('admin-unio-queue-from-unio') }}">From Unio</a>
        </li>
    </ul>


    {% include 'admin/messages.twig' %}

    <table>

        <thead>
            <tr>
                <th>#</th>
                <th>Entity Type</th>
                <th>Entity ID</th>
                <th>Created at</th>
                <th>Processed at</th>
                <th>Status</th>
                <th>Actions</th>
            </tr>
        </thead>

        <tbody class="tabular">

        {% for queue_message in queue_messages %}

            <tr>
                <td>{{ queue_message.id }}</td>
                <td>{{ queue_message.entity_type }}</td>
                <td>{{ queue_message.entity_id }}</td>
                <td>{{ queue_message.created_at }}</td>
                <td>{{ queue_message.processed_at | default('-') }}</td>
                <td>{{ queue_message.status }}</td>
                <td>
                {% for action in actions %}
                    <a href="{{ route(action.button_route, [ queue_message ])}}">
                        {{ action.button_label }}
                    </a>
                {% endfor %}
                </td>
            </tr>

        {% endfor %}

        </tbody>

    </table>

    <hr />

    {{ queue_messages.links() | raw }}

{% endblock %}
