{% extends "base.html" %}

{% block title %}Daily Summary - Pickleball ELO Tracker{% endblock %}

{% block content %}
<h1>📧 Daily Session Summaries</h1>
{% include "components/nav.html" %}

<div style="margin-bottom: 20px;">
    <a href="/daily/new" class="btn btn-success">➕ Create Session</a>
</div>

{% if sessions.is_empty() %}
    <div class="alert alert-info">
        No sessions created yet. <a href="/daily/new">Create one</a>!
    </div>
{% else %}
    <table>
        <thead>
            <tr>
                <th>Date</th>
                <th>Matches</th>
                <th>Players</th>
                <th>Preview</th>
                <th>Actions</th>
            </tr>
        </thead>
        <tbody>
            {% for session in sessions %}
            <tr>
                <td>{{ session.created_at | truncate(length=10) }}</td>
                <td>{{ session.match_count }}</td>
                <td>{{ session.player_count }}</td>
                <td>
                    <a href="/daily/{{ session.id }}/preview" class="btn">Preview</a>
                </td>
                <td>
                    <a href="/daily/{{ session.id }}/send" class="btn btn-success">📧 Send</a>
                    <a href="/daily/{{ session.id }}/delete" class="btn btn-danger" onclick="return confirm('Delete this session?')">Delete</a>
                </td>
            </tr>
            {% endfor %}
        </tbody>
    </table>
{% endif %}
{% endblock %}
