reoccurring event fix

This commit is contained in:
Matthias Hochmeister
2026-03-25 15:22:31 +01:00
parent 51d8777d66
commit e49639e2a6
2 changed files with 22 additions and 11 deletions

View File

@@ -1634,13 +1634,13 @@ function VeranstaltungFormDialog({
/> />
)} )}
{/* Wiederholung */} {/* Wiederholung */}
{(!editingEvent || (editingEvent && editingEvent.wiederholung)) && ( {(!editingEvent || editingEvent.wiederholung || editingEvent.wiederholung_parent_id) && (
<> <>
<Divider /> <Divider />
{editingEvent && editingEvent.wiederholung && editingEvent.wiederholung_parent_id ? ( {editingEvent?.wiederholung_parent_id ? (
<> <>
<Typography variant="body2" color="text.secondary" sx={{ fontStyle: 'italic' }}> <Typography variant="body2" color="text.secondary" sx={{ fontStyle: 'italic' }}>
Wiederholung kann nicht bearbeitet werden (Einzeltermin einer Serie) Dieser Termin ist Teil einer Serienveranstaltung. Änderungen betreffen nur diesen Einzeltermin.
</Typography> </Typography>
<FormControlLabel <FormControlLabel
control={<Switch checked disabled />} control={<Switch checked disabled />}
@@ -1652,7 +1652,14 @@ function VeranstaltungFormDialog({
control={ control={
<Switch <Switch
checked={wiederholungAktiv} checked={wiederholungAktiv}
onChange={(e) => setWiederholungAktiv(e.target.checked)} onChange={(e) => {
setWiederholungAktiv(e.target.checked);
if (e.target.checked && !wiederholungBis) {
const bisDefault = new Date(form.datum_von);
bisDefault.setMonth(bisDefault.getMonth() + 3);
setWiederholungBis(bisDefault.toISOString().slice(0, 10));
}
}}
/> />
} }
label="Wiederkehrende Veranstaltung" label="Wiederkehrende Veranstaltung"

View File

@@ -928,16 +928,20 @@ function EventFormDialog({
fullWidth fullWidth
/> />
{/* Recurrence / Wiederholung — for new events or when editing a parent event */} {/* Recurrence / Wiederholung — for new events, parent events, or child events */}
{(!editingEvent || (editingEvent.wiederholung && !editingEvent.wiederholung_parent_id)) && ( {(!editingEvent || editingEvent.wiederholung || editingEvent.wiederholung_parent_id) && (
<> <>
<Divider /> <Divider />
{editingEvent && ( {editingEvent?.wiederholung_parent_id ? (
<Typography variant="body2" color="text.secondary" sx={{ fontStyle: 'italic' }}>
Dieser Termin ist Teil einer Serienveranstaltung. Änderungen betreffen nur diesen Einzeltermin.
</Typography>
) : editingEvent?.wiederholung ? (
<Typography variant="caption" color="text.secondary"> <Typography variant="caption" color="text.secondary">
Änderungen an der Wiederholung werden alle bestehenden Instanzen löschen und neu generieren. Änderungen an der Wiederholung werden alle bestehenden Instanzen löschen und neu generieren.
</Typography> </Typography>
)} ) : null}
<FormControlLabel {!editingEvent?.wiederholung_parent_id && <FormControlLabel
control={ control={
<Switch <Switch
checked={Boolean(form.wiederholung)} checked={Boolean(form.wiederholung)}
@@ -957,8 +961,8 @@ function EventFormDialog({
/> />
} }
label="Wiederholung" label="Wiederholung"
/> />}
{form.wiederholung && ( {!editingEvent?.wiederholung_parent_id && form.wiederholung && (
<Stack spacing={2} sx={{ pl: 2 }}> <Stack spacing={2} sx={{ pl: 2 }}>
<FormControl fullWidth size="small"> <FormControl fullWidth size="small">
<InputLabel>Häufigkeit</InputLabel> <InputLabel>Häufigkeit</InputLabel>