bug fix for atemschutz

This commit is contained in:
Matthias Hochmeister
2026-03-01 19:17:36 +01:00
parent d9e6c0658f
commit 2630224edd
5 changed files with 59 additions and 1 deletions

View File

@@ -44,6 +44,7 @@ import DashboardLayout from '../components/dashboard/DashboardLayout';
import { atemschutzApi } from '../services/atemschutz';
import { membersService } from '../services/members';
import { useNotification } from '../contexts/NotificationContext';
import { useAuth } from '../contexts/AuthContext';
import type {
AtemschutzUebersicht,
AtemschutzStats,
@@ -150,6 +151,8 @@ const StatCard: React.FC<StatCardProps> = ({ label, value, color, bgcolor }) =>
function Atemschutz() {
const notification = useNotification();
const { user } = useAuth();
const canWrite = user?.groups?.some(g => ['dashboard_admin', 'dashboard_atemschutz'].includes(g)) ?? false;
// Data state
const [traeger, setTraeger] = useState<AtemschutzUebersicht[]>([]);
@@ -543,6 +546,7 @@ function Atemschutz() {
/>
</TableCell>
<TableCell align="right">
{canWrite && (
<Tooltip title="Bearbeiten">
<Button
size="small"
@@ -552,6 +556,8 @@ function Atemschutz() {
<Edit fontSize="small" />
</Button>
</Tooltip>
)}
{canWrite && (
<Tooltip title="Löschen">
<Button
size="small"
@@ -562,6 +568,7 @@ function Atemschutz() {
<Delete fontSize="small" />
</Button>
</Tooltip>
)}
</TableCell>
</TableRow>
);
@@ -572,6 +579,7 @@ function Atemschutz() {
)}
{/* FAB to create */}
{canWrite && (
<Fab
color="primary"
aria-label="Atemschutzträger hinzufügen"
@@ -580,6 +588,7 @@ function Atemschutz() {
>
<Add />
</Fab>
)}
{/* ── Add / Edit Dialog ───────────────────────────────────────────── */}
<Dialog