refactor(FE): Set maxSourceQuantity in edit mode using existing data

This commit is contained in:
rstubryan
2026-03-08 16:12:08 +07:00
parent bac6766fa2
commit b6629b0bbb
@@ -478,6 +478,16 @@ const TransferToLayingFormModal = () => {
} }
}, [totalTransferedChicken]); }, [totalTransferedChicken]);
useEffect(() => {
if (
formik.values.flockSourceKandangs.length > 0 &&
formik.values.flockSourceKandangs[0].maxQuantity &&
maxSourceQuantity === 0
) {
setMaxSourceQuantity(formik.values.flockSourceKandangs[0].maxQuantity);
}
}, [formik.values.flockSourceKandangs, maxSourceQuantity]);
return ( return (
<> <>
<Modal <Modal