Skip to content

Commit

Permalink
Allow duplicate species only for non-global FAO area in manual pno form
Browse files Browse the repository at this point in the history
  • Loading branch information
ivangabriele committed Sep 12, 2024
1 parent b7e7c39 commit ff83e19
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,15 @@ export function FormikFishingCatchesMultiSelect({ isReadOnly }: FormikFishingCat
)

const add = (nextSpecy: Specy | undefined) => {
if (values.hasGlobalFaoArea) {
const isSpecyCodeAlreadyInCatches = values.fishingCatches?.find(
fishingCatch => fishingCatch.specyCode === nextSpecy?.code
)
if (isSpecyCodeAlreadyInCatches) {
return
}
}

const specyOption = speciesAsOptions?.find(({ value }) => value.code === nextSpecy?.code)
if (!specyOption) {
return
Expand Down

0 comments on commit ff83e19

Please sign in to comment.