{% extends "base.html" %}
{% load my_filters %}
{% block title %}RustDesk WebUI{% endblock %}
{% block legend_name %}{{ "综合屏" | translate }}{% endblock %}
{% block content %}
<div style="padding: 20px; background-color: #F2F2F2;">
  <div class="layui-row layui-col-space15">
    {% if not show_all %}
    <div class="layui-col-md15">
      <div class="layui-card">
        <div class="layui-card-header">{{ "设备统计" | translate }} - 【{{ "用户名" | translate }}:{{u.username}}】</div>
        <div class="layui-card-body">
          <table class="layui-table">
            <thead>
              <tr>
                <th>{{ "客户端ID" | translate }}</th>
                <th>{{ "版本" | translate }}</th>
                <th>{{ "连接密码" | translate }}</th>
                <th>{{ "系统用户名" | translate }}</th>
                <th>{{ "计算机名" | translate }}</th>
                <th>{{ "别名" | translate }}</th>
                <th>{{ "平台" | translate }}</th>
                <th>{{ "系统" | translate }}</th>
                <th>{{ "CPU" | translate }}</th>
                <th>{{ "内存" | translate }}</th>
                <th>{{ "IP" | translate }}</th>
                <th>{{ "注册时间" | translate }}</th>
                <th>{{ "更新时间" | translate }}</th>
                <th>{{ "状态" | translate }}</th>
              </tr>
            </thead>
            <tbody>
              {% for one in page_obj %}
              <tr>
                <td>{{one.rid}} </td>
                <td>{{one.version}}</td>
                <td>{{one.has_rhash}}</td>
                <td>{{one.username}}</td>
                <td>{{one.hostname}}</td>
                <td>{{one.alias}}</td>
                <td>{{one.platform}}</td>
                <td>{{one.os}}</td>
                <td>{{one.cpu}}</td>
                <td>{{one.memory}}</td>
                <td>{{one.ip_address}}</td>
                <td>{{one.create_time}}</td>
                <td>{{one.update_time}}</td>
                <td>{{one.status}} </td>
              </tr>
              {% endfor %}
            </tbody>
          </table>
        </div>
      </div>
    </div>
    <div class="layui-col-md4 layui-col-md-offset4">
      <span class="step-links">
          {% if page_obj.has_previous %}
              <button class="layui-btn" ><a href="?page=1">&laquo; {{ "首页" | translate }}</a></button>
              <button class="layui-btn" ><a href="?page={{ page_obj.previous_page_number }}">{{ "上一页" | translate }}</a></button>
          {% endif %}
          {% if page_obj.paginator.num_pages > 1 %}
          <span class="current">
              {{ "页码" | translate }} {{ page_obj.number }} / {{ page_obj.paginator.num_pages }}
          </span>
          {% endif %}
          {% if page_obj.has_next %}
              <button class="layui-btn" > <a href="?page={{ page_obj.next_page_number }}">{{ "下一页" | translate }}</a></button>
              <button class="layui-btn" ><a href="?page={{ page_obj.paginator.num_pages }}">{{ "尾页" | translate }} &raquo;</a></button>
          {% endif %}
      </span>
  </div>
    {% endif %}


    {% if u.is_admin and show_all %}
    <div class="layui-col-md15">
      <div class="layui-card">
        <div class="layui-card-header">{{ "全部用户" | translate }} &raquo;
          <div class="layui-btn" ><a href="/api/down_peers">{{ "导出xlsx" | translate }}</a></div>
        </div>
        <div class="layui-card-body">
          <table class="layui-table">
            <thead>
              <tr>
                <th>{{ "客户端ID" | translate }}</th>
                <th>{{ "所属用户" | translate }}</th>
                <th>{{ "版本" | translate }}</th>
                <th>{{ "系统用户名" | translate }}</th>
                <th>{{ "计算机名" | translate }}</th>
                <th>{{ "系统" | translate }}</th>
                <th>{{ "CPU" | translate }}</th>
                <th>{{ "内存" | translate }}</th>
                <th>{{ "IP" | translate }}</th>
                <th>{{ "注册日期" | translate }}</th>
                <th>{{ "更新时间" | translate }}</th>
                <th>{{ "状态" | translate }}</th>
              </tr>
            </thead>
            <tbody>

              {% for one in page_obj %}
              <tr>
                <td>{{one.rid}} </td>
                <td>{{one.rust_user}} </td>
                <td>{{one.version}} </td>
                <td>{{one.username}} </td>
                <td>{{one.hostname}} </td>
                <td>{{one.os}} </td>
                <td>{{one.cpu}} </td>
                <td>{{one.memory}} </td>
                <td>{{one.ip_address}}</td>
                <td>{{one.create_time}} </td>
                <td>{{one.update_time}} </td>
                <td>{{one.status}} </td>
              </tr>
              {% endfor %}
            </tbody>
          </table>
        </div>
      </div>
    </div>
    <div class="layui-col-md4 layui-col-md-offset4">
      <span class="step-links">
          {% if page_obj.has_previous %}
              <button class="layui-btn" ><a href="?show_type=admin&page=1">&laquo; {{ "首页" | translate }}</a></button>
              <button class="layui-btn" ><a href="?show_type=admin&page={{ page_obj.previous_page_number }}">{{ "上一页" | translate }}</a></button>
          {% endif %}
          {% if page_obj.paginator.num_pages > 1 %}
          <span class="current">
              {{ "页码" | translate }} {{ page_obj.number }} / {{ page_obj.paginator.num_pages }}
          </span>
          {% endif %}
          {% if page_obj.has_next %}
              <button class="layui-btn" > <a href="?show_type=admin&page={{ page_obj.next_page_number }}">{{ "下一页" | translate }}</a></button>
              <button class="layui-btn" ><a href="?show_type=admin&page={{ page_obj.paginator.num_pages }}">{{ "尾页" | translate }} &raquo;</a></button>
          {% endif %}
      </span>
  </div>
    {% endif %}




  </div>
</div>

{% endblock %}