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({
flags: 'PAKAN,OVK',
search: '',
limit: '100',
location_id: selectedLocation.value.toString(),
});
return `${ProductWarehouseApi.basePath}?${params.toString()}`;
@@ -220,6 +221,7 @@ const RecordingForm = ({ type = 'add', initialValues }: RecordingFormProps) => {
if (!selectedLocation) return null;
const params = new URLSearchParams({
search: '',
limit: '100',
location_id: selectedLocation.value.toString(),
});
return `${ProductWarehouseApi.basePath}?${params.toString()}`;
@@ -244,10 +246,9 @@ const RecordingForm = ({ type = 'add', initialValues }: RecordingFormProps) => {
useSWR(depletionProductsUrl, ProductWarehouseApi.getAllFetcher);
const eggProductsUrl = useMemo(() => {
if (!selectedLocation) return null;
const params = new URLSearchParams({
search: '',
location_id: selectedLocation.value.toString(),
search: 'telur',
limit: '100',
});
return `${ProductWarehouseApi.basePath}?${params.toString()}`;
}, [selectedLocation]);
@@ -462,7 +463,10 @@ const RecordingForm = ({ type = 'add', initialValues }: RecordingFormProps) => {
if (
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({
value: product.id,