From f77c3c60d44a637b067c285dca6dfc4395f07bc1 Mon Sep 17 00:00:00 2001 From: Dicken Date: Thu, 18 Jun 2026 01:36:32 +0200 Subject: [PATCH] fix: useState Hooks vor Early Return verschieben --- frontend/src/tools/bestellungen.jsx | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/frontend/src/tools/bestellungen.jsx b/frontend/src/tools/bestellungen.jsx index 0cdcaf8..5c32ec3 100644 --- a/frontend/src/tools/bestellungen.jsx +++ b/frontend/src/tools/bestellungen.jsx @@ -45,6 +45,11 @@ function BestellungDetail({ id, toast, onBack }) { const [pickerSearch,setPickerSearch]= useState(''); const [editMode, setEditMode] = useState(false); const [form, setForm] = useState({ name:'', bemerkung:'', custom_price:'', status:'warteliste' }); + const today = () => new Date().toISOString().slice(0,10); + const [bezahltDate, setBezahltDate] = useState(today()); + const [abgeholtDate, setAbgeholtDate] = useState(today()); + const [showBezahltPicker, setShowBezahltPicker] = useState(false); + const [showAbgeholtPicker, setShowAbgeholtPicker] = useState(false); useEffect(() => { api('/tools/kalkulator3d').then(d => setArchiv(d.own || d || [])).catch(()=>{}); @@ -124,12 +129,6 @@ function BestellungDetail({ id, toast, onBack }) { return 'warteliste'; }; - const today = () => new Date().toISOString().slice(0,10); - const [bezahltDate, setBezahltDate] = useState(today()); - const [abgeholtDate, setAbgeholtDate] = useState(today()); - const [showBezahltPicker, setShowBezahltPicker] = useState(false); - const [showAbgeholtPicker, setShowAbgeholtPicker] = useState(false); - function toggleBezahlt() { if (!order.bezahlt) { // Noch nicht bezahlt → Datum-Picker anzeigen