{% extends "base.html" %}
{% block title %}Pending User Approvals{% endblock %}
{% block content %}
<div class="bbs-header">
    <h1><i class="bi bi-person-check"></i> Pending User Approvals</h1>
    <p class="small text-muted">
        Users awaiting NUV sysop approval. Set
        <code>NUV_ENABLED=true</code> to require approval for new accounts.
    </p>
</div>

{% if not rows %}
<div class="card"><div class="card-body text-muted">No pending users.</div></div>
{% else %}
<table class="table table-sm">
    <thead><tr><th>User</th><th>Email</th><th>Registered</th><th>Actions</th></tr></thead>
    <tbody>
    {% for u in rows %}
    <tr>
        <td><strong>{{ u.username }}</strong></td>
        <td><small>{{ u.email }}</small></td>
        <td><small>{{ u.created_at.strftime('%Y-%m-%d %H:%M') }}</small></td>
        <td class="text-nowrap">
            <form method="post" action="{{ url_for('admin.pending_user_action', user_id=u.id, action='approve') }}" class="d-inline">
                <input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
                <button class="btn btn-sm btn-success"><i class="bi bi-check"></i> Approve</button>
            </form>
            <form method="post" action="{{ url_for('admin.pending_user_action', user_id=u.id, action='reject') }}" class="d-inline">
                <input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
                <button class="btn btn-sm btn-warning"><i class="bi bi-x"></i> Reject</button>
            </form>
            <form method="post" action="{{ url_for('admin.pending_user_action', user_id=u.id, action='delete') }}" class="d-inline" onsubmit="return confirm('Permanently delete {{ u.username }}?');">
                <input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
                <button class="btn btn-sm btn-outline-danger"><i class="bi bi-trash"></i></button>
            </form>
        </td>
    </tr>
    {% endfor %}
    </tbody>
</table>
{% endif %}
{% endblock %}
