fix: show selected species name in confirm button

This commit is contained in:
Stephan Kerkman 2026-05-30 17:46:27 +02:00
parent b16df6caa4
commit 62fdbf7029

View file

@ -18,6 +18,7 @@
<div class="match-card d-flex align-items-center gap-3 p-3 border rounded"
style="cursor:pointer; {% if forloop.first %}border-color:#52b788 !important; background:#f0faf4;{% endif %}"
data-idx="{{ forloop.counter0 }}"
data-name="{{ m.scientific_name }}"
onclick="selectMatch(this)">
<div class="flex-grow-1">
<div class="fw-bold">{{ m.scientific_name }}</div>
@ -36,7 +37,7 @@
</div>
<button type="submit" class="btn btn-success w-100" id="confirm-btn">
Use selected species
Use <span id="selected-name">{{ matches.0.scientific_name }}</span>
</button>
</form>
@ -49,6 +50,7 @@ function selectMatch(el) {
el.style.borderColor = '#52b788';
el.style.background = '#f0faf4';
document.getElementById('match_idx_input').value = el.dataset.idx;
document.getElementById('selected-name').textContent = el.dataset.name;
}
</script>
{% endblock %}