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

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

{% block lists %}

<div class="row">
    <div class="col-md">
        {% if object.description %}
        <p>{{object.description|safe|linebreaks|truncatewords:160}}</p>
        <hr />
        {% endif %}
        <p>{{scrobbles|length}} scrobbles</p>
        <p>
            <a href="{{object.start_url}}">Log a workout</a>
        </p>
    </div>
</div>
{% if object.routine_exercises.all %}
<div class="row">
    <div class="col-md">
        <h3>Planned exercises</h3>
        <ol>
            {% for planned in object.routine_exercises.all %}
            <li>
                <a href="{{planned.exercise.get_absolute_url}}">{{planned.exercise.name}}</a>
                {% if planned.target_sets %}
                &mdash; {{planned.target_sets}} sets{% if planned.target_reps %} x {{planned.target_reps}} reps{% endif %}
                {% endif %}
            </li>
            {% endfor %}
        </ol>
    </div>
</div>
{% endif %}
<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">Workout</th>
                    </tr>
                </thead>
                <tbody>
                    {% for scrobble in scrobbles %}
                    <tr>
                        <td><a href="{{scrobble.get_absolute_url}}">{{scrobble.local_timestamp}}</a></td>
                        <td>{{scrobble.logdata.workout_list}}</td>
                    </tr>
                    {% endfor %}
                </tbody>
            </table>
        </div>
    </div>
</div>
{% endblock %}
