Freigaberollen in Verwaltung verschieben
All checks were successful
CI / Build and Deploy (push) Successful in 3m8s

This commit is contained in:
jan
2026-05-08 17:26:49 +02:00
parent 57d1e9247b
commit c93616f09e

View File

@@ -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 (
<Stack spacing={1}>
@@ -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
)}
<Button type="button" variant="outlined" disabled={busy} onClick={handleSaveApprovalThreshold}>
Schwelle speichern
Schwelle und Freigaberollen speichern
</Button>
</Stack>
</CardContent>
@@ -2911,37 +2925,10 @@ export function DashboardShell({
</Container>
</Box>
<Dialog open={isOrgaSettingsOpen} onClose={() => setIsOrgaSettingsOpen(false)} fullWidth maxWidth="sm">
<DialogTitle>Zuständigkeiten & Benachrichtigungen</DialogTitle>
<DialogContent>
<Stack spacing={2.5} sx={{ pt: 1 }}>
<Box>
<Typography variant="subtitle1" sx={{ fontWeight: 700 }}>
Freigaberollen
</Typography>
<Typography variant="body2" color="text.secondary">
Diese Rollen müssen neue schwellenpflichtige Ausgaben bestätigen.
</Typography>
<Stack spacing={0.5} sx={{ mt: 1 }}>
{APPROVAL_FLOW.map((approvalType) => (
<FormControlLabel
key={approvalType}
control={
<Checkbox
checked={orgaSettingsDraft.requiredApprovalTypes.includes(approvalType)}
onChange={() =>
setOrgaSettingsDraft((current) => ({
...current,
requiredApprovalTypes: toggleApprovalPermission(current.requiredApprovalTypes, approvalType)
}))
}
/>
}
label={approvalLabel(approvalType)}
/>
))}
</Stack>
</Box>
<Dialog open={isOrgaSettingsOpen} onClose={() => setIsOrgaSettingsOpen(false)} fullWidth maxWidth="sm">
<DialogTitle>Zuständigkeiten & Benachrichtigungen</DialogTitle>
<DialogContent>
<Stack spacing={2.5} sx={{ pt: 1 }}>
<TextField
select
label="Budgetfreigabe-Push"