"use client"; import { useState } from "react"; import { Card, CardHeader, CardTitle, CardContent, CardDescription } from "@/components/ui/card"; import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; import { Label } from "@/components/ui/label"; import { Upload, Plus, Loader2, } from "lucide-react"; import { submitReimbursement } from "@/app/lib/actions"; export function ReimbursementForm() { const [showForm, setShowForm] = useState(false); const [isSubmitting, setIsSubmitting] = useState(false); async function handleSubmit(formData: FormData) { setIsSubmitting(true); try { await submitReimbursement(formData); setShowForm(false); alert("Claim submitted successfully!"); } catch (e) { alert("Failed to submit claim."); } finally { setIsSubmitting(false); } } return ( <> setShowForm(!showForm)} className="bg-indigo-600 hover:bg-indigo-700 text-white rounded-2xl px-6 py-6 h-auto shadow-lg shadow-indigo-200 dark:shadow-none transition-all active:scale-95" > {showForm ? "Cancel Request" : ( New Request )} {showForm && ( Submit New Request Fill in the details and attach your receipt Description Amount ($) Category Travel Food Equipment Medical Other Transaction Date Receipt Image / PDF Click to upload or drag and drop PNG, JPG or PDF up to 10MB {isSubmitting ? : "Submit Claim"} )} > ); }
Click to upload or drag and drop
PNG, JPG or PDF up to 10MB