From c93616f09eb5a8c14cf1add7529e19dff64a79ca Mon Sep 17 00:00:00 2001 From: jan Date: Fri, 8 May 2026 17:26:49 +0200 Subject: [PATCH] Freigaberollen in Verwaltung verschieben --- src/components/dashboard/dashboard-shell.tsx | 59 ++++++++------------ 1 file changed, 23 insertions(+), 36 deletions(-) diff --git a/src/components/dashboard/dashboard-shell.tsx b/src/components/dashboard/dashboard-shell.tsx index fed8e84..3ee9ff0 100644 --- a/src/components/dashboard/dashboard-shell.tsx +++ b/src/components/dashboard/dashboard-shell.tsx @@ -18,14 +18,12 @@ import { Button, Card, CardContent, - Checkbox, Chip, Container, Dialog, DialogActions, DialogContent, DialogTitle, - FormControlLabel, IconButton, MenuItem, Stack, @@ -1260,6 +1258,11 @@ export function DashboardShell({ return; } + if (orgaSettingsDraft.requiredApprovalTypes.length === 0) { + setMessage({ type: "error", text: "Bitte mindestens eine Freigaberolle auswählen." }); + return; + } + await runAction(async () => { await parseResponse( await fetch("/api/settings", { @@ -1268,7 +1271,8 @@ export function DashboardShell({ "Content-Type": "application/json" }, body: JSON.stringify({ - approvalThreshold: nextThreshold + approvalThreshold: nextThreshold, + requiredApprovalTypes: orgaSettingsDraft.requiredApprovalTypes }) }) ); @@ -1482,7 +1486,7 @@ export function DashboardShell({ value: ApprovalPermissionValue[], onToggle: (approvalType: ApprovalPermissionValue) => void, helperText: string, - availableApprovalTypes: ApprovalPermissionValue[] + availableApprovalTypes: readonly ApprovalPermissionValue[] ) { return ( @@ -2297,8 +2301,18 @@ export function DashboardShell({ helperText={`Aktuell: ${approvalThreshold.toFixed(2)} EUR`} fullWidth /> + {renderApprovalPermissionSelector( + orgaSettingsDraft.requiredApprovalTypes, + (approvalType) => + setOrgaSettingsDraft((current) => ({ + ...current, + requiredApprovalTypes: toggleApprovalPermission(current.requiredApprovalTypes, approvalType) + })), + "Diese Rollen müssen schwellenpflichtige Ausgaben bestätigen. AG-Mitglieder können nicht freigeben.", + APPROVAL_FLOW + )} @@ -2911,37 +2925,10 @@ export function DashboardShell({ - setIsOrgaSettingsOpen(false)} fullWidth maxWidth="sm"> - Zuständigkeiten & Benachrichtigungen - - - - - Freigaberollen - - - Diese Rollen müssen neue schwellenpflichtige Ausgaben bestätigen. - - - {APPROVAL_FLOW.map((approvalType) => ( - - setOrgaSettingsDraft((current) => ({ - ...current, - requiredApprovalTypes: toggleApprovalPermission(current.requiredApprovalTypes, approvalType) - })) - } - /> - } - label={approvalLabel(approvalType)} - /> - ))} - - + setIsOrgaSettingsOpen(false)} fullWidth maxWidth="sm"> + Zuständigkeiten & Benachrichtigungen + +