mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-25 15:55:48 +00:00
Compare commits
23 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 22b3350e4a | |||
| a314a62f1f | |||
| 2bf5f36a77 | |||
| 989e30fbed | |||
| 40139cd636 | |||
| 8c03f10043 | |||
| 89a6e51b48 | |||
| f6727dc4dc | |||
| 1284b22345 | |||
| f73ea182ae | |||
| 047266b6d8 | |||
| 6b95edfb72 | |||
| 4b62b02a13 | |||
| 12a50c6100 | |||
| 09537d84d0 | |||
| 1aa2ca9b31 | |||
| c87107b4ee | |||
| 55b13988bf | |||
| 19033278b3 | |||
| 4a6ac8a57d | |||
| 2b9847e1a9 | |||
| 167769a711 | |||
| 417dbba458 |
@@ -233,13 +233,8 @@ const TransferToLayingFormModal = () => {
|
|||||||
|
|
||||||
const [maxSourceQuantity, setMaxSourceQuantity] = useState<number>(0);
|
const [maxSourceQuantity, setMaxSourceQuantity] = useState<number>(0);
|
||||||
|
|
||||||
const selectedFlockDestinationRawData = isResponseSuccess(
|
const [selectedFlockDestinationRawData, setSelectedFlockDestinationRawData] =
|
||||||
flockDestinationRawData
|
useState<ProjectFlock | undefined>(undefined);
|
||||||
)
|
|
||||||
? flockDestinationRawData.data.find(
|
|
||||||
(item) => item.id === formik.values.flockDestination?.value
|
|
||||||
)
|
|
||||||
: undefined;
|
|
||||||
|
|
||||||
const { data: flockSourceKandangsAvailability } = useSWR(
|
const { data: flockSourceKandangsAvailability } = useSWR(
|
||||||
formik.values.flockSource
|
formik.values.flockSource
|
||||||
@@ -456,15 +451,37 @@ const TransferToLayingFormModal = () => {
|
|||||||
}, [transferToLayingId, transferToLaying]);
|
}, [transferToLayingId, transferToLaying]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
if (!formik.values.flockSource) {
|
||||||
|
setSelectedFlockSourceRawData(undefined);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (isResponseSuccess(flockSourceRawData)) {
|
if (isResponseSuccess(flockSourceRawData)) {
|
||||||
const currentSelectedFlockSourceRawData = flockSourceRawData.data.find(
|
const found = flockSourceRawData.data.find(
|
||||||
(item) => item.id === formik.values.flockSource?.value
|
(item) => item.id === formik.values.flockSource?.value
|
||||||
);
|
);
|
||||||
|
if (found) {
|
||||||
setSelectedFlockSourceRawData(currentSelectedFlockSourceRawData);
|
setSelectedFlockSourceRawData(found);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}, [flockSourceRawData, formikFlockSource]);
|
}, [flockSourceRawData, formikFlockSource]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (!formik.values.flockDestination) {
|
||||||
|
setSelectedFlockDestinationRawData(undefined);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isResponseSuccess(flockDestinationRawData)) {
|
||||||
|
const found = flockDestinationRawData.data.find(
|
||||||
|
(item) => item.id === formik.values.flockDestination?.value
|
||||||
|
);
|
||||||
|
if (found) {
|
||||||
|
setSelectedFlockDestinationRawData(found);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, [flockDestinationRawData, formik.values.flockDestination]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
formik.setFieldValue('totalQuantity', totalTransferedChicken);
|
formik.setFieldValue('totalQuantity', totalTransferedChicken);
|
||||||
formik.setFieldValue('maxTotalQuantity', totalTransferedChicken);
|
formik.setFieldValue('maxTotalQuantity', totalTransferedChicken);
|
||||||
|
|||||||
Reference in New Issue
Block a user