From 4a0c07e3c9518098df4059ba39cd51d66f965347 Mon Sep 17 00:00:00 2001 From: Brijesh Date: Mon, 4 Nov 2024 15:56:43 -0800 Subject: [PATCH] 1170 - Wrong district name displayed on the dropdown --- src/components/selectRangeUsePlanPage/ZoneSelect.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/components/selectRangeUsePlanPage/ZoneSelect.js b/src/components/selectRangeUsePlanPage/ZoneSelect.js index d593283c..3774d764 100644 --- a/src/components/selectRangeUsePlanPage/ZoneSelect.js +++ b/src/components/selectRangeUsePlanPage/ZoneSelect.js @@ -133,7 +133,10 @@ export function ZoneSelectAll({ zones, users, zoneInfo, setZoneInfo }) { onClick={handleChange} value={zoneInfo?.selectedZones} multiple - renderValue={(zoneIds) => zoneIds.map((id) => zones[id]?.description).join(', ')} + renderValue={(zoneIds) => { + if (zoneInfo.selectAllZones) return ''; + return zoneIds.map((id) => zones.find((zone) => zone.id === id)?.description).join(', '); + }} MenuProps={{ getContentAnchorEl: () => null, ...MenuProps, @@ -249,7 +252,10 @@ export function ZoneSelect({ zones, unassignedZones, userZones, users, setZoneIn onClick={handleChange} value={zoneInfo.selectedZones} multiple - renderValue={(zoneIds) => zoneIds.map((id) => zones[id]?.description).join(', ')} + renderValue={(zoneIds) => { + if (zoneInfo.selectAllZones) return ''; + return zoneIds.map((id) => zones.find((zone) => zone.id === id).description).join(', '); + }} MenuProps={{ getContentAnchorEl: () => null, ...MenuProps, @@ -262,7 +268,6 @@ export function ZoneSelect({ zones, unassignedZones, userZones, users, setZoneIn {userZones && userZones.map((zone) => { const user = users.find((user) => user.id === zone.userId); - return (