{% extends "bee_django_user/base.html" %}
{% load bee_django_user_filter %}

{% block content %}
    {% include 'bee_django_user/logo.html' %}
    {% include 'bee_django_user/nav.html' %}
    {% include 'bee_django_user/user/search.html' %}

    <div class="text-center"><h3>
        学生列表
    </h3>
    </div>
    {#    <div class="text-right">#}
    {#        <a class="btn btn-default" href="{% url 'bee_django_exam:notice_add' %}">添加须知</a>#}
    {#    </div>#}

    <table class="table">
        <thead>
        <tr>
            <th>姓名</th>
            <th>足迹</th>
            <th>课程</th>
            <th></th>

        </tr>
        </thead>
        <tbody>
        {% for user in user_list %}
            <tr>
                <td>{{ user.first_name }}
                    {% get_leave_status user as status %}
                    {% if status %}
                        （{{ status }}）
                    {% endif %}
                </td>
                <td><a href="{% url "bee_django_track:record_list" user.id %}" class="btn btn-success">足迹</a></td>
                <td><a href="{% url "bee_django_course:user_course" user.id %}" class="btn btn-success">课程表</a></td>
                <td>
                    <a href="{% url 'bee_django_user:user_detail' user.id %}  ">详情</a>
                    {% if perms.bee_django_user.change_userprofile %}
                        <a href="{% url 'bee_django_user:user_update' user.id %}  ">修改</a>
                    {% endif %}
                    {#                    <a href="#" id="delete_{{ source.id }}"#}
                    {#                       data-confirm="{% url "bee_django_crm:source_delete" source.id %}"#}
                    {#                       onclick="click_del(this)">删除</a>#}
                </td>
            </tr>

        {% endfor %}
        </tbody>
    </table>
    {% include 'bee_django_user/paginator.html' %}
{% endblock %}
{% block scripts %}
    <script>
        function click_del(_this) {
            if (!confirm('确认要执行这个操作？')) {
                return false;
            }
            var url = $(_this).attr('data-confirm');
            $.post(url).done(function (data) {
                alert('删除成功!');
                location.reload();
            });
        }
    </script>
{% endblock %}