From 5ca594fdc738f8ac7eeacb298cc40f2e8f270d8e Mon Sep 17 00:00:00 2001 From: jason Date: Thu, 12 Mar 2026 07:21:44 -0500 Subject: [PATCH] external dogs --- client/src/components/DogForm.jsx | 60 +++++++++++++++---------------- 1 file changed, 29 insertions(+), 31 deletions(-) diff --git a/client/src/components/DogForm.jsx b/client/src/components/DogForm.jsx index 34a2b20..3eac5be 100644 --- a/client/src/components/DogForm.jsx +++ b/client/src/components/DogForm.jsx @@ -29,8 +29,8 @@ function DogForm({ dog, onClose, onSave, isExternal = false }) { const effectiveExternal = isExternal || (dog && dog.is_external) useEffect(() => { + fetchDogs() if (!effectiveExternal) { - fetchDogs() fetchLitters() } if (dog) { @@ -55,7 +55,7 @@ function DogForm({ dog, onClose, onSave, isExternal = false }) { const fetchDogs = async () => { try { - const res = await axios.get('/api/dogs') + const res = await axios.get('/api/dogs/all') setDogs(res.data || []) } catch (e) { setDogs([]) @@ -112,8 +112,8 @@ function DogForm({ dog, onClose, onSave, isExternal = false }) { ...formData, is_champion: formData.is_champion ? 1 : 0, is_external: effectiveExternal ? 1 : 0, - sire_id: effectiveExternal ? null : (formData.sire_id || null), - dam_id: effectiveExternal ? null : (formData.dam_id || null), + sire_id: formData.sire_id || null, + dam_id: formData.dam_id || null, litter_id: (effectiveExternal || useManualParents) ? null : (formData.litter_id || null), registration_number: formData.registration_number || null, birth_date: formData.birth_date || null, @@ -162,7 +162,7 @@ function DogForm({ dog, onClose, onSave, isExternal = false }) { gap: '0.5rem', }}> - External dog — not part of your kennel roster. Litter and parent fields are not applicable. + External dog — not part of your kennel roster. )} @@ -250,32 +250,31 @@ function DogForm({ dog, onClose, onSave, isExternal = false }) { - {/* Parent Section — hidden for external dogs */} - {!effectiveExternal && ( -
- + {/* Parent Section */} +
+ - {littersAvailable && ( -
- - -
- )} + {!effectiveExternal && littersAvailable && ( +
+ + +
+ )} - {!useManualParents && littersAvailable ? ( + {!useManualParents && littersAvailable && !effectiveExternal ? (