feat(FE-170,175): enhance product fetching in RecordingForm with additional filters and limits

This commit is contained in:
rstubryan
2025-11-06 14:26:45 +07:00
parent 06eec88d56
commit 62c595bdf6
@@ -211,6 +211,7 @@ const RecordingForm = ({ type = 'add', initialValues }: RecordingFormProps) => {
const params = new URLSearchParams({ const params = new URLSearchParams({
flags: 'PAKAN,OVK', flags: 'PAKAN,OVK',
search: '', search: '',
limit: '100',
location_id: selectedLocation.value.toString(), location_id: selectedLocation.value.toString(),
}); });
return `${ProductWarehouseApi.basePath}?${params.toString()}`; return `${ProductWarehouseApi.basePath}?${params.toString()}`;
@@ -220,6 +221,7 @@ const RecordingForm = ({ type = 'add', initialValues }: RecordingFormProps) => {
if (!selectedLocation) return null; if (!selectedLocation) return null;
const params = new URLSearchParams({ const params = new URLSearchParams({
search: '', search: '',
limit: '100',
location_id: selectedLocation.value.toString(), location_id: selectedLocation.value.toString(),
}); });
return `${ProductWarehouseApi.basePath}?${params.toString()}`; return `${ProductWarehouseApi.basePath}?${params.toString()}`;
@@ -244,10 +246,9 @@ const RecordingForm = ({ type = 'add', initialValues }: RecordingFormProps) => {
useSWR(depletionProductsUrl, ProductWarehouseApi.getAllFetcher); useSWR(depletionProductsUrl, ProductWarehouseApi.getAllFetcher);
const eggProductsUrl = useMemo(() => { const eggProductsUrl = useMemo(() => {
if (!selectedLocation) return null;
const params = new URLSearchParams({ const params = new URLSearchParams({
search: '', search: 'telur',
location_id: selectedLocation.value.toString(), limit: '100',
}); });
return `${ProductWarehouseApi.basePath}?${params.toString()}`; return `${ProductWarehouseApi.basePath}?${params.toString()}`;
}, [selectedLocation]); }, [selectedLocation]);
@@ -462,7 +463,10 @@ const RecordingForm = ({ type = 'add', initialValues }: RecordingFormProps) => {
if ( if (
productName.toLowerCase().includes('telur') || productName.toLowerCase().includes('telur') ||
productName.toLowerCase().includes('egg') productName.toLowerCase().includes('egg') ||
productName.toLowerCase().includes('pecah') ||
productName.toLowerCase().includes('konsumsi') ||
productName.toLowerCase().includes('baik')
) { ) {
options.push({ options.push({
value: product.id, value: product.id,