{% extends "admin_base.html" %}
{% load seahub_tags i18n %}
{% load url from future %}

{% block nav_groupadmin_class %}class="cur"{% endblock %}

{% block main_panel %}
<h3>{% trans "All Groups" %}</h3>
{% if groups %}
<table>
    <tr>
        <th width="30%">{% trans "Name" %}</th>
        <th width="35%">{% trans "Creator" %}</th>
        <th width="23%">{% trans "Create At" %}</th>
        <th width="12%">{% trans "Operations" %}</th>
    </tr>
    {% for group in groups %}
    <tr>
        <td><a href="{{ SITE_ROOT }}group/{{ group.props.id }}/">{{ group.props.group_name }}</a></td>
        <td>{{ group.props.creator_name }}</td>
        <td>{{ group.props.timestamp|tsstr_sec }}</td>
        <td><a href="#" data-url="{% url 'group_remove' group.id %}" data-target="{{ group.props.group_name }}" class="group-remove-btn op vh">{% trans "Delete" %}</a></td>
    </tr>
    {% endfor %}
</table>

<div id="paginator">
    {% if current_page != 1 %}
    <a href="{{ SITE_ROOT }}sys/groupadmin/?page={{ prev_page }}&per_page={{ per_page }}">{% trans "Previous" %}</a>
    {% endif %}
    {% if page_next %}
    <a href="{{ SITE_ROOT }}sys/groupadmin/?page={{ next_page }}&per_page={{ per_page }}">{% trans "Next" %}</a>
    {% endif %}
    {% if current_page != 1 or page_next %}
    |
    {% endif %}
    <span>{% trans "Per page: " %}</span> 
    {% if per_page == 25 %}
    <span> 25 </span> 
    {% else %}
    <a href="{{ SITE_ROOT }}sys/groupadmin/?per_page=25" class="per-page">25</a>
    {% endif %}
    {% if per_page == 50 %}
    <span> 50 </span> 
    {% else %}
    <a href="{{ SITE_ROOT }}sys/groupadmin/?per_page=50" class="per-page">50</a>
    {% endif %}
    {% if per_page == 100 %}
    <span> 100 </span> 
    {% else %}
    <a href="{{ SITE_ROOT }}sys/groupadmin/?per_page=100" class="per-page">100</a>
    {% endif %}
</div>
{% else %}
<p>{% trans "Empty" %}</p>
{% endif %}
{% endblock %}

{% block extra_script %}
<script type="text/javascript">
addConfirmTo($('.group-remove-btn'), {
        'title':'{% trans "Delete Group" %}',
        'con':'{% trans "Are you sure you want to delete %s ?" %}'
});
</script>
{% endblock %}
 
