{% extends 'myadmin/base.html' %}
{% load static %}

{% block content %}

<div class="ui grid">
    <div class="row">
        <h3 class="ui header six wide column">用户列表</h3>
        <div class="v-title-extra ten wide column">
            <div class="ui action input v-admin-search">
                <input type="text" placeholder="Search..."  value="{{q}}" id="v-search">
                <button class="ui small button" id="search">搜索</button>
            </div>
        </div>
    </div>
    <div class="ui divider"></div>
    <div class="row">
        <table class="ui unstackable single line striped selectable table">
            <thead>
            <tr><th>用户名</th><th>账号类型</th><th>加入时间</th><th>操作</th></tr>
            </thead>
            <tbody class="video-list">

            {% for item in user_list %}
            <tr user-id="{{item.id}}">
                <td> {{item.username}}</td>
                <td> {% if item.is_staff %}管理员{% else %}普通{% endif %}</td>
                <td> {{item.date_joined|date:'Y-m-d H:i'}}</td>
                <td>
                    <a class="ui primary button user-edit" href="{% url 'myadmin:user_edit' item.id %}">编辑</a>
                    <a class="ui button user-delete">删除</a>
                </td>
            </tr>
            {% empty %}
            <h3>暂无数据</h3>
            {% endfor %}


            </tbody>
            <tfoot>
            <tr>
                <th colspan="6">
                    {% include 'myadmin/page_nav.html' %}
                </th>
            </tr>
            </tfoot>
        </table>
    </div>
</div>


{% endblock content %}

{% block modal %}
{% include "myadmin/user_list_modal.html" %}
{% endblock modal %}

{% block javascript %}
<script>
   var api_user_delete = "{% url 'myadmin:user_delete' %}";
   var search_url = "{% url 'myadmin:user_list' %}"

</script>
<script src="{% static 'js/myadmin/user_list.js' %}"></script>
{% endblock javascript %}
