{% extends 'auth_layout.html' %}
{% block content %}
<div class="row">
    <div class="col">
        <h3 class="mb-3"><i class="ri-dashboard-fill"></i> Admin Dashboard</h3>
        <div class="row justify-content-center">

            <div class="col-sm-12 col-md-6 mb-4">
                <div class="card">
                    <div class="card-body text-center">
                        <h4>ILS User Count</h4>
                        <h1 class="display-3">{{ context.ils_user_count }}</h1>
                    </div>
                </div>
            </div>

            <div class="col-sm-12 col-md-6 mb-4">
                <div class="card">
                    <div class="card-body text-center">
                        <h4>Scheduled Reminders</h4>
                        <h1 class="display-3">{{ context.total_email_reminders }}</h1>
                    </div>
                </div>
            </div>

            <div class="col-sm-12 col-md-4 mb-4">
                <div class="card">
                    <div class="card-body text-center">
                        <h4>Expiring in the next 7 days</h4>
                        <ul class="text-start">
                            {% for user in context.ils_users_expiring %}
                                <li>{{ user.username }}</li>
                            {% endfor %}
                        </ul>
                    </div>
                </div>
            </div>

            <div class="col-sm-12 col-md-8 mb-4">
                <div class="card">
                    <div class="card-body text-center">
                        <h4>Upcoming Reminders</h4>
                        <table class="table table-hover text-start">
                            <tr>
                                <th>ILS User</th>
                                <th>Reminder Type</th>
                                <th>Send on</th>
                            </tr>
                            {% for reminder in context.email_reminders %}
                                <tr data-bs-toggle="tooltip" data-bs-placement="right" data-container="body" title="{{ reminder.email }}">
                                    <td>{{ reminder.username }}</td>
                                    <td>{{ reminder.interval }} day reminder</td>
                                    <td>{{ reminder.date }} {{ reminder.date | time_until }}</td>
                                </tr>
                            {% endfor %}
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
{% endblock %}