{% extends base.html %}

{% block content %}
<form class="layui-form">
  <div class="layui-form-item">
    <div class="layui-inline">
      <div class="layui-input-wrap">
        <input type="text" name="id" placeholder="用户id" autocomplete="off" class="layui-input" {% if handler.args.id %}value="{{ handler.args.id }}"{% end %}>
      </div>
    </div>
    <div class="layui-inline">
      <div class="layui-input-wrap">
        <input type="text" name="username" placeholder="用户名" autocomplete="off" class="layui-input" {% if handler.args.username %}value="{{ handler.args.username }}"{% end %}>
      </div>
    </div>
    <div class="layui-inline">
      <div class="layui-input-wrap">
        <button class="layui-btn" lay-submit="" >查找</button>
      </div>
    </div>
  </div>
</form>


<table class="layui-table table-hover table-bordered table-sm" lay-skin="line" align="center">
  <thead>
    <tr>
      <th>ID</th>
      <th>帐号</th>
      <th class="pc">注册时间</th>
      <th class="pc">用户角色</th>
      <th class="pc">文件数量</th>
      <th class="pc">使用空间</th>
      <th>操作</th>
    </tr>
  </thead>

  <tbody>
    {% for doc in entries %}
    <tr data-id="{{ doc._id }}">
      <td>{{ doc.id }}</td>
      <td><a class="btn-copy" href="javascript:;" add-host data-clipboard-text="/disk/{{ doc.code }}?token={{ doc.token }}">{{ doc.username or doc.nickName }}</td>
      <td class="pc">{{ str(doc.created_at)[:19] }}</td>
      <td class="pc">{{ '管理员' if doc.admin else '普通用户' }}</td>
      <td class="pc">{{ doc.get('files', 0) }}</td>
      <td class="pc">{{ handler.convert_size(doc.get('usage', 0) * 1024 * 1024) }} </td>
      <td>
        <a class="layui-btn layui-btn-sm layui-btn-radius" href="/disk/{{ doc.code }}">文件管理</a>
        <button action="delete" class="layui-btn layui-btn-sm layui-btn-danger layui-btn-radius btn-manage">删除</button>
      </td>
    </tr>
    {% end %}
  </tbody>
</table>

<div id="pagination"></div>

{% end %}
