feat: soft-delete for teamer accounts

addresses #869dv9br3
This commit is contained in:
Björn Fromme
2026-08-11 12:26:13 +02:00
parent 388ecf9603
commit d654ce77fb
45 changed files with 1151 additions and 7 deletions
@@ -1,5 +1,6 @@
{% set assignment = disposition.assignment %}
<span class="whitespace-nowrap">{{ disposition.teamer.fullName(true) }}</span>
{% include '_partials/_teamer_deleted_badge.html.twig' with { 'teamer': disposition.teamer } %}
{% include '_partials/_dot.html.twig' %}
<span class="whitespace-nowrap">{{ assignment.effectivePeriod.start|date('d.m.y') }} - {{ assignment.effectivePeriod.end|date('d.m.y') }}</span>
{% include '_partials/_dot.html.twig' %}
@@ -0,0 +1,6 @@
{% if teamer is not null and teamer.deleted %}
<span class="inline-block py-1 px-2 text-xs bg-gray-500 text-white"
title="Account gelöscht am {{ teamer.deletedAt | date('d.m.Y') }}">
gelöscht
</span>
{% endif %}
@@ -100,6 +100,7 @@
<a href="{{ path('app_administrative_assignment_detail', { 'uuid': assignment.uuid, 'r': return_url() }) }}">
{{ application.teamer }}
</a>
{% include '_partials/_teamer_deleted_badge.html.twig' with { 'teamer': application.teamer } %}
</td>
<td>
<div class="flex items-center justify-end space-x-1"
@@ -0,0 +1,33 @@
{% extends 'htmx_confirmation_modal.html.twig' %}
{% block title %}Account löschen{% endblock %}
{% block content %}
<div class="pb-4">
Möchtest du <em>{{ teamer }}</em> und den zugehörigen Benutzeraccount wirklich löschen?
</div>
<div class="pb-4">
Die Person wird aus allen Listen, Formularen und dem Mailversand ausgeschlossen und kann
sich nicht mehr anmelden. Bestehende Einsätze, Dokumente und Feedbacks bleiben erhalten
und weiterhin sichtbar.
</div>
{% if pendingApplicationCount > 0 or upcomingDispositionCount > 0 %}
<div class="p-4 bg-red-50 border border-red-200 rounded-md">
<div class="font-bold pb-2">Achtung: offene Vorgänge</div>
<ul class="list-disc list-inside">
{% if pendingApplicationCount > 0 %}
<li>{{ pendingApplicationCount }} offene Bewerbung(en)</li>
{% endif %}
{% if upcomingDispositionCount > 0 %}
<li>{{ upcomingDispositionCount }} anstehende(r) Einsatz/Einsätze</li>
{% endif %}
</ul>
<div class="pt-2">
Diese bleiben bestehen, die Person wird darüber aber nicht mehr benachrichtigt.
Sage sie bei Bedarf vorher ab.
</div>
</div>
{% endif %}
{% endblock %}
{% block button_confirm %}Löschen{% endblock %}
@@ -0,0 +1,17 @@
{% extends 'htmx_confirmation_modal.html.twig' %}
{% block title %}Account wiederherstellen{% endblock %}
{% block content %}
<div class="pb-4">
Möchtest du <em>{{ teamer }}</em> und den zugehörigen Benutzeraccount wirklich
wiederherstellen?
</div>
<div>
Die Person erscheint danach wieder in allen Listen und erhält wieder E-Mails. Liegt in
BusPro keine Berechtigung mehr vor, wird der Account bei der nächsten Anmeldung erneut
gesperrt.
</div>
{% endblock %}
{% block button_confirm %}Wiederherstellen{% endblock %}
@@ -48,6 +48,7 @@
hx-target="body"
hx-swap="beforeend">
<span>{{ application.teamer }}</span>
{% include '_partials/_teamer_deleted_badge.html.twig' with { 'teamer': application.teamer } %}
{{ icon('info', 'w-4 h-4') }}
</button>
<twig:RatingStars rating="{{ application.teamer.averageRating }}" />
@@ -155,6 +156,7 @@
hx-target="body"
hx-swap="beforeend">
<span>{{ disposition.teamer }}</span>
{% include '_partials/_teamer_deleted_badge.html.twig' with { 'teamer': disposition.teamer } %}
{{ icon('info', 'w-4 h-4') }}
</button>
<twig:RatingStars rating="{{ disposition.teamer.averageRating }}" />
@@ -83,6 +83,7 @@
</td>
<td>
{{ disposition.teamer }}
{% include '_partials/_teamer_deleted_badge.html.twig' with { 'teamer': disposition.teamer } %}
</td>
<td>
{{ upload.status|upload_status_badge }}
@@ -60,6 +60,7 @@
</td>
<td>
{{ feedback.teamer.firstName }}
{% include '_partials/_teamer_deleted_badge.html.twig' with { 'teamer': feedback.teamer } %}
</td>
<td>
{% if feedback.assignmentDateFrom and feedback.assignmentDateTo %}
@@ -104,7 +104,19 @@
{{ icon('check') }}
</button>
{% endif %}
{% if teamer.user is not null and teamer.user.disabled %}
{% if teamer.deleted %}
{% if is_granted('ROLE_ADMIN') %}
<button type="button"
role="menuitem"
tabindex="-1"
hx-get="{{ path('app_admin_teamer_restore_account', { 'uuid': teamer.uuid }) }}"
hx-target="body"
hx-swap="beforeend"
title="Account wiederherstellen">
{{ icon('refresh') }}
</button>
{% endif %}
{% elseif teamer.user is not null and teamer.user.disabled %}
{% if is_granted('ROLE_ADMIN') %}
<button type="button"
role="menuitem"
@@ -132,11 +144,28 @@
{{ icon('mask') }}
</a>
{% endif %}
{% if is_granted('ROLE_ADMIN') %}
<button type="button"
class="text-red-500"
role="menuitem"
tabindex="-1"
hx-get="{{ path('app_admin_teamer_delete_account', { 'uuid': teamer.uuid }) }}"
hx-target="body"
hx-swap="beforeend"
title="Account löschen">
{{ icon('delete') }}
</button>
{% endif %}
{% endif %}
<a href="{{ path('app_administrative_teamer_profile', { 'uuid': teamer.uuid, 'r': return_url() }) }}" title="Teamer:innenprofil {{ teamer }}">
{{ icon('user') }}
</a>
</div>
{% if teamer.deleted %}
<div class="py-1 px-2 mt-2 text-xs bg-gray-500 text-white">
gel. am {{ teamer.deletedAt | date('d.m.Y') }}
</div>
{% endif %}
{% if teamer.user is not null and teamer.user.disabled %}
<div class="py-1 px-2 mt-2 text-xs bg-red-500 text-white">
gesp. am {{ teamer.user.disabledAt | date('d.m.Y') }}
@@ -14,6 +14,7 @@
{{ form_row(filterForm.driverLicenseVerified) }}
{{ form_row(filterForm.noTrainings) }}
{{ form_row(filterForm.includeInactive) }}
{{ form_row(filterForm.includeDeleted) }}
</div>
<div class="flex items-center space-x-2">
{{ form_widget(filterForm.apply, { 'attr': { 'class': 'btn' } }) }}
+17
View File
@@ -164,6 +164,23 @@
</button>
</div>
</div>
<div class="pt-8 mt-4 border-t border-gray-200">
<h4 class="font-bold pb-2">
Account löschen
</h4>
<div class="pb-2 text-sm">
Du kannst deinen Account löschen. Du wirst danach aus allen Listen
und dem E-Mail-Versand ausgeschlossen und kannst dich nicht mehr
anmelden.
</div>
<button type="button"
class="btn btn--small bg-red-500 text-white"
hx-get="{{ path('app_teamer_profile_delete_account') }}"
hx-target="body"
hx-swap="beforeend">
Account löschen
</button>
</div>
</div>
</div>
@@ -0,0 +1,27 @@
{% extends 'htmx_modal.html.twig' %}
{% block title %}Account löschen{% endblock %}
{% block content %}
{{ form_start(form) }}
<div class="flex flex-col space-y-4 pb-4">
<div>
Wenn du deinen Account löschst, wirst du aus allen Listen, Formularen und dem
E-Mail-Versand ausgeschlossen und kannst dich nicht mehr anmelden.
</div>
<div>
Deine bisherigen Einsätze, Honorarverträge und Honorarnoten bleiben aus rechtlichen
Gründen gespeichert und für das Team weiterhin sichtbar.
</div>
<div>
Wenn du deinen Account später wieder brauchst, wende dich bitte an das Büro. Du
kannst ihn nicht selbst wiederherstellen.
</div>
{{ form_row(form.confirmed) }}
</div>
<button type="submit" class="btn bg-red-500 text-white">
Account löschen
</button>
{{ form_rest(form) }}
{{ form_end(form) }}
{% endblock %}