mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-20 13:32:00 +00:00
Revert "refactor(FE): Prevent adding recordings for kandangs in transition"
This reverts commit 9dc30c1f58.
This commit is contained in:
@@ -678,31 +678,10 @@ const RecordingForm = ({ type = 'add', initialValues }: RecordingFormProps) => {
|
|||||||
.filter((pfk) => pfk.project_flock_id === selectedProjectFlock.value)
|
.filter((pfk) => pfk.project_flock_id === selectedProjectFlock.value)
|
||||||
.map((pfk) => pfk.kandang_id);
|
.map((pfk) => pfk.kandang_id);
|
||||||
|
|
||||||
const kandangIdsInTransition = new Set<number>();
|
|
||||||
if (isResponseSuccess(existingRecordings) && type === 'add') {
|
|
||||||
existingRecordings.data.forEach((recording: Recording) => {
|
|
||||||
if (recording.project_flock?.project_flock_category === 'GROWING') {
|
|
||||||
const pfKandangId =
|
|
||||||
recording.project_flock?.project_flock_kandang_id;
|
|
||||||
if (pfKandangId) {
|
|
||||||
if (
|
|
||||||
recording.transfer_executed ||
|
|
||||||
!recording.population_can_change
|
|
||||||
) {
|
|
||||||
kandangIdsInTransition.add(pfKandangId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
const kandangOptions = selectedProjectFlockData.kandangs
|
const kandangOptions = selectedProjectFlockData.kandangs
|
||||||
.filter((kandang: Kandang) => {
|
.filter((kandang: Kandang) => {
|
||||||
if (type === 'add') {
|
if (type === 'add') {
|
||||||
return (
|
return approvedKandangIds.includes(kandang.id);
|
||||||
approvedKandangIds.includes(kandang.id) &&
|
|
||||||
!kandangIdsInTransition.has(kandang.id)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
})
|
})
|
||||||
@@ -734,7 +713,6 @@ const RecordingForm = ({ type = 'add', initialValues }: RecordingFormProps) => {
|
|||||||
projectFlockKandangDetail,
|
projectFlockKandangDetail,
|
||||||
type,
|
type,
|
||||||
approvedProjectFlockKandangs,
|
approvedProjectFlockKandangs,
|
||||||
existingRecordings,
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const recordedProjectFlockKandangIds = useMemo(() => {
|
const recordedProjectFlockKandangIds = useMemo(() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user