diff --git a/resources/js/components/Display/InlineForm.tsx b/resources/js/components/Display/InlineForm.tsx index 1254e81..1536d83 100644 --- a/resources/js/components/Display/InlineForm.tsx +++ b/resources/js/components/Display/InlineForm.tsx @@ -3,14 +3,14 @@ import AddMilestoneForm from '@/components/Milestones/AddMilestoneForm'; import UpdatePriceForm from '@/components/Pricing/UpdatePriceForm'; import { cn } from '@/lib/utils'; +type FormType = 'purchase' | 'milestone' | 'price'; + interface InlineFormProps { - type: 'purchase' | 'milestone' | 'price' | null; + type: FormType | null; unit?: string; priceTrackingEnabled?: boolean; onClose: () => void; - onPurchaseSuccess?: () => void; - onMilestoneSuccess?: () => void; - onPriceSuccess?: () => void; + onSuccess?: (type: FormType) => void; className?: string; } @@ -19,13 +19,16 @@ export default function InlineForm({ unit = 'units', priceTrackingEnabled = false, onClose, - onPurchaseSuccess, - onMilestoneSuccess, - onPriceSuccess, + onSuccess, className, }: InlineFormProps) { if (!type) return null; + const handleSuccess = () => { + if (onSuccess) onSuccess(type); + onClose(); + }; + return (