{% extends "admin_base.html" %}
{% load seahub_tags i18n %}
{% block nav_useradmin_class %}class="cur"{% endblock %}

{% block title_panel %}
<div class="tabnav">
    <ul class="tabnav-tabs">
        <li class="tabnav-tab"><a href="{% url 'sys_useradmin' %}">{% trans "Database" %}</a></li>
        <li class="tabnav-tab tabnav-tab-cur">{% trans "LDAP" %}</li>
    </ul>
    <button class="icon-search fright" id="search-user-btn"> {% trans "Search" %}</button>    
</div>
{% endblock %}

{% block main_panel %}
<table>
    <tr>
        <th width="65%">{% trans "Email" %}</th>
        <th width="15%">{% trans "Create At / Last Login" %}</th>
        <th width="20%">{% trans "Space Used" %}</th>
    </tr>

    {% for user in users %}
    <tr>
        <td data="{{user.id}}"><a href="{{ SITE_ROOT }}useradmin/info/{{ user.props.email }}/">{{ user.email }}</a></td>
        <td style="font-size:11px;"> -- / {% if user.last_login %}{{user.last_login|translate_seahub_time}} {% else %} -- {% endif %}
        </td>
        <td>
            {% if CALC_SHARE_USAGE %}
            {{ user.self_usage|filesizeformat }} + {{ user.share_usage|filesizeformat }} {% if user.quota > 0 %} / {{ user.quota|filesizeformat }} {% endif %}
            {% else %}
            {{ user.self_usage|filesizeformat }} {% if user.quota > 0 %} / {{ user.quota|filesizeformat }} {% endif %}
            {% endif %}
        </td>
    </tr>
    {% endfor %}
</table>

{% include "sysadmin/useradmin_paginator.html" %}
{% endblock %}

{% block extra_script %}
<script type="text/javascript">
$('#search-user-btn').click(function() {
    location.href = "{% url 'user_search' %}";
});

</script>
{% endblock %}
