{% extends "base_list.html" %}

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

{% block lists %}
<div class="row">
    {% if track.album.cover_image %}
    <p style="width:150px; float:left;"><img src="{{track.album.cover_image.url}}" width=150 height=150 /></p>
    {% endif %}
</div>
<div class="row">
    <p>{{object.scrobble_set.count}} scrobbles</p>
    {% if charts %}
    <p>{% for chart in charts %}<em><a href="{{chart.link}}">{{chart}}</a></em>{% if forloop.last %}{% else %} | {% endif %}{% endfor %}</p>
    {% endif %}
    <div class="col-md">
        <h3>Last scrobbles</h3>
        <div class="table-responsive">
            <table class="table table-striped table-sm">
                <thead>
                    <tr>
                        <th scope="col">Date</th>
                        <th scope="col">Track</th>
                        <th scope="col">Album</th>
                        <th scope="col">Artist</th>
                    </tr>
                </thead>
                <tbody>
                    {% for scrobble in object.scrobble_set.all %}
                    <tr>
                        <td>{{scrobble.timestamp}}</td>
                        <td><a href="{{scrobble.track.get_absolute_url}}">{{scrobble.track.title}}</a></td>
                        <td><a href="{{scrobble.track.album.get_absolute_url}}">{{scrobble.track.album}}</a></td>
                        <td><a href="{{scrobble.track.artist.get_absolute_url}}">{{scrobble.track.artist}}</a></td>
                    </tr>
                    {% endfor %}
                </tbody>
            </table>
        </div>
    </div>
</div>

{% endblock %}
