{% extends "_base.html" %}
{% load i18n %}
{% block content %}
    {% load static %}
    <div class="table-header">
        <h1 class="heading">
            {% translate "Manage Regions" %}
        </h1>
        <div class="flex justify-between">
            {% include "search_input_form.html" with object_type="region" region_slug="" language_slug="" %}
            {% if perms.cms.change_region %}
                <a href="{% url 'new_region' %}" class="btn">{% translate "Create region" %}</a>
            {% endif %}
        </div>
    </div>
    <div class="table-listing">
        <table class="w-full mt-4 rounded border border-solid border-gray-200 shadow bg-white">
            <thead>
                <tr class="border-b border-solid border-gray-200">
                    <th class="text-sm text-left uppercase py-3 pl-4 pr-2">
                        {% translate "Name" %}
                    </th>
                    <th class="text-sm text-left uppercase py-3 px-2">
                        {% translate "Created" %}
                    </th>
                    <th class="text-sm text-left uppercase py-3 px-2">
                        {% translate "Last updated" %}
                    </th>
                    <th class="text-sm text-left uppercase py-3 px-2 min">
                        {% translate "Status" %}
                    </th>
                    <th class="text-sm text-right uppercase py-3 pl-2 pr-4">
                        {% translate "Actions" %}
                    </th>
                </tr>
            </thead>
            <tbody>
                {% for region in regions %}
                    {% include "regions/region_list_row.html" %}
                {% empty %}
                    <tr>
                        <td colspan="6" class="px-2 py-3">
                            {% if search_query %}
                                {% translate "No regions found with these filters." %}
                            {% else %}
                                {% translate "No regions available yet." %}
                            {% endif %}
                        </td>
                    </tr>
                {% endfor %}
            </tbody>
        </table>
    </div>
    {% url "regions" as url %}
    {% include "pagination.html" with chunk=regions %}
{% endblock content %}
