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

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

{% block head_extra %}
<style>
.cover   {float:left; width:412px; margin-right:10px; padding-bottom:15px;}
.summary {float:left; width:600px; margin-left:10px;}
.header  {padding-bottom:15px;}
.image-wrapper { contain: content; }
.caption {
     position: fixed;
     top: 15px;
     left: 30px;
     padding: 5px;
     font-size: 110%;
     font-weight: bold;
     color:white;
     background:rgba(0,0,0,0.4);
}
.caption-footer {
     position: fixed;
     bottom: 30px;
     left: 30px;
     padding: 5px;
     font-size: 110%;
     font-weight: bold;
     color:white;
     background:rgba(0,0,0,0.4);
}
dl {
    display: flex;
    flex-flow: row wrap;
    padding-right:20px;
    border:none;
}
dt {
    flex-basis: 20%;
    padding: 5px;
    background: #3cf;
    text-align: right;
    color: #fff;
}
dd {
    flex-basis: 70%;
    flex-grow: 1;
    margin: 0;
    padding: 5px;
    border:none;
}
</style>
{% endblock %}

{% block lists %}

<div class="row header">
    <div class="cover image-wrapper">
        {% if object.imdb_rating %}<div class="caption">{{object.imdb_rating}}</div>{% endif %}
        {% if object.tmdb_rating %}<div class="caption">{{object.tmdb_rating}}</div>{% endif %}
        <img src="{% if object.cover_image %}{{object.cover_image.url}}{% else %}{% static 'images/no-video-cover.jpg' %}{% endif %}" width="400px" />
        <div class="caption-footer">{{object.year}}{% if object.tv_series %} | <b>S</b>{{object.season_number}} <b>E</b>{{object.episode_number}}{% endif %}</div>
    </div>
    <div class="summary">
    {% if object.tv_series %}<h4><a href="{{object.tv_series.get_absolute_url}}">{{object.tv_series}}</a> - S{{object.season_number}}E{{object.episode_number}}</h4>{% endif %}
        {% if object.overview %}<p><em>{{object.overview}}</em></p>{% endif %}
        {% if object.plot%}<p>{{object.plot|safe|linebreaks|truncatewords:160}}</p>{% endif %}
        <hr />
        {% if object.imdb_id %}
        <p style="float:right;">
            <a href="{{object.imdb_link}}"><img src="{% static "images/imdb_logo.png" %}" width=35></a>
        </p>
        {% endif %}
        {% if object.youtube_id %}
        <p style="float:right;">
            <a href="{{object.youtube_link}}"><img src="{% static "images/youtube_logo.png" %}" width=35></a>
        </p>
        {% endif %}

    </div>
    <div class="deets">
    </div>
</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>
                    </tr>
                </thead>
                <tbody>
                    {% for scrobble in scrobbles.all %}
                    <tr>
                        <td><a href={{scrobble.get_absolute_url}}>{{scrobble.local_timestamp}}</a></td>
                    </tr>
                    {% endfor %}
                </tbody>
            </table>
        </div>
    </div>
</div>
{% endblock %}
