refactor(FE): Simplify product filtering logic in RecordingForm

This commit is contained in:
rstubryan
2026-02-15 08:47:07 +07:00
parent b6edd8f10c
commit e8e4f7b877
@@ -484,6 +484,7 @@ const RecordingForm = ({ type = 'add', initialValues }: RecordingFormProps) => {
} = useSelect(ProductWarehouseApi.basePath, 'id', 'product.name', '', {
location_id: depletionProductsLocationId,
kandang_id: depletionProductsKandangId,
type: 'AYAM',
});
const today = new Date().toISOString().split('T')[0];
@@ -784,18 +785,10 @@ const RecordingForm = ({ type = 'add', initialValues }: RecordingFormProps) => {
if (isResponseSuccess(depletionProductsData) && selectedKandang) {
const data = depletionProductsData.data as unknown as ProductWarehouse[];
data.forEach((product) => {
const productName = product.product.name;
if (
productName.toLowerCase().includes('culling') ||
productName.toLowerCase().includes('mati') ||
productName.toLowerCase().includes('afkir')
) {
options.push({
value: product.id,
label: product.product.name,
});
}
options.push({
value: product.id,
label: product.product.name,
});
});
}