import InputError from '@/components/input-error'; import LoadingButton from '@/components/loading-button'; import { Button } from '@/components/ui/button'; import { Dialog, DialogClose, DialogContent, DialogFooter, DialogHeader, DialogTitle, DialogTrigger } from '@/components/ui/dialog'; import { Input } from '@/components/ui/input'; import { Label } from '@/components/ui/label'; import { ScrollArea } from '@/components/ui/scroll-area'; import { useLang } from '@/hooks/use-lang'; import { onHandleChange } from '@/lib/inertia'; import { useForm } from '@inertiajs/react'; import { useState } from 'react'; interface Props { title: string; handler: React.ReactNode; } const WithdrawForm = ({ title, handler }: Props) => { const [open, setOpen] = useState(false); const { input, button } = useLang(); const { data, setData, post, errors, processing } = useForm({ amount: '', }); const handleSubmit = (e: React.FormEvent) => { e.preventDefault(); post(route('payouts.store'), { onSuccess: () => setOpen(false), }); }; return ( {handler} {title}
onHandleChange(e, setData)} />
{button.submit}
); }; export default WithdrawForm;