diff --git a/apps/st/src/components/statistics/verification/HbStatisticsVerification.tsx b/apps/st/src/components/statistics/verification/HbStatisticsVerification.tsx index 99a4a6e0b..07c2663c9 100644 --- a/apps/st/src/components/statistics/verification/HbStatisticsVerification.tsx +++ b/apps/st/src/components/statistics/verification/HbStatisticsVerification.tsx @@ -165,8 +165,16 @@ const HbStatisticsVerification = () => { [filteredVerificationTargetCodes], ); + const isAllSelected = useMemo(() => { + const count = filteredVerificationTargetCodes?.length ?? 0; + return count > 0 && selectedTargets.length === count; + }, [filteredVerificationTargetCodes, selectedTargets]); + + const handleToggleAll = () => { + setSelectedTargets(isAllSelected ? [] : allVerificationTargetIds); + }; + useEffect(() => { - if (!allVerificationTargetIds.length) return; setSelectedTargets(allVerificationTargetIds); }, [allVerificationTargetIds]); @@ -476,42 +484,59 @@ const HbStatisticsVerification = () => { filteredVerificationTargetCodes && filteredVerificationTargetCodes.length > 0 ? ( -
- {filteredVerificationTargetCodes.map( - (item) => ( -
- +
+ + +
+
+ {filteredVerificationTargetCodes.map( + (item) => ( +
- handleTargetToggle( - item.vrfcTrgtSn, - ) - } - /> - -
- ), - )} -
+ + handleTargetToggle( + item.vrfcTrgtSn, + ) + } + /> + +
+ ), + )} +
+ ) : (