fix: filter error

This commit is contained in:
2026-02-02 11:03:01 +03:30
parent 6b5276ce36
commit 5fd55c4b10

View File

@@ -42,7 +42,7 @@ export const SubmitTagDistribution = ({ item, getData }: any) => {
? item?.distribution_type === "random"
? "random"
: "group"
: "group"
: "group",
);
const [batches, setBatches] = useState<BatchItem[]>([]);
@@ -116,25 +116,25 @@ export const SubmitTagDistribution = ({ item, getData }: any) => {
showToast(
isEdit ? "ویرایش با موفقیت انجام شد" : "ثبت با موفقیت انجام شد",
"success"
"success",
);
getData();
closeModal();
} catch (error: any) {
showToast(
error?.response?.data?.message || "خطا در ثبت اطلاعات!",
"error"
"error",
);
}
};
const speciesOptions = () => {
return speciesData?.results?.map((opt: any) => {
return {
return (
speciesData?.results?.map((opt: any) => ({
key: opt?.value,
value: opt?.name,
};
});
})) ?? []
);
};
return (
@@ -195,14 +195,14 @@ export const SubmitTagDistribution = ({ item, getData }: any) => {
items?.map((r: any) => {
const existing = batches.find(
(b) =>
b.batch_identity === r.key1 && b.species_code === r.key2
b.batch_identity === r.key1 && b.species_code === r.key2,
);
return {
batch_identity: r.key1,
species_code: r.key2,
count: existing?.count ?? "",
};
}) || []
}) || [],
);
}}
onChangeValue={(labels) => {
@@ -210,7 +210,7 @@ export const SubmitTagDistribution = ({ item, getData }: any) => {
prev.map((item, index) => ({
...item,
label: labels[index],
}))
})),
);
}}
/>
@@ -229,7 +229,7 @@ export const SubmitTagDistribution = ({ item, getData }: any) => {
species_code: k as number,
count: prev?.count ?? "",
};
})
}),
);
}}
title="گونه"
@@ -245,12 +245,12 @@ export const SubmitTagDistribution = ({ item, getData }: any) => {
distributionType === "group"
? `تعداد ${
speciesOptions().find(
(s: any) => s.key === batch.species_code
(s: any) => s.key === batch.species_code,
)?.value
} (${batch.label}) `
: `تعداد ${
speciesOptions().find(
(s: any) => s.key === batch.species_code
(s: any) => s.key === batch.species_code,
)?.value
}`
}
@@ -271,7 +271,7 @@ export const SubmitTagDistribution = ({ item, getData }: any) => {
b.count === "" ||
b.count === undefined ||
b.count === null ||
Number(b.count) <= 0
Number(b.count) <= 0,
)
}
type="submit"