{% extends "base.html" %}
{% block title %}教师申请{% endblock %}
{% block content %}
<h1>教师申请</h1>
<table class="table table-striped">
    <thead>
        <tr>
            <th>ID</th>
            <th>申请人</th>
            <th>理由</th>
            <th>状态</th>
            <th>申请时间</th>
            <th>操作</th>
        </tr>
    </thead>
    <tbody>
        {% for app in apps %}
        <tr>
            <td>{{ app.id }}</td>
            <td>{{ app.username }}</td>
            <td>{{ app.reason }}</td>
            <td>
                {% if app.status == 'pending' %}
                    <span class="badge bg-warning">待处理</span>
                {% elif app.status == 'approved' %}
                    <span class="badge bg-success">已批准</span>
                {% else %}
                    <span class="badge bg-danger">已驳回</span>
                {% endif %}
            </td>
            <td>{{ app.created_at }}</td>
            <td>
                {% if app.status == 'pending' %}
                <form action="{{ url_for('approve_teacher_app', id=app.id) }}" method="post" style="display:inline;">
                    <button type="submit" class="btn btn-success btn-sm">批准</button>
                </form>
                <form action="{{ url_for('reject_teacher_app', id=app.id) }}" method="post" style="display:inline;">
                    <button type="submit" class="btn btn-danger btn-sm">驳回</button>
                </form>
                {% else %}
                <span class="text-muted">已处理</span>
                {% endif %}
            </td>
        </tr>
        {% endfor %}
    </tbody>
</table>
{% endblock %}