feat: Allow event owners to delete their own events and admins to delete any event with UI action buttons and confirmation dialog
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
/* Hallmark · pre-emit critique: P5 H5 E5 S5 R5 V5 */
|
||||
/* Hallmark · component: shift-matrix-table · genre: editorial · theme: Atelier (Dark & Light) · studied-DNA: https://inihaus.de */
|
||||
import React from 'react';
|
||||
import { Clock, UserCheck, Shield, Printer, Download, Award, CheckCircle2, UserX, UserPlus, MapPin, Edit3 } from 'lucide-react';
|
||||
import { Clock, UserCheck, Shield, Printer, Download, Award, CheckCircle2, UserX, UserPlus, MapPin, Edit3, Trash2 } from 'lucide-react';
|
||||
|
||||
export default function ShiftMatrixTable({
|
||||
event,
|
||||
@@ -12,7 +12,8 @@ export default function ShiftMatrixTable({
|
||||
onGenerateClaimLink,
|
||||
onExportPdf,
|
||||
onPrintView,
|
||||
onEditEvent
|
||||
onEditEvent,
|
||||
onDeleteEvent
|
||||
}) {
|
||||
if (!event || !event.task_areas || event.task_areas.length === 0) {
|
||||
return (
|
||||
@@ -71,6 +72,15 @@ export default function ShiftMatrixTable({
|
||||
<Edit3 className="w-3.5 h-3.5" /> SCHICHTEN BEARBEITEN
|
||||
</button>
|
||||
)}
|
||||
{user && (user.is_admin_user || user.is_staff || user.is_superuser || event?.created_by === user.id || event?.created_by?.id === user.id) && onDeleteEvent && (
|
||||
<button
|
||||
onClick={() => onDeleteEvent(event)}
|
||||
className="px-3.5 py-1.5 rounded-sm bg-red-500/10 hover:bg-red-500/20 text-red-400 border border-red-500/30 transition flex items-center gap-1.5 font-bold"
|
||||
title="Diese Veranstaltung unwiderruflich löschen"
|
||||
>
|
||||
<Trash2 className="w-3.5 h-3.5" /> LÖSCHEN
|
||||
</button>
|
||||
)}
|
||||
<button
|
||||
onClick={onPrintView}
|
||||
className="px-3.5 py-1.5 rounded-sm bg-surface hover:bg-surface-hover text-main border border-grid transition flex items-center gap-1.5 font-bold"
|
||||
|
||||
Reference in New Issue
Block a user