calendar download, date input validate, nc talk notification
This commit is contained in:
@@ -68,7 +68,7 @@ import {
|
||||
} from '@mui/icons-material';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import DashboardLayout from '../components/dashboard/DashboardLayout';
|
||||
import { toGermanDate, toGermanDateTime, fromGermanDate, fromGermanDateTime } from '../utils/dateInput';
|
||||
import { toGermanDate, toGermanDateTime, fromGermanDate, fromGermanDateTime, isValidGermanDate, isValidGermanDateTime } from '../utils/dateInput';
|
||||
import { useAuth } from '../contexts/AuthContext';
|
||||
import { useNotification } from '../contexts/NotificationContext';
|
||||
import { trainingApi } from '../services/training';
|
||||
@@ -1187,6 +1187,27 @@ function VeranstaltungFormDialog({
|
||||
notification.showError('Titel ist erforderlich');
|
||||
return;
|
||||
}
|
||||
|
||||
// Date validation
|
||||
const vonDate = new Date(form.datum_von);
|
||||
const bisDate = new Date(form.datum_bis);
|
||||
if (isNaN(vonDate.getTime())) {
|
||||
notification.showError(`Ungültiges Datum Von (Format: ${form.ganztaegig ? '01.03.2025' : '01.03.2025 18:00'})`);
|
||||
return;
|
||||
}
|
||||
if (isNaN(bisDate.getTime())) {
|
||||
notification.showError(`Ungültiges Datum Bis (Format: ${form.ganztaegig ? '01.03.2025' : '01.03.2025 18:00'})`);
|
||||
return;
|
||||
}
|
||||
if (bisDate < vonDate) {
|
||||
notification.showError('Datum Bis muss nach Datum Von liegen');
|
||||
return;
|
||||
}
|
||||
if (wiederholungAktiv && wiederholungBis && !isValidGermanDate(wiederholungBis)) {
|
||||
notification.showError('Ungültiges Datum für Wiederholung Bis (Format: 01.03.2025)');
|
||||
return;
|
||||
}
|
||||
|
||||
setLoading(true);
|
||||
try {
|
||||
const createPayload: CreateVeranstaltungInput = {
|
||||
@@ -1289,6 +1310,7 @@ function VeranstaltungFormDialog({
|
||||
: fromDatetimeLocal(raw);
|
||||
handleChange('datum_von', iso);
|
||||
}}
|
||||
helperText={form.ganztaegig ? 'Format: 01.03.2025' : 'Format: 01.03.2025 18:00'}
|
||||
InputLabelProps={{ shrink: true }}
|
||||
fullWidth
|
||||
/>
|
||||
@@ -1307,6 +1329,7 @@ function VeranstaltungFormDialog({
|
||||
: fromDatetimeLocal(raw);
|
||||
handleChange('datum_bis', iso);
|
||||
}}
|
||||
helperText={form.ganztaegig ? 'Format: 01.03.2025' : 'Format: 01.03.2025 18:00'}
|
||||
InputLabelProps={{ shrink: true }}
|
||||
fullWidth
|
||||
/>
|
||||
@@ -2190,6 +2213,13 @@ export default function Kalender() {
|
||||
</DialogContent>
|
||||
<DialogActions>
|
||||
<Button onClick={() => setIcalEventOpen(false)}>Schließen</Button>
|
||||
<Button
|
||||
variant="outlined"
|
||||
startIcon={<FileDownloadIcon />}
|
||||
onClick={() => window.open(icalEventUrl, '_blank')}
|
||||
>
|
||||
Herunterladen
|
||||
</Button>
|
||||
</DialogActions>
|
||||
</Dialog>
|
||||
</Box>
|
||||
@@ -2678,6 +2708,13 @@ export default function Kalender() {
|
||||
</DialogContent>
|
||||
<DialogActions>
|
||||
<Button onClick={() => setIcalBookingOpen(false)}>Schließen</Button>
|
||||
<Button
|
||||
variant="outlined"
|
||||
startIcon={<FileDownloadIcon />}
|
||||
onClick={() => window.open(icalBookingUrl, '_blank')}
|
||||
>
|
||||
Herunterladen
|
||||
</Button>
|
||||
</DialogActions>
|
||||
</Dialog>
|
||||
</Box>
|
||||
|
||||
Reference in New Issue
Block a user