Skip to content

Commit

Permalink
fix: taxon Select returning cd_nom
Browse files Browse the repository at this point in the history
Use getPreferredName method everywhere needs to
display taxon name .
Use click event in select in order to update cd_nom
control form

Reviewed-by: andriacap
  • Loading branch information
andriacap committed Dec 18, 2024
1 parent 5118145 commit 877b602
Showing 1 changed file with 7 additions and 18 deletions.
25 changes: 7 additions & 18 deletions frontend/src/app/programs/observations/form/form.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@
'?w=800'
: 'assets/default_image.png'
" [alt]="
!!taxa[0].nom_francais
? taxa[0].nom_francais
: taxa[0].taxref.nom_vern
getPreferredName(taxa[0])
" class="object-fit-cover" />
</div>

Expand All @@ -38,14 +36,10 @@ <h5 *ngIf="taxaCount > 1" class="m-0">
taxaCount >= taxonSelectInputThreshold &&
taxaCount < taxonAutocompleteInputThreshold
" class="d-inline-flex toolbar ">
<select formControlName="cd_nom" class="form-control w-100" required>
<select class="form-control w-100" required>
<option value="" [disabled]="true">Choisissez une espèce</option>
<option *ngFor="let s of surveySpecies" [value]="s.taxref.cd_nom">
{{
!!s.nom_francais
? s.nom_francais
: s.taxref.nom_vern
}}
<option *ngFor="let s of surveySpecies" (click)="onTaxonSelected(s)" [value]="s.taxref.cd_nom">
{{ getPreferredName(s) }}
<span *ngIf="MainConfig.taxonDisplaySciName">(<i>{{ s.taxref.nom_complet }}</i>)</span>
</option>
</select>
Expand All @@ -65,15 +59,10 @@ <h5 *ngIf="taxaCount > 1" class="m-0">
'?h=150'
: 'assets/default_image.png'
" [alt]="
!!s.nom_francais
? s.nom_francais
: s.taxref.nom_vern
getPreferredName(s)
" (click)="onTaxonSelected(s)" />
<span>{{
!!s.nom_francais
? s.nom_francais
: s.taxref.nom_vern
}}</span>
<span> {{ getPreferredName(s) }}
</span>
</div>
</div>
</div>
Expand Down

0 comments on commit 877b602

Please sign in to comment.