{#
SPDX-FileCopyrightText: 2026 Martin Kirchgessner

SPDX-License-Identifier: AGPL-3.0-or-later
#}

{% extends 'layout.jinja' %}
{% block title %}Playout history{% endblock title %}

{% block content %}
<section class="content">
<div class="container">
<h1 aria-hidden="true">{# screen readers will read the table's aria-label #}
    Playout history
</h1>
<table class="table is-fullwidth is-striped is-hoverable" aria-label="Playout history">
    <thead>
        <tr>
            <th scope="col">Date</th>
            <th scope="col">Artist</th>
            <th scole="col">Title</th>
            <th scope="col">Source</th>
            <th scope="col">File</th>
        </tr>
    </thead>
    <tbody>
        {% for entry in history %}
            <tr>
                <td>{{ entry.on_air.isoformat() }}</td>
                <td>{{ entry.artist or '' }}</td>
                <td>{{ entry.title or '' }}</td>
                <td>
                    {% if entry.cart_id %}
                        <a href="{{ url_for('carts.sounds_list', cart_id=entry.cart_id) }}">
                            {{ entry.source }}
                        </a>
                    {% else %}
                        {{ entry.source }}
                    {% endif %}
                </td>
                <td>
                    {{ entry.source_filename }}
                </td>
            </tr>
        {% endfor %}
    </tbody>
</table>

</div>
</section>
{% endblock content %}
