{% extends "base.html" %}

{% block title %}Your Client Reports{% endblock %}

{% block content %}
    <div class="container mt-4">
        <h1 class="mb-4">Your Client Reports</h1>

        <div class="card">
            <div class="card-body">
                <div class="table-responsive">
                    <table class="table table-striped table-hover">
                        <thead class="thead-dark">
                            <tr>
                                <th>Report ID</th>
                                <th>Client Name</th>
                                <th>Assessment</th>
                                <th>Completion Date</th>
                                <th>Actions</th>
                            </tr>
                        </thead>
                        <tbody>
                            {% for assignment in assignments %}
                                <tr>
                                    <td>{{ assignment.id }}</td>
                                    <td>{{ assignment.client.name if assignment.client else 'N/A' }}</td>
                                    <td>{{ assignment.assessment.name }}</td>
                                    <td>{{ assignment.completed_date.strftime('%Y-%m-%d') if assignment.completed_date else 'Pending' }}</td>
                                    <td>
                                        <a href="{{ url_for('main.view_report', assignment_id=assignment.id) }}" class="btn btn-primary btn-sm">View Report</a>
                                    </td>
                                </tr>
                            {% else %}
                                <tr>
                                    <td colspan="5" class="text-center">No reports found.</td>
                                </tr>
                            {% endfor %}
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
{% endblock %}
