{% extends "admin_base.html" %}

{% block title %}教师申请审核 - 智联青云管理后台{% endblock %}

{% block admin_content %}
<div class="space-y-6">
    <h1 class="text-2xl font-bold text-slate-900">教师申请审核</h1>

    <div class="bg-white shadow-sm rounded-lg border border-slate-200 overflow-hidden">
        <table class="min-w-full divide-y divide-slate-200">
            <thead class="bg-slate-50">
                <tr>
                    <th class="px-6 py-3 text-left text-xs font-medium text-slate-500 uppercase tracking-wider">ID</th>
                    <th class="px-6 py-3 text-left text-xs font-medium text-slate-500 uppercase tracking-wider">申请人</th>
                    <th class="px-6 py-3 text-left text-xs font-medium text-slate-500 uppercase tracking-wider">杯赛</th>
                    <th class="px-6 py-3 text-left text-xs font-medium text-slate-500 uppercase tracking-wider">姓名</th>
                    <th class="px-6 py-3 text-left text-xs font-medium text-slate-500 uppercase tracking-wider">邮箱</th>
                    <th class="px-6 py-3 text-left text-xs font-medium text-slate-500 uppercase tracking-wider">申请理由</th>
                    <th class="px-6 py-3 text-left text-xs font-medium text-slate-500 uppercase tracking-wider">申请时间</th>
                    <th class="px-6 py-3 text-left text-xs font-medium text-slate-500 uppercase tracking-wider">操作</th>
                </tr>
            </thead>
            <tbody id="applications-table-body" class="bg-white divide-y divide-slate-200">
                {% for app in apps %}
                <tr data-id="{{ app.id }}">
                    <td class="px-6 py-4 whitespace-nowrap text-sm text-slate-900">{{ app.id }}</td>
                    <td class="px-6 py-4 whitespace-nowrap text-sm text-slate-900">{{ app.user.name }}</td>
                    <td class="px-6 py-4 whitespace-nowrap text-sm text-slate-500">{{ app.contest.name }}</td>
                    <td class="px-6 py-4 whitespace-nowrap text-sm text-slate-500">{{ app.name }}</td>
                    <td class="px-6 py-4 whitespace-nowrap text-sm text-slate-500">{{ app.email }}</td>
                    <td class="px-6 py-4 text-sm text-slate-500 max-w-xs truncate">{{ app.reason }}</td>
                    <td class="px-6 py-4 whitespace-nowrap text-sm text-slate-500">{{ app.applied_at.strftime('%Y-%m-%d %H:%M') }}</td>
                    <td class="px-6 py-4 whitespace-nowrap text-sm font-medium">
                        <form action="{{ url_for('approve_teacher_application', app_id=app.id) }}" method="post" style="display:inline;">
                            <button type="submit" class="text-green-600 hover:text-green-900 mr-2">批准</button>
                        </form>
                        <form action="{{ url_for('reject_teacher_application', app_id=app.id) }}" method="post" style="display:inline;">
                            <button type="submit" class="text-red-600 hover:text-red-900">拒绝</button>
                        </form>
                    </td>
                </tr>
                {% else %}
                <tr>
                    <td colspan="8" class="px-6 py-12 text-center text-slate-500">暂无待审核的教师申请</td>
                </tr>
                {% endfor %}
            </tbody>
        </table>
    </div>
</div>
{% endblock %}