{% extends "base.html" %}
{% load i18n static wger_extras django_bootstrap_breadcrumbs %}

{#           #}
{# Opengraph #}
{#           #}
{% block opengraph %}
    {{ block.super }}
    <meta property="og:title" content="{% trans 'Workout log' %}">

    {% with username=owner_user.username %}
        <meta property="og:description" content="{% blocktrans %}Workout log for {{username}} for {{date}}{% endblocktrans %}">
    {% endwith %}
{% endblock %}


{#             #}
{# Breadcrumbs #}
{#             #}
{% block breadcrumbs %}
    {{ block.super }}

    {% breadcrumb_raw date|date:'F' "manager:workout:calendar" owner_user date.year date.month %}
    {% breadcrumb_raw date.day "manager:workout:calendar-day" owner_user date.year date.month date.day %}
{% endblock %}


{#       #}
{# Title #}
{#       #}
{% block title %}{% trans "Workout log" %} – {{date}}{% endblock %}


{#         #}
{# Content #}
{#         #}
{% block content %}
{% if logs %}
    {% for date, value in logs.items %}

        {% include 'calendar/partial_overview_table.html' %}


        {% for exercise, logs in value.logs.items %}
            <table class="table table-hover table-bordered" style="margin-top: 2em;">
            <tr class="active">
                <th><a href="{{ exercise.get_absolute_url }}">{{ exercise }}</a></th>
            </tr>
            {% for log in logs %}
            <tr>
                <td>
                    {{log.reps}}
                    {% if not log.repetition_unit.is_repetition %}
                        {% trans log.repetition_unit.name %}
                    {% endif %}
                    ×
                    {{log.weight}} {% trans log.weight_unit.name %}

                    {% if is_owner %}
                    <span class="editoptions">
                        <div class="btn-group pull-right">
                            <button type="button" class="btn btn-default dropdown-toggle btn-xs" data-toggle="dropdown">
                                <span class="{% fa_class 'cog' %}"></span>
                            </button>
                            <ul class="dropdown-menu" role="menu">
                                <li>
                                    <a href="{% url 'manager:log:edit' log.pk %}"
                                       title="{% trans 'Edit' %}"
                                       class="wger-modal-dialog">{% trans 'Edit' %}</a>
                                </li>
                                <li>
                                    <a href="{% url 'manager:log:delete' log.pk %}"
                                       title="{% trans 'Delete' %}"
                                       class="wger-modal-dialog">{% trans 'Delete' %}</a>
                                </li>
                            </ul>
                        </div>
                    </span>
                    {% endif %}
                </td>
            </tr>
            {% endfor %}
            </table>

        {% endfor %}
    {% endfor %}
{% else %}
    {% trans "Nothing found" %}
{% endif %}
{% endblock %}


{#         #}
{# Sidebar #}
{#         #}
{% block sidebar %}
{% endblock %}
