{% extends "base_list.html" %}

{% block title %}{{ object.title }}{% endblock %}

{% block lists %}

<div class="row">
    <div class="summary">
        {% if object.photo %}
        <div style="float: left; margin-right: 15px; margin-bottom: 15px;">
            <img src="{{ object.photo.url }}" style="max-width: 300px; max-height: 300px; object-fit: contain;">
        </div>
        {% endif %}
        {% if object.scientific_name %}
        <p><em>{{ object.scientific_name }}</em></p>
        {% endif %}
        <p><strong>Taxon ID:</strong> {{ object.taxon_id }}</p>
        <p><a href="https://www.inaturalist.org/taxa/{{ object.taxon_id }}" target="_blank">View on iNaturalist</a></p>
        <hr />
    </div>
</div>
<div class="row">
    <p>{{ scrobbles.count }} observations</p>
</div>
<div class="row">
    <div class="col-md">
        <h3>Recent observations</h3>
        <div class="table-responsive">
            <table class="table table-striped table-sm">
                <thead>
                    <tr>
                        <th scope="col">Date</th>
                        <th scope="col">Location</th>
                        <th scope="col">Quality</th>
                        <th scope="col">Source</th>
                    </tr>
                </thead>
                <tbody>
                    {% for scrobble in scrobbles.all|dictsortreversed:"timestamp" %}
                    <tr>
                        <td><a href="{{ scrobble.get_absolute_url }}">{{ scrobble.local_timestamp }}</a></td>
                        <td>{{ scrobble.logdata.place_guess|default:"—" }}</td>
                        <td>{{ scrobble.logdata.quality_grade|default:"—" }}</td>
                        <td>{{ scrobble.source }}</td>
                    </tr>
                    {% endfor %}
                </tbody>
            </table>
        </div>
    </div>
</div>
{% endblock %}
