mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-20 13:32:00 +00:00
refactor(FE): Simplify product filtering logic in RecordingForm
This commit is contained in:
@@ -484,6 +484,7 @@ const RecordingForm = ({ type = 'add', initialValues }: RecordingFormProps) => {
|
|||||||
} = useSelect(ProductWarehouseApi.basePath, 'id', 'product.name', '', {
|
} = useSelect(ProductWarehouseApi.basePath, 'id', 'product.name', '', {
|
||||||
location_id: depletionProductsLocationId,
|
location_id: depletionProductsLocationId,
|
||||||
kandang_id: depletionProductsKandangId,
|
kandang_id: depletionProductsKandangId,
|
||||||
|
type: 'AYAM',
|
||||||
});
|
});
|
||||||
|
|
||||||
const today = new Date().toISOString().split('T')[0];
|
const today = new Date().toISOString().split('T')[0];
|
||||||
@@ -784,18 +785,10 @@ const RecordingForm = ({ type = 'add', initialValues }: RecordingFormProps) => {
|
|||||||
if (isResponseSuccess(depletionProductsData) && selectedKandang) {
|
if (isResponseSuccess(depletionProductsData) && selectedKandang) {
|
||||||
const data = depletionProductsData.data as unknown as ProductWarehouse[];
|
const data = depletionProductsData.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('culling') ||
|
});
|
||||||
productName.toLowerCase().includes('mati') ||
|
|
||||||
productName.toLowerCase().includes('afkir')
|
|
||||||
) {
|
|
||||||
options.push({
|
|
||||||
value: product.id,
|
|
||||||
label: product.product.name,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user