From b6629b0bbb1d2571af610b0ee618073e0bbedfbe Mon Sep 17 00:00:00 2001 From: rstubryan Date: Sun, 8 Mar 2026 16:12:08 +0700 Subject: [PATCH] refactor(FE): Set maxSourceQuantity in edit mode using existing data --- .../transfer-to-laying/TransferToLayingFormModal.tsx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/components/pages/production/transfer-to-laying/TransferToLayingFormModal.tsx b/src/components/pages/production/transfer-to-laying/TransferToLayingFormModal.tsx index b01a479d..91a56085 100644 --- a/src/components/pages/production/transfer-to-laying/TransferToLayingFormModal.tsx +++ b/src/components/pages/production/transfer-to-laying/TransferToLayingFormModal.tsx @@ -478,6 +478,16 @@ const TransferToLayingFormModal = () => { } }, [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 ( <>