{% extends 'admin_panel/base.html' %}

{% block ap_main_class %} file-manager-list {% endblock %}

{% block breadcrumb_content %}
    <li>{% link_for _("File manager"), request.endpoint %}</li>
{% endblock breadcrumb_content %}

{% block ap_content %}
    <div class="file-manager--manage mb-2" data-module="fm-htmx" data-module-form-id="{{ collection.serializer.form_id }}">
        <button
            type="button"
            class="btn btn-success"
            data-bs-toggle="modal"
            data-bs-target="#upload-file">
            {{ _("Upload file")}}
        </button>
    </div>

    <form action="{{ h.url_for('file_manager.upload') }}" method="POST" id="ap-cron-add" enctype="multipart/form-data">
        {% snippet 'file_manager/upload_file_modal.html' %}
    </form>

    <div class="row g-3">
        {% if collection.data.total %}
            {{ collection.serializer.render() | safe }}
        {% else %}
            <p>
                {{ _("No files found") }}
                <a href="{{ request.path }}">{{ _("Clear the search") }}</a>
            </p>
        {% endif %}
    </div> <!-- row -->
{% endblock ap_content %}


{% block scripts %}
    {% asset 'file_manager/file-manager-js' %}
    {{ super() }}
{% endblock %}
