From 8b1546a3054e79847d0a3a35c8341462c8070e4e Mon Sep 17 00:00:00 2001 From: Adnan Zahir Date: Wed, 1 Apr 2026 11:03:56 +0700 Subject: [PATCH 1/2] codex/fix: purchase receivement error and recording doesn't show depletion/egg --- .../production/recording/form/RecordingForm.tsx | 12 ++++++++++++ src/lib/product-warehouse.ts | 6 +++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/components/pages/production/recording/form/RecordingForm.tsx b/src/components/pages/production/recording/form/RecordingForm.tsx index 4595c05c..3a54e77d 100644 --- a/src/components/pages/production/recording/form/RecordingForm.tsx +++ b/src/components/pages/production/recording/form/RecordingForm.tsx @@ -605,7 +605,11 @@ const RecordingForm = ({ type = 'add', initialValues }: RecordingFormProps) => { loadMore: loadMoreStockProducts, } = useSelect(ProductWarehouseApi.basePath, 'id', 'product.name', 'search', { flags: 'PAKAN,OVK', + limit: '100', location_id: stockProductsLocationId, + ...(selectedKandangId + ? { kandang_id: selectedKandangId.toString() } + : {}), }); const { @@ -613,7 +617,11 @@ const RecordingForm = ({ type = 'add', initialValues }: RecordingFormProps) => { isLoadingOptions: isLoadingDepletionProducts, loadMore: loadMoreDepletionProducts, } = useSelect(ProductWarehouseApi.basePath, 'id', 'product.name', '', { + limit: '100', location_id: depletionProductsLocationId, + ...(selectedKandangId + ? { kandang_id: selectedKandangId.toString() } + : {}), type: 'AYAM', }); @@ -678,8 +686,12 @@ const RecordingForm = ({ type = 'add', initialValues }: RecordingFormProps) => { isLoadingOptions: isLoadingEggProducts, loadMore: loadMoreEggProducts, } = useSelect(ProductWarehouseApi.basePath, 'id', 'product.name', 'search', { + limit: '100', type: 'TELUR', location_id: eggProductsLocationId, + ...(selectedKandangId + ? { kandang_id: selectedKandangId.toString() } + : {}), }); const approvedProjectFlockKandangsUrl = useMemo(() => { diff --git a/src/lib/product-warehouse.ts b/src/lib/product-warehouse.ts index bd714223..8e3680da 100644 --- a/src/lib/product-warehouse.ts +++ b/src/lib/product-warehouse.ts @@ -50,7 +50,11 @@ export const isProductWarehouseSelectableForKandang = ( } if (warehouse.type === 'KANDANG') { - return Boolean(kandangId) && warehouse.kandang?.id === kandangId; + return ( + Boolean(kandangId) && + (warehouse.kandang?.id === kandangId || + productWarehouse.project_flock_kandang?.kandang_id === kandangId) + ); } return false; From 3d7a2073b0c32065ece8857767c7820ed2e54209 Mon Sep 17 00:00:00 2001 From: Adnan Zahir Date: Wed, 1 Apr 2026 11:07:05 +0700 Subject: [PATCH 2/2] formatting --- .../production/recording/form/RecordingForm.tsx | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/components/pages/production/recording/form/RecordingForm.tsx b/src/components/pages/production/recording/form/RecordingForm.tsx index 3a54e77d..5190b610 100644 --- a/src/components/pages/production/recording/form/RecordingForm.tsx +++ b/src/components/pages/production/recording/form/RecordingForm.tsx @@ -607,9 +607,7 @@ const RecordingForm = ({ type = 'add', initialValues }: RecordingFormProps) => { flags: 'PAKAN,OVK', limit: '100', location_id: stockProductsLocationId, - ...(selectedKandangId - ? { kandang_id: selectedKandangId.toString() } - : {}), + ...(selectedKandangId ? { kandang_id: selectedKandangId.toString() } : {}), }); const { @@ -619,9 +617,7 @@ const RecordingForm = ({ type = 'add', initialValues }: RecordingFormProps) => { } = useSelect(ProductWarehouseApi.basePath, 'id', 'product.name', '', { limit: '100', location_id: depletionProductsLocationId, - ...(selectedKandangId - ? { kandang_id: selectedKandangId.toString() } - : {}), + ...(selectedKandangId ? { kandang_id: selectedKandangId.toString() } : {}), type: 'AYAM', }); @@ -689,9 +685,7 @@ const RecordingForm = ({ type = 'add', initialValues }: RecordingFormProps) => { limit: '100', type: 'TELUR', location_id: eggProductsLocationId, - ...(selectedKandangId - ? { kandang_id: selectedKandangId.toString() } - : {}), + ...(selectedKandangId ? { kandang_id: selectedKandangId.toString() } : {}), }); const approvedProjectFlockKandangsUrl = useMemo(() => {