Files
myep-team/templates/administrative/system/document/index.html.twig
T

111 lines
5.0 KiB
Twig

{% extends 'administrative/layout.html.twig' %}
{% block title %}Dokumentenübersicht{% endblock %}
{% block content %}
<h1 class="text-2xl font-bold pb-8">
Dokumentenübersicht
</h1>
<div class="data-table-wrapper">
<div class="data-table-wrapper__inner">
<table class="data-table">
<thead>
<tr>
<th>
{{ knp_pagination_sortable(pagination, 'Dateiname', 'upload.originalFilename') }}
</th>
<th>
Verwendung
</th>
<th>
Dateigröße
</th>
<th>
Upload am
</th>
<th>
Upload von
</th>
<th></th>
</tr>
</thead>
<tbody>
{% for document in pagination %}
{% set assignments = seasonTaskDocuments[document.id] ?? [] %}
<tr>
<td>
{{ document.displayName ? document.displayName : document.originalFilename }}
</td>
<td>
{# A slot belongs to exactly one document, so this is what tells staff
which file a feature actually picks up. #}
{% set usages = (document.token ? [document.token.label()] : [])|merge(
assignments|filter(a => a.task)|map(a => 'Saisonteam: ' ~ a.task.label())
) %}
{{ usages is empty ? '-' : usages|join(', ') }}
</td>
<td>
{{ document.size|file_size }}
</td>
<td>
{{ document.createdAt|date('d.m.Y') }}
</td>
<td>
{{ document.createdBy }}
</td>
<td>
<div class="flex items-center space-x-2 justify-end">
{% if assignments is empty %}
<button type="button"
class="text-red-500"
hx-get="{{ path('app_administrative_system_document_delete', { 'uuid': document.uuid }) }}"
hx-target="body"
hx-swap="beforeend">
{{ icon('delete') }}
</button>
{% else %}
{# Held by a NOT NULL foreign key; replace it under Saisonteam-Dokumente first. #}
<span class="text-gray-300 cursor-not-allowed"
title="Als Saisonteam-Dokument hinterlegt, kann nicht gelöscht werden">
{{ icon('delete') }}
</span>
{% endif %}
<button type="button"
hx-get="{{ path('app_administrative_system_document_replace', { 'uuid': document.uuid }) }}"
hx-target="body"
hx-swap="beforeend">
{{ icon('refresh') }}
</button>
<button type="button"
hx-get="{{ path('app_administrative_system_document_edit', { 'uuid': document.uuid }) }}"
hx-target="body"
hx-swap="beforeend">
{{ icon('edit') }}
</button>
<a href="{{ path('app_common_download', { 'uuid': document.uuid }) }}"
title="Download">
{{ icon('download') }}
</a>
</div>
</td>
</tr>
{% else %}
<tr>
<td colspan="6">
Keine Daten...
</td>
</tr>
{% endfor %}
</tbody>
</table>
{{ knp_pagination_render(pagination) }}
</div>
</div>
<button type="button"
class="btn"
hx-get="{{ path('app_administrative_system_document_upload') }}"
hx-target="body"
hx-swap="beforeend">
Dokumente hinzufügen
</button>
{% endblock %}