{% load filehub %}
{% load static %}
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Filehub</title>

    <link rel="stylesheet" href="https://cdn.hugeicons.com/font/hgi-stroke-rounded.css" />
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.3.3/css/bootstrap.min.css">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/tui-image-editor/3.15.3/tui-image-editor.min.css"/>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jquery-toast-plugin/1.3.2/jquery.toast.min.css">
    <style>
        :root {
            --primary: {{ theme_color }};
            --primary-rgb: {{ theme_color|hex_to_rgb }};
        }
    </style>
    <link rel="stylesheet" href="{% static 'filehub/style.css' %}">
</head>

<body class="filemanager_body {% if select_files == 'true' %}filemanager_select_body{% endif %}">
<div id="filemanager">
    {% include 'filehub/includes/top-header.html' %}

    <div id="filemanage_container" class="row">
        {% include 'filehub/includes/tree.html' %}

        {% with sorting=sorting allowed_exts=allowed_exts %}
            {% include 'filehub/includes/content.html' %}
        {% endwith %}

        <div class="select_files_container d-flex justify-content-between align-items-center flex-wrap py-2">
            <div class="left text-muted ms-3">
                Version: {{ version }}
            </div>

            <div class="middle_part text-muted">
                Copyright 2025 | <a href="https://pypi.org/project/django-filehub/" target="_blank">FileHub</a>
            </div>

            <div class="right me-3">
                <button type="button" class="btn btn-danger btn-sm deleteFiles">Delete Files</button>
                {% if file_picker and select_files == 'true' %}
                    <button type="button" class="btn btn-primary btn-sm selectFilesForEmbed">Select Files</button>
                {% endif %}
            </div>
        </div>
    </div>
</div>

{% include 'filehub/includes/modals.html' %}

<script>
    const FM_REQ_URL = "{% url 'filehub:browser' %}";
    const FM_MEDIA_URL = "{{media_url}}/";
    const FM_SELECT_FILE = {{select_files}};
    const FM_SELECT_MULTIPLE = {{select_multiple}};
    const FM_SELECT_EXTS_ONLY = {{ file_exts|safe }};
    const FM_AUTO_CLOSE_UPLOAD_MODAL = {{ auto_close_upload_modal }};
</script>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.3.3/js/bootstrap.bundle.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vanilla-lazyload@19.1.3/dist/lazyload.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/fabric.js/5.3.1/fabric.min.js"></script>
<script src="https://uicdn.toast.com/tui-color-picker/v2.2.6/tui-color-picker.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/tui-image-editor/3.15.3/tui-image-editor.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-toast-plugin/1.3.2/jquery.toast.min.js"></script>
<script src="{% static 'filehub/main.js' %}"></script>
</body>
</html>
