{% extends "base_list.html" %}
{% load mathfilters %}
{% load static %}
{% load naturalduration %}

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

{% block head_extra %}
<style>
    .cover img {
        width: 250px;
    }

    .cover {
        float: left;
        width: 252px;
        padding: 0;
    }

    .summary {
        float: left;
        width: 600px;
        margin-left: 10px;
    }
</style>
{% endblock %}

{% block lists %}

<div class="row">
    <div class="summary">
        {% if object.description%}
        <p>{{object.description|safe|linebreaks|truncatewords:160}}</p>
        <hr />
        {% endif %}
        <p style="float:right;">
            {% if object.abv %}
            <span class="text-muted">{{ object.abv }}% ABV</span>
            {% endif %}
        </p>
    </div>
</div>
<div class="row">
    <p>{{scrobbles.count}} scrobbles</p>
    <p>
        <a href="{{object.start_url}}">Drink again</a>
    </p>
</div>
<div class="row">
    <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">Format</th>
                        <th scope="col">Size</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.format_display }}</td>
                        <td>
                            {% if scrobble.logdata.size_ml %}
                                {% if request.user.profile.volume_unit == "imperial" %}
                                    {{ scrobble.logdata.size_oz }} oz
                                {% else %}
                                    {{ scrobble.logdata.size_ml }} mL
                                {% endif %}
                            {% endif %}
                        </td>
                    </tr>
                    {% endfor %}
                </tbody>
            </table>
        </div>
    </div>
</div>
{% endblock %}
