{% extends "base.html" %}

{% block title %}
    List User
{% endblock %}

{% block content %}
    <div class="btn-toolbar">
        <div class="btn-group">
            {% url "adduserurl" as theadduserurl %}
            <a class="btn btn-default {%if request.path = theadduserurl%} active {%endif%}" href={{ theadduserurl }}><span class="glyphicon glyphicon-edit"></span>新建用户</a>
            {% url "listuserurl" as thelistuserurl %}
            <a class="btn btn-default {%if request.path = thelistuserurl%} active {%endif%}" href={{ thelistuserurl }}><span class="glyphicon glyphicon-list"></span>用户列表</a>
            {% url "addxlsuserurl" as theaddxlsuserurl %}
            <a class="btn btn-default {%if request.path = theaddxlsuserurl%} active {%endif%}" href={{ addxlsuserurl }}><span class="glyphicon glyphicon-list"></span>批量导入</a>
        </div>
    </div>

    <hr/>

    <table class="table table-hover table-striped  table-bordered table-condensed">
        <tr>
            <th>账号</th>
            <th>姓名</th>
            <th>性别</th>
            <th>学号</th>
            <th>分组</th>
            <th>状态</th>
            <th>角色</th>
            <th>最后登录时间</th>
            <th>操作</th>
        </tr>

            {% for i in lPage %}
                <tr style="font-size: 13px;">
                    <td>{{ i.username }}</td>
                    <td>{{ i.nickname|default:"----" }}</td>
                    <td>{{ i.sex|default:"----" }}</td>
                    <td>{{ i.sid }}</td>
                    <td>{{ i.classid }}</td>
                    <td>
                        {% if i.is_active %}
                            <span class="label label-success">启用</span>
                        {% else %}
                            <span class="label label-default">禁用</span>
                        {% endif %}
                    </td>
                    <td>{{ i.role|default:"----" }}</td>
                    <td>{{ i.last_login|date:"Y-m-d H:i:s" }}</td>
                    <td class="host_buttom">
                        <a class="btn btn-warning btn-xs"  href={% url "edituserurl" i.id %} onclick="return confirm('是否确认编辑？')">编辑</a>
                        <a class="btn btn-danger btn-xs" href={% url "deleteuserurl" i.id %} onclick="return confirm('是否确认删除？')">删除</a>
                    </td>
                </tr>
            {% endfor %}

        </table>

    {% include "common/paginator.html" %}
{% endblock %}
