{% extends 'base.html.j2' %}

{% block content %}

<input type="button" value="New Group" onclick="window.location='{% url 'Config Management:_group_add' %}';">
<table class="data">
    <tr>
        <th>Name</th>
        <th>Organization</th>
        <th>Sub-Groups</th>
        <th>&nbsp;</th>
    </tr>
    {% if groups %}
    {% for group in groups %}
    <tr>
        <td><a href="{% url 'Config Management:_group_view' pk=group.id %}">{{ group.name }}</a></td>
        <td>{{ group.organization }}</td>
        <td>{{ group.count_children }}</td>
        <td>&nbsp;</td>
    </tr>
    {% endfor %}
    {% else %}
    <tr>
        <td colspan="4">Nothing Found</td>
    </tr>
    {% endif %}
</table>
<br>
<div class="pagination">
    <span class="step-links">
        {% if page_obj.has_previous %}
        <a href="?page=1">&laquo; first</a>
        <a href="?page={{ page_obj.previous_page_number }}">previous</a>
        {% endif %}

        <span class="current">
            Page {{ page_obj.number }} of {{ page_obj.paginator.num_pages }}.
        </span>

        {% if page_obj.has_next %}
        <a href="?page={{ page_obj.next_page_number }}">next</a>
        <a href="?page={{ page_obj.paginator.num_pages }}">last &raquo;</a>
        {% endif %}
    </span>
</div>

{% endblock %}