fix: refuse deleting a document assigned to a season task
This commit is contained in:
1 parent
4aa2d7a5e6
commit
3116d23199
7 files changed
+271
-14
No files matched your search
@@ -31,6 +31,7 @@
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for document in pagination %}
|
||||
{% set assignments = seasonTaskDocuments[document.id] ?? [] %}
|
||||
<tr>
|
||||
<td>
|
||||
{{ document.displayName ? document.displayName : document.originalFilename }}
|
||||
@@ -38,7 +39,10 @@
|
||||
<td>
|
||||
{# A slot belongs to exactly one document, so this is what tells staff
|
||||
which file a feature actually picks up. #}
|
||||
{{ document.token ? document.token.label() : '-' }}
|
||||
{% 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 }}
|
||||
@@ -51,13 +55,21 @@
|
||||
</td>
|
||||
<td>
|
||||
<div class="flex items-center space-x-2 justify-end">
|
||||
<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>
|
||||
{% 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"
|
||||
|
||||
Reference in new issue
Block a user