2024-12-28 01:10:25 +01:00
{% extends 'base.html.twig' %}
{% block title %} Dashboard {% endblock %}
{% block body %}
<div class="container mx-auto px-16">
2024-12-28 13:10:57 +01:00
<h1 class="text-center text-2xl font-bold mt-4">Liste des fichiers</h1>
2024-12-29 16:00:42 +01:00
<div class="mt-4">
{{ include ( 'partials/alerts.html.twig' ) }}
</div>
2025-01-26 14:10:11 +01:00
{% if parentDir == null or ( parentDir != null and is_granted ( 'file_write' , parentDir ) ) %}
2025-01-11 19:25:42 +01:00
<div class="flex justify-end">
<a href=" {{ path ( 'app_files_create_directory' , {
base: path
}) }}" class="text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 me-2 mb-2 dark:bg-blue-600 dark:hover:bg-blue-700 focus:outline-none dark:focus:ring-blue-800">Créer un dossier</a>
2025-01-22 20:11:29 +01:00
{% if path != '' %}
2025-01-11 19:52:25 +01:00
<a href=" {{ path ( 'app_files_upload' , {
path: path
}) }}" class="text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 me-2 mb-2 dark:bg-blue-600 dark:hover:bg-blue-700 focus:outline-none dark:focus:ring-blue-800">Ajouter des fichiers</a>
2025-01-22 20:11:29 +01:00
{% endif %}
2025-01-11 19:25:42 +01:00
</div>
2025-01-26 14:10:11 +01:00
{% endif %}
2024-12-28 13:10:57 +01:00
<div class="mt-4">
{% include 'partials/breadbrumb.html.twig' %}
</div>
<div class="relative overflow-x-auto mt-4">
<table class="w-full text-sm text-left rtl:text-right text-gray-500 dark:text-gray-400">
<thead class="text-xs text-gray-700 uppercase bg-gray-50 dark:bg-gray-700 dark:text-gray-400">
<tr>
<th scope="col" class="px-6 py-3">
Nom
</th>
<th scope="col" class="px-6 py-3">
Taille
</th>
<th scope="col" class="px-6 py-3">
Modifié le
</th>
<th scope="col" class="px-6 py-3">
2025-02-05 23:08:55 +01:00
Actions
2024-12-28 13:10:57 +01:00
</th>
</tr>
</thead>
<tbody>
{% for file in files %}
<tr class="bg-white border-b dark:bg-gray-800 dark:border-gray-700">
<th class="px-6 py-4 font-medium light:text-gray-900 whitespace-nowrap flex gap-2">
{% if file .type == 'file' %}
<twig:ux:icon name="line-md:file-filled" class="w-6 h-6" />
{% else %}
<twig:ux:icon name="line-md:folder-filled" class="w-6 h-6" />
{% endif %}
<a class="text-blue-700 dark:text-blue-500 hover:text-blue-900 dark:hover:text-blue-700" href=" {{ file .url }} "> {{ file .path | basename }} </a>
</th>
<td class="px-6 py-4">
{% if file .type == 'file' %}
{{ file .size | show_size }}
{% endif %}
</td>
<td class="px-6 py-4">
{{ file .last_modified | time_diff }}
</td>
<td class="px-6 py-4 flex gap-2 light:text-black">
{% if file .type == 'file' %}
2025-01-11 19:25:42 +01:00
<a title="Permet de télécharger le fichier" href=" {{ file .url }} " class="hover:text-blue-700 duration-300"><twig:ux:icon class="w-6 h-6" name="fa6-solid:download" /></a>
2025-01-26 14:10:11 +01:00
{% if is_granted ( 'file_write' , parentDir ) %}
2025-01-11 19:25:42 +01:00
<a title="Permet de renommer le fichier" href=" {{ path ( 'app_files_rename' , {
path: file.path
}) }}" class="hover:text-blue-700 duration-300"><twig:ux:icon class="w-6 h-6" name="fa6-solid:pencil" /></a>
<a title="Permet de supprimer le fichier" href=" {{
2025-01-11 18:23:21 +01:00
path('app_files_delete', {
filename: file.path
})
}}" class="hover:text-red-700 duration-300"><twig:ux:icon class="w-6 h-6" name="fa6-solid:trash-can" /></a>
2025-01-26 14:10:11 +01:00
{% endif %}
2024-12-28 13:10:57 +01:00
{% else %}
2025-01-26 14:10:11 +01:00
{% if parentDir == null %}
{% set parentDirectory = get_parent_dir ( file .path ) %}
{% else %}
{% set parentDirectory = parentDir %}
{% endif %}
2025-01-26 15:18:22 +01:00
{% if parentDir == null and ( parentDirectory .userCreated == app .user or ( parentDirectory .isPublic and app .user .folderRole == enum ( 'App\\Enum\\RoleEnum' ) . C O N S E I L _ADMINISTRATION ) ) %}
<a href=" {{ path ( 'app_files_file_edit_permission' , {
parentDir: parentDirectory.name,
2025-02-05 23:08:55 +01:00
}) }}" class="hover:text-blue-700 duration-300" title="Permet de modifier les permissions du dossier"><twig:ux:icon class="w-6 h-6" name="fa6-solid:shield" /></a>
2025-01-26 15:18:22 +01:00
{% endif %}
2025-01-26 14:10:11 +01:00
{% if is_granted ( 'file_write' , parentDirectory ) %}
2025-01-11 19:25:42 +01:00
<a href=" {{ path ( 'app_files_rename-directory' , {
path: file.path
}) }}" class="hover:text-blue-700 duration-300" title="Permet de renommer le dossier"><twig:ux:icon class="w-6 h-6" name="fa6-solid:pencil" /></a>
2025-01-11 18:23:21 +01:00
<a href=" {{ path ( 'app_files_delete_directory' , {
path: file.path
2025-01-11 19:25:42 +01:00
}) }}" class="hover:text-red-700 duration-300" title="Permet de supprimer le dossier"><twig:ux:icon class="w-6 h-6" name="fa6-solid:trash-can" /></a>
2025-01-26 14:10:11 +01:00
{% endif %}
2024-12-28 13:10:57 +01:00
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
2024-12-28 01:10:25 +01:00
</div>
{% endblock %}