mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-25 15:55:48 +00:00
refactor(FE): Refactor RecordingForm to simplify egg product filtering
This commit is contained in:
@@ -606,7 +606,7 @@ const RecordingForm = ({ type = 'add', initialValues }: RecordingFormProps) => {
|
|||||||
isLoadingOptions: isLoadingEggProducts,
|
isLoadingOptions: isLoadingEggProducts,
|
||||||
loadMore: loadMoreEggProducts,
|
loadMore: loadMoreEggProducts,
|
||||||
} = useSelect(ProductWarehouseApi.basePath, 'id', 'product.name', 'search', {
|
} = useSelect(ProductWarehouseApi.basePath, 'id', 'product.name', 'search', {
|
||||||
search: 'telur',
|
type: 'TELUR',
|
||||||
location_id: eggProductsLocationId,
|
location_id: eggProductsLocationId,
|
||||||
kandang_id: eggProductsKandangId,
|
kandang_id: eggProductsKandangId,
|
||||||
});
|
});
|
||||||
@@ -886,20 +886,10 @@ const RecordingForm = ({ type = 'add', initialValues }: RecordingFormProps) => {
|
|||||||
if (isResponseSuccess(eggProductsData) && selectedKandang) {
|
if (isResponseSuccess(eggProductsData) && selectedKandang) {
|
||||||
const data = eggProductsData.data as unknown as ProductWarehouse[];
|
const data = eggProductsData.data as unknown as ProductWarehouse[];
|
||||||
data.forEach((product) => {
|
data.forEach((product) => {
|
||||||
const productName = product.product.name;
|
options.push({
|
||||||
|
value: product.id,
|
||||||
if (
|
label: product.product.name,
|
||||||
productName.toLowerCase().includes('telur') ||
|
});
|
||||||
productName.toLowerCase().includes('egg') ||
|
|
||||||
productName.toLowerCase().includes('pecah') ||
|
|
||||||
productName.toLowerCase().includes('konsumsi') ||
|
|
||||||
productName.toLowerCase().includes('baik')
|
|
||||||
) {
|
|
||||||
options.push({
|
|
||||||
value: product.id,
|
|
||||||
label: product.product.name,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user