diff --git a/src/components/pages/production/recording/form/RecordingForm.tsx b/src/components/pages/production/recording/form/RecordingForm.tsx index 274080e3..ff97d1ae 100644 --- a/src/components/pages/production/recording/form/RecordingForm.tsx +++ b/src/components/pages/production/recording/form/RecordingForm.tsx @@ -469,17 +469,24 @@ const RecordingForm = ({ type = 'add', initialValues }: RecordingFormProps) => { // ===== TRANSITION RESTRICTION LOGIC ===== const isTransitionPeriod = useMemo(() => { - return initialValues?.is_transition ?? false; - }, [initialValues]); + return ( + initialValues?.is_transition ?? + projectFlockKandangLookup?.is_transition ?? + false + ); + }, [initialValues, projectFlockKandangLookup]); const recordingRestriction = useMemo(() => { const isLaying = initialValues?.is_laying ?? - (projectFlockKandangLookup?.project_flock?.category === 'LAYING' || - projectFlockKandangDetail?.project_flock?.category === 'LAYING' || - false); + projectFlockKandangLookup?.is_laying ?? + projectFlockKandangDetail?.project_flock?.category === 'LAYING' || + false; - const isTransition = initialValues?.is_transition ?? false; + const isTransition = + initialValues?.is_transition ?? + projectFlockKandangLookup?.is_transition ?? + false; const currentIsLaying = projectFlockKandangDetail?.project_flock?.category === 'LAYING'; @@ -625,9 +632,9 @@ const RecordingForm = ({ type = 'add', initialValues }: RecordingFormProps) => { const isLayingCategory = initialValues?.is_laying ?? - (projectFlockKandangLookup?.project_flock?.category === 'LAYING' || - projectFlockKandangDetail?.project_flock?.category === 'LAYING' || - false); + projectFlockKandangLookup?.is_laying ?? + projectFlockKandangDetail?.project_flock?.category === 'LAYING' || + false; const isGrowingCategory = !isLayingCategory; diff --git a/src/types/api/production/project-flock.d.ts b/src/types/api/production/project-flock.d.ts index 557aebc8..41a6a1c0 100644 --- a/src/types/api/production/project-flock.d.ts +++ b/src/types/api/production/project-flock.d.ts @@ -75,6 +75,7 @@ export type ProjectFlockKandangLookup = { population: number; chick_in_date: string; is_transition: boolean; + is_laying: boolean; }; export type ProjectFlockAvailableQuantity = {