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

{% block content %}
<input type="button" value="<< Back to settings" onclick="window.location='{% url 'Settings:Settings' %}';">
<input type="button" value="New Category" onclick="window.location='{% url 'Settings:_ticket_category_add' %}';">

<table style="max-width: 100%;">
    <thead>
        <th>Name</th>
        <th>Organization</th>
        <th>created</th>
        <th>modified</th>
        <th>&nbsp;</th>
    </thead>
    {% if items %}
    {% for category in items %}
    <tr>
        <td><a href="{% url 'Settings:_ticket_category_view' pk=category.id %}">{{ category.name }}</a></td>
        <td>{{ category.organization }}</td>
        <td>{{ category.created }}</td>
        <td>{{ category.modified }}</td>
        <td>&nbsp;</td>
    </tr>
    {% endfor %}
    {% else %}
    <tr><td colspan="5">Nothing Found</td></tr>
    {% endif%}
</table>

<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 %}
