2026-05-02 18:33:41 +02:00
|
|
|
import AddEntryForm from '@/components/Transactions/AddEntryForm';
|
2025-07-12 19:59:22 +02:00
|
|
|
import AddMilestoneForm from '@/components/Milestones/AddMilestoneForm';
|
2025-07-13 01:07:16 +02:00
|
|
|
import UpdatePriceForm from '@/components/Pricing/UpdatePriceForm';
|
2025-07-12 19:59:22 +02:00
|
|
|
import { cn } from '@/lib/utils';
|
|
|
|
|
|
|
|
|
|
interface InlineFormProps {
|
2025-07-13 01:07:16 +02:00
|
|
|
type: 'purchase' | 'milestone' | 'price' | null;
|
2026-05-02 18:33:41 +02:00
|
|
|
unit?: string;
|
|
|
|
|
priceTrackingEnabled?: boolean;
|
2025-07-12 19:59:22 +02:00
|
|
|
onClose: () => void;
|
|
|
|
|
onPurchaseSuccess?: () => void;
|
|
|
|
|
onMilestoneSuccess?: () => void;
|
2025-07-13 01:07:16 +02:00
|
|
|
onPriceSuccess?: () => void;
|
2025-07-12 19:59:22 +02:00
|
|
|
className?: string;
|
|
|
|
|
}
|
|
|
|
|
|
2025-07-13 02:10:52 +02:00
|
|
|
export default function InlineForm({
|
|
|
|
|
type,
|
2026-05-02 18:33:41 +02:00
|
|
|
unit = 'units',
|
|
|
|
|
priceTrackingEnabled = false,
|
2025-07-13 02:10:52 +02:00
|
|
|
onClose,
|
2025-07-12 19:59:22 +02:00
|
|
|
onPurchaseSuccess,
|
|
|
|
|
onMilestoneSuccess,
|
2025-07-13 01:07:16 +02:00
|
|
|
onPriceSuccess,
|
2026-05-02 18:33:41 +02:00
|
|
|
className,
|
2025-07-12 19:59:22 +02:00
|
|
|
}: InlineFormProps) {
|
|
|
|
|
if (!type) return null;
|
|
|
|
|
|
|
|
|
|
return (
|
2025-07-13 02:10:52 +02:00
|
|
|
<div
|
2025-07-12 19:59:22 +02:00
|
|
|
className={cn(
|
2026-05-02 18:33:41 +02:00
|
|
|
'bg-black p-8',
|
|
|
|
|
'transition-all duration-300',
|
|
|
|
|
className,
|
2025-07-12 19:59:22 +02:00
|
|
|
)}
|
|
|
|
|
>
|
2025-07-13 04:06:37 +02:00
|
|
|
<div className="w-full border-4 border-red-500 p-2 bg-black space-y-4 glow-red">
|
2025-07-13 02:10:52 +02:00
|
|
|
<div className="flex justify-center">
|
|
|
|
|
{type === 'purchase' ? (
|
2026-05-02 18:33:41 +02:00
|
|
|
<AddEntryForm
|
|
|
|
|
unit={unit}
|
|
|
|
|
priceTrackingEnabled={priceTrackingEnabled}
|
2025-07-13 02:10:52 +02:00
|
|
|
onSuccess={() => {
|
|
|
|
|
if (onPurchaseSuccess) onPurchaseSuccess();
|
|
|
|
|
onClose();
|
|
|
|
|
}}
|
2025-07-13 04:06:37 +02:00
|
|
|
onCancel={onClose}
|
2025-07-13 02:10:52 +02:00
|
|
|
/>
|
|
|
|
|
) : type === 'milestone' ? (
|
|
|
|
|
<AddMilestoneForm
|
|
|
|
|
onSuccess={() => {
|
|
|
|
|
if (onMilestoneSuccess) onMilestoneSuccess();
|
|
|
|
|
onClose();
|
|
|
|
|
}}
|
2025-07-13 04:06:37 +02:00
|
|
|
onCancel={onClose}
|
2025-07-13 02:10:52 +02:00
|
|
|
/>
|
|
|
|
|
) : (
|
|
|
|
|
<UpdatePriceForm
|
|
|
|
|
onSuccess={() => {
|
|
|
|
|
if (onPriceSuccess) onPriceSuccess();
|
|
|
|
|
onClose();
|
|
|
|
|
}}
|
2025-07-13 04:06:37 +02:00
|
|
|
onCancel={onClose}
|
2025-07-13 02:10:52 +02:00
|
|
|
/>
|
|
|
|
|
)}
|
|
|
|
|
</div>
|
2025-07-12 19:59:22 +02:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
2025-07-13 02:10:52 +02:00
|
|
|
}
|