{% load seahub_tags i18n %}
<table>
    <tr>
        <th width="25%">{% trans "Email" %}</th>
        <th width="12%">{% trans "Status" %}</th>
        <th width="11%">{% trans "Role" %}</th>
        <th width="15%">{% trans "Space Used" %}</th>
        <th width="22%">{% trans "Create At / Last Login" %}</th>
        <th width="15%">{% trans "Operations" %}</th>
    </tr>

    {% for user in users %}
    <tr data-userid="{{user.email}}">
        <td><a href="{{ SITE_ROOT }}useradmin/info/{{ user.props.email }}/">{{ user.email }}</a></td>
        <td>
          {% if user.source != 'LDAP' %}
            <div class="user-status">
              {% if user.is_active %}
                <span class="user-status-cur-value">{% trans "Active" %}</span>
              {% else %}
                <span class="user-status-cur-value">{% trans "Inactive" %}</span>
              {% endif %}
                <img src="{{MEDIA_URL}}img/edit_12.png" alt="{% trans "Edit"%}" title="{% trans "Edit"%}" class="user-status-edit-icon cspt vh" />
            </div>
            <select name="permission" class="user-status-select hide">
                <option value="1" {%if user.is_active %}selected="selected"{% endif %}>{% trans "Active" %}</option>
                <option value="0" {%if not user.is_active %}selected="selected"{% endif %}>{% trans "Inactive"%}</option>
            </select>
          {% endif %}
        </td>
        <td>
          {% if user.source != 'LDAP' %}
            <div class="user-role">
                {% if user.is_guest %}
                    <span class="user-role-cur-value">{% trans "Guest" %}</span>
                {% else %}
                    <span class="user-role-cur-value">{% trans "Default" %}</span>
                {% endif %}
                {% if enable_guest %}
                <img src="{{MEDIA_URL}}img/edit_12.png" alt="{% trans "Edit"%}" title="{% trans "Edit"%}" class="user-role-edit-icon cspt vh" />
                {% endif %}
            </div>
            {% if enable_guest %}
            <select name="role" class="user-role-select hide">
                <option value={{default_user}} {%if not user.is_guest %}selected="selected"{% endif %}>{% trans "Default" %}</option>
                <option value={{guest_user}} {%if user.is_guest %}selected="selected"{% endif %}>{% trans "Guest"%}</option>
            </select>
            {% endif %}
          {% 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>
        <td>
            {% if user.source != 'LDAP' %}
            {{ user.ctime|tsstr_sec }} /<br />
            {% if user.last_login %}{{user.last_login|translate_seahub_time}} {% else %} -- {% endif %}
            {% endif %}
        </td>
        <td>
          {% if user.source != 'LDAP' %}
          {% if not user.is_self %}
          <a href="#" class="remove-user-btn op vh" data-url="{{ SITE_ROOT }}useradmin/remove/{{ user.props.id }}/" data-target="{{ user.props.email }}">{% trans "Delete" %}</a>
          <a href="#" class="reset-user-btn op vh" data-url="{% url 'user_reset' user.id %}" data-target="{{ user.props.email }}">{% trans "ResetPwd" %}</a>
          {% endif %}
          {% endif %}
        </td>
    </tr>
    {% endfor %}
</table>
