Skip to content

Commit

Permalink
[TM-1402] If previous counts are being displayed, don't allow deletin…
Browse files Browse the repository at this point in the history
…g a row that was previously reported on.
  • Loading branch information
roguenet committed Dec 16, 2024
1 parent f9b86f6 commit f4cc037
Showing 1 changed file with 15 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -451,11 +451,21 @@ const TreeSpeciesInput = (props: TreeSpeciesInputProps) => {
autoCompleteRef.current?.focus();
}}
/>
<IconButton
iconProps={{ name: IconNames.TRASH_TA, width: 24 }}
className="text-blueCustom-700 hover:text-primary"
onClick={() => setDeleteIndex(value.uuid ?? null)}
/>
<When
condition={
!displayPreviousCounts ||
previousPlantingCounts == null ||
// If we're using previous counts, only allow delete if this row has never been
// reported on before.
Object.keys(previousPlantingCounts).find(name => name === value.name) == null
}
>
<IconButton
iconProps={{ name: IconNames.TRASH_TA, width: 24 }}
className="text-blueCustom-700 hover:text-primary"
onClick={() => setDeleteIndex(value.uuid ?? null)}
/>
</When>
</div>
</div>
)}
Expand Down

0 comments on commit f4cc037

Please sign in to comment.