{% extends "bee_django_user/base.html" %}
{#{% load bee_django_crm_filter %}#}

{% block content %}
    {% include 'bee_django_user/logo.html' %}
    {% include 'bee_django_user/nav.html' %}
    <div class="text-center"><h3>
        班级列表
    </h3>
    </div>
        <div class="text-right">
            <a class="btn btn-default" href="{% url 'bee_django_user:class_create' %}">添加班级</a>
        </div>

    <table class="table">
        <thead>
        <tr>
            <th>班级名称</th>
            <th>助教</th>
            <th></th>

        </tr>
        </thead>
        <tbody>
        {% for class in class_list %}
            <tr>
                <td>{{ class.name }}</td>
                <td>{{ class.assistant.first_name }}</td>
                <td>
                    <a href="{% url 'bee_django_user:class_detail' class.id %}  ">详情</a>
                    {% if perms.user_class.change %}
                    <a href="{% url 'bee_django_user:class_update' class.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 %}