{% extends "base.html" %}
{% load my_filters %}
{% block title %}RustDesk WebUI{% endblock %}
{% block content %}
<div style="padding: 20px; background-color: #F2F2F2;">
  <div class="layui-row layui-col-space15">
    <div class="layui-col-md15">
      <div class="layui-card">
        <div class="layui-card-header">{{ "连接日志" | translate }}:【{{u.username}}】</div>
        <div class="layui-card-body">
          <table class="layui-table">
            <thead>
              <tr>
                <th>{{ "用户IP" | translate }}</th>
                <th>{{ "用户ID" | translate }}</th>
                <th>{{ "用户别名" | translate }}</th>
                <th>{{ "远程ID" | translate }}</th>
                <th>{{ "远程别名" | translate }}</th>
                <th>{{ "连接开始时间" | translate }}</th>
                <th>{{ "连接结束时间" | translate }}</th>
                <th>{{ "时长"  | translate }}(HH:MM:SS)</th>
              </tr>
            </thead>
            <tbody>
              {% for one in page_obj %}
              <tr>
                <td>{{one.from_ip}} </td>
                <td>{{one.from_id}}</td>
                <td>{{one.from_alias}}</td>
                <td>{{one.rid}}</td>  
                <td>{{one.alias}}</td> 
                <td>{{one.conn_start}}</td>
                <td>{{one.conn_end}}</td>
                <td>{{one.duration}}</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; {{ "First" | translate }}</a></button>
              <button class="layui-btn" ><a href="?page={{ page_obj.previous_page_number }}">{{ "Previous" | 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 }}">{{ "Next" | translate }}</a></button>
              <button class="layui-btn" ><a href="?page={{ page_obj.paginator.num_pages }}">{{ "Last" | translate }} &raquo;</a></button>
          {% endif %}
      </span>
  </div>  
  </div>
</div>

{% endblock %}