{% extends "_base.html" %}
{% load i18n %}
{% load rules %}
{% load static %}
{% load content_filters %}

{% block content %}

{% get_current_language as LANGUAGE_CODE %}
{% get_language LANGUAGE_CODE as backend_language %}
<div class="table-header">
    <h1 class="heading">{% trans 'Archived locations' %}</h1>
    <div class="flex flex-wrap gap-4">
        {% include "generic_language_switcher.html" with target='archived_pois' %}
        {% include "search_input_form.html" with object_type="poi" object_archived=True %}
    </div>
</div>

<div class="table-listing">
    <form id="bulk-action-form" method="post">
        {% csrf_token %}
    </form>
    <table class="w-full mt-4 rounded border border-gray-200 shadow bg-white table-fixed">
        <thead>
            <tr class="border-b border-gray-200">
                <th class="py-3 pl-4 pr-2 min">
                    <input form="bulk-action-form" type="checkbox" id="bulk-select-all">
                </th>
                <th class="text-sm text-left uppercase py-3 pr-2">{% trans 'Title in' %} {{ language.translated_name }}</th>
                {% if backend_language and backend_language != language %}
                    <th class="text-sm text-left uppercase py-3 pr-2">{% trans 'Title in' %} {{ backend_language.translated_name }}</th>
                {% endif %}
                <th class="text-sm text-left uppercase py-3 pr-2">{% trans 'Status' %}</th>
                <th class="text-sm text-left uppercase py-3 pr-2">{% trans 'Street' %}</th>
                <th class="text-sm text-left uppercase py-3 pr-2">{% trans 'Postal Code' %}</th>
	            <th class="text-sm text-left uppercase py-3 pr-2">{% trans 'City' %}</th>
                <th class="text-sm text-left uppercase py-3 pr-2">{% trans 'Country' %}</th>
                <th class="text-sm text-right uppercase py-3 pr-4 min">{% trans 'Options' %}</th>
            </tr>
        </thead>
        <tbody>
        {% for poi in pois %}
            {% get_translation poi language.slug as poi_translation %}
            {% include "pois/poi_list_archived_row.html" %}
        {% empty %}
            <tr>
                <td colspan="7" class="px-4 py-3">
	                {% trans 'No locations archived yet.' %}
                </td>
            </tr>
        {% endfor %}
        </tbody>
    </table>
</div>

<div class="flex flex-wrap gap-2 mt-4">
    <select id="bulk-action" class="w-auto max-w-full">
        <option>{% trans 'Select bulk action' %}</option>
        <option data-bulk-action="{% url 'bulk_restore_pois' region_slug=request.region.slug language_slug=language.slug %}">
            {% trans 'Restore locations' %}
        </option>
    </select>
    <button form="bulk-action-form" id="bulk-action-execute" class="btn" disabled>{% trans 'Execute' %}</button>
</div>
{% include "../generic_confirmation_dialog.html" %}
{% url "pois" as url %}
{% include "pagination.html" with chunk=pois %}
{% endblock %}
