{% load i18n wger_extras %}

<div class="btn-group btn-group-justified" role="group">
    <a href="{{value.workout.get_absolute_url}}" class="btn btn-default">{{ value.workout }}</a>
    <a href="{% url 'manager:log:log' value.workout.id %}" class="btn btn-default">{% trans "Log overview" %}</a>

    {% if is_owner %}
        {% if value.session %}
            <div class="btn-group" role="group">
                <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                    {% trans "Workout session" %}
                    <span class="caret"></span>
                </button>
                <ul class="dropdown-menu">
                    <li>
                        <a href="{% url 'manager:session:edit' value.session.pk %}" class="wger-modal-dialog">
                            <span class="{% fa_class 'pencil-square-o' %}"></span>
                            {% trans "Edit" %}
                        </a>
                    </li>
                    <li>
                        <a href="{% url 'manager:session:delete' value.session.pk %}" class="wger-modal-dialog">
                            <span class="{% fa_class 'trash' %}"></span>
                            {% trans "Delete" %}
                        </a>
                    </li>
                    <li>
                        <a href="{% url 'manager:session:delete' value.session.pk 'logs' %}" class="wger-modal-dialog">
                            <span class="{% fa_class 'trash' %}"></span>
                            {% trans "Delete with logs" %}
                        </a>
                    </li>
                </ul>
            </div>
        {% else %}
            <a href="{% url 'manager:session:add' value.workout.id date|date:'Y' date|date:'m' date|date:'d' %}" class="btn btn-default btn-block wger-modal-dialog">{% trans "Add workout impression" %}</a>
        {% endif %}
    {% endif %}
</div>


{% if value.session %}
<table class="table" style="margin-top: 2em;">
    <tr>
        <th style="width: 30%">{% trans "Time" %}</th>
        <td>
            {% if value.session.time_start %}
                {{value.session.time_start|time:"H:i"}} - {{value.session.time_end|time:"H:i"}}
            {% else %}
                -/-
            {% endif %}
        </td>
    </tr>
    <tr>
        <th>{% trans "General impression" %}</th>
        <td>{% trans value.session.get_impression_display %}</td>
    </tr>
    <tr>
        <th>{% trans "Notes" %}</th>
        <td>{{value.session.notes|default:'-/-'}}</td>
    </tr>
</table>
{% endif %}