diff --git a/shop/components/order-wizard.tsx b/shop/components/order-wizard.tsx index 9e7ceeb..ccf269c 100644 --- a/shop/components/order-wizard.tsx +++ b/shop/components/order-wizard.tsx @@ -149,6 +149,14 @@ export function OrderWizard({ }) const [deviceName, setDeviceName] = useState('') const [editingIdx, setEditingIdx] = useState(null) + const [toast, setToast] = useState<{ message: string; type: 'error' | 'success' } | null>(null) + + useEffect(() => { + if (toast) { + const timer = setTimeout(() => setToast(null), 5000) + return () => clearTimeout(timer) + } + }, [toast]) // Partner-Profil (Fallback) const [customerData] = useState>(initialProfile || {}) @@ -602,7 +610,7 @@ export function OrderWizard({ bank_iban: '', bank_bic: '', bank_name: '', bank_owner: '', }) } catch (e: any) { - alert(`Fehler beim Anlegen des Kunden: ${e.message || 'Unbekannter Fehler'}`) + setToast({ message: `Fehler beim Anlegen des Kunden: ${e.message || 'Unbekannter Fehler'}`, type: 'error' }) } finally { setIsCreatingCustomer(false) } @@ -723,7 +731,7 @@ export function OrderWizard({ } } catch (error: any) { console.error(error) - alert(error?.message || 'Fehler bei der Bestellung. Bitte versuchen Sie es erneut.') + setToast({ message: error?.message || 'Fehler bei der Bestellung. Bitte versuchen Sie es erneut.', type: 'error' }) setIsSubmitting(false) } } @@ -1804,6 +1812,33 @@ export function OrderWizard({ )} + + {/* Custom Toast Notification */} + + {toast && ( + + +

{toast.message}

+ +
+ )} +
) }