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

{% block main %}
    <h3>{{ msg.title }}</em></h3>
    <div class="toolbar">
        {% if write %}
            <span class="toolbar-item">
                <button class="toolbar-button" href="{#{ 'create_dir' }#}">
                    <img src="{{ asset('icons/mkdir.svg') }}" width="32" height="32" alt="create-icon"/>
                </button>
            </span>
            <span class="toolbar-item">
                <button class="toolbar-button" href="{#{ 'upload_file' }#}">
                    <img alt="upload-icon"  width="32" height="32" src="{{ asset('icons/upload.svg') }}"/>
                </button>
            </span>
        {% endif %}
    </div>
    <table class="full-width"><!-- Directory Index -->
        <tr>
            <th class="td-color shrink-to-fit"><a href="{{ sort_url.type }}"><img class="list-icon icon-empty" alt="[icon]" /></a></th>
            <th class="td-color fullwidth left"><a href="{{ sort_url.name }}">{{ msg.filename }}</a></th>
            <th class="td-color shrink-to-fit left"></th>
            <th class="td-color left"><a href="{{ sort_url.size }}">{{ msg.filesize }}</a></th>
            <th class="td-color left"><a href="{{ sort_url.date }}">{{ msg.mtime }}</a></th>
            
        </tr>
        <tr><td colspan="5"><strong><hr></strong></td></tr>
        {% if parent_url %}
            <tr>
                <td><img class="list-icon icon-back" alt="[icon]"/></td>
                <td><a href="{{ parent_url }}">Back</a></td>
                <td><img class="list-icon icon-empty" alt="[icon]"/></td>
                <td>-</td>
                <td>-</td>
                <td>-</td>
                
            </tr>
        {% endif %}
        {% for entry in dir_entries %}
            <tr>
                <td><img class="list-icon {{ entry.icon }}" alt="[icon]" width="24" height="24" /></td>
                <td><a href="{{ entry.href }}">{{ entry.name }}</a></td>
                <td>
                    {% if entry.delete %}
                        <a href="{{ entry.delete }}"<img class="list-icon icon-delete" alt="[icon]" /></a>
                    {% else %}
                        <img class="list-icon icon-empty" alt="[icon]" />
                    {% endif %}
                </td>
                <td class="shrink-to-fit">{{ entry.display_size }}</td>
                <td class="shrink-to-fit">{{ entry.display_mtime }}</td>
            </tr>
        {% endfor %}
        <tr><td colspan="5"><strong><hr></strong></td></tr>
    </table>
{% endblock %}

