feat: enhance bottle metadata with distillation/bottling dates and batch info
This commit is contained in:
@@ -15,6 +15,9 @@ interface EditBottleFormProps {
|
||||
age: number;
|
||||
whiskybase_id: string | null;
|
||||
purchase_price?: number | null;
|
||||
distilled_at?: string | null;
|
||||
bottled_at?: string | null;
|
||||
batch_info?: string | null;
|
||||
};
|
||||
onComplete?: () => void;
|
||||
}
|
||||
@@ -34,6 +37,9 @@ export default function EditBottleForm({ bottle, onComplete }: EditBottleFormPro
|
||||
age: bottle.age || 0,
|
||||
whiskybase_id: bottle.whiskybase_id || '',
|
||||
purchase_price: bottle.purchase_price || '',
|
||||
distilled_at: bottle.distilled_at || '',
|
||||
bottled_at: bottle.bottled_at || '',
|
||||
batch_info: bottle.batch_info || '',
|
||||
});
|
||||
|
||||
const handleDiscover = async () => {
|
||||
@@ -45,7 +51,10 @@ export default function EditBottleForm({ bottle, onComplete }: EditBottleFormPro
|
||||
name: formData.name,
|
||||
distillery: formData.distillery,
|
||||
abv: formData.abv,
|
||||
age: formData.age
|
||||
age: formData.age,
|
||||
distilled_at: formData.distilled_at || undefined,
|
||||
bottled_at: formData.bottled_at || undefined,
|
||||
batch_info: formData.batch_info || undefined,
|
||||
});
|
||||
|
||||
if (result.success && result.id) {
|
||||
@@ -73,6 +82,9 @@ export default function EditBottleForm({ bottle, onComplete }: EditBottleFormPro
|
||||
abv: Number(formData.abv),
|
||||
age: formData.age ? Number(formData.age) : undefined,
|
||||
purchase_price: formData.purchase_price ? Number(formData.purchase_price) : undefined,
|
||||
distilled_at: formData.distilled_at || undefined,
|
||||
bottled_at: formData.bottled_at || undefined,
|
||||
batch_info: formData.batch_info || undefined,
|
||||
});
|
||||
|
||||
if (response.success) {
|
||||
@@ -215,9 +227,7 @@ export default function EditBottleForm({ bottle, onComplete }: EditBottleFormPro
|
||||
)}
|
||||
</div>
|
||||
<div className="space-y-1">
|
||||
<label className="text-[10px] font-black uppercase text-amber-600 ml-1 flex items-center gap-1">
|
||||
<CircleDollarSign size={10} /> Kaufpreis (€)
|
||||
</label>
|
||||
<label className="text-[10px] font-black uppercase text-zinc-400 ml-1">Kaufpreis (€)</label>
|
||||
<input
|
||||
type="number"
|
||||
step="0.01"
|
||||
@@ -227,6 +237,39 @@ export default function EditBottleForm({ bottle, onComplete }: EditBottleFormPro
|
||||
className="w-full px-4 py-2 bg-amber-50 dark:bg-amber-900/10 border border-amber-200 dark:border-amber-900/30 rounded-xl outline-none focus:ring-2 focus:ring-amber-500 font-bold text-amber-700 dark:text-amber-400"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="space-y-1">
|
||||
<label className="text-[10px] font-black uppercase text-zinc-400 ml-1">Destilliert</label>
|
||||
<input
|
||||
type="text"
|
||||
placeholder="z.B. 2010"
|
||||
value={formData.distilled_at}
|
||||
onChange={(e) => setFormData({ ...formData, distilled_at: e.target.value })}
|
||||
className="w-full px-4 py-2 bg-zinc-50 dark:bg-zinc-800 border border-zinc-200 dark:border-zinc-700 rounded-xl outline-none focus:ring-2 focus:ring-amber-500"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="space-y-1">
|
||||
<label className="text-[10px] font-black uppercase text-zinc-400 ml-1">Abgefüllt</label>
|
||||
<input
|
||||
type="text"
|
||||
placeholder="z.B. 2022"
|
||||
value={formData.bottled_at}
|
||||
onChange={(e) => setFormData({ ...formData, bottled_at: e.target.value })}
|
||||
className="w-full px-4 py-2 bg-zinc-50 dark:bg-zinc-800 border border-zinc-200 dark:border-zinc-700 rounded-xl outline-none focus:ring-2 focus:ring-amber-500"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="space-y-1 md:col-span-2">
|
||||
<label className="text-[10px] font-black uppercase text-zinc-400 ml-1">Batch / Code</label>
|
||||
<input
|
||||
type="text"
|
||||
placeholder="z.B. Batch 12 oder L-Code"
|
||||
value={formData.batch_info}
|
||||
onChange={(e) => setFormData({ ...formData, batch_info: e.target.value })}
|
||||
className="w-full px-4 py-2 bg-zinc-50 dark:bg-zinc-800 border border-zinc-200 dark:border-zinc-700 rounded-xl outline-none focus:ring-2 focus:ring-amber-500"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{error && <p className="text-red-500 text-xs italic">{error}</p>}
|
||||
|
||||
Reference in New Issue
Block a user