This commit is contained in:
Jake Kasper
2025-09-03 17:59:37 -04:00
parent 51e230744c
commit 2ce03628a5

View File

@@ -425,60 +425,6 @@ const AdminProducts = () => {
</div> </div>
)} )}
{/* Seed Blend Editor */}
{formData.productType === 'seed' && (
<div>
<div className="flex items-center justify-between mb-2">
<label className="block text-sm font-medium text-gray-700">Seed Blend (Cultivars + %)</label>
<button
type="button"
onClick={() => setFormData({ ...formData, seedBlend: [...(formData.seedBlend||[]), { cultivar: '', percent: '' }] })}
className="text-sm text-blue-600 hover:text-blue-800"
>
+ Add Cultivar
</button>
</div>
{(formData.seedBlend||[]).length === 0 ? (
<div className="text-sm text-gray-500">No cultivars added yet.</div>
) : (
<div className="space-y-2">
{formData.seedBlend.map((row, idx) => (
<div key={idx} className="grid grid-cols-12 gap-2 items-center">
<input
className="col-span-8 px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"
placeholder="Cultivar name"
value={row.cultivar}
onChange={(e)=> {
const next = [...formData.seedBlend];
next[idx] = { ...next[idx], cultivar: e.target.value };
setFormData({ ...formData, seedBlend: next });
}}
/>
<input
type="number"
step="0.1"
className="col-span-3 px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"
placeholder="%"
value={row.percent}
onChange={(e)=> {
const next = [...formData.seedBlend];
next[idx] = { ...next[idx], percent: e.target.value };
setFormData({ ...formData, seedBlend: next });
}}
/>
<button type="button" className="col-span-1 text-red-600" onClick={()=> {
const next = (formData.seedBlend||[]).filter((_,i)=> i!==idx);
setFormData({ ...formData, seedBlend: next });
}}>Remove</button>
</div>
))}
<div className="text-xs text-gray-600">
Total: {((formData.seedBlend||[]).reduce((s,r)=> s + (parseFloat(r.percent)||0), 0)).toFixed(1)}%
</div>
</div>
)}
</div>
)}
<div> <div>
<label className="block text-sm font-medium text-gray-700 mb-1"> <label className="block text-sm font-medium text-gray-700 mb-1">