{% extends "base.html" %}
{% load i18n %}

{% block subtitle %}
    {% blocktrans with training=session.training date=session.date|date:"j F Y" %}Metaplan List of "{{ training }}" - {{ date }}{% endblocktrans %}
{% endblock subtitle %}

{% block actions %}
    <a class="btn btn-success" href="{% url 'metaplans:create' session_id=session.id %}"><i class="fa fa-plus"></i> {% trans 'Add metaplan' %}</a>
    <a class="btn btn-default" href="{% url 'trainings:session-list' %}">{% trans 'Back to session list' %}</a>
{% endblock actions %}

{% block main %}
    <div class="row">
        {% for metaplan in object_list %}
            <div class="col-sm-6 col-md-4">
                <div class="panel panel-default">
                    <div class="panel-heading text-center">
                        {% trans 'Metaplan' %} "<em>{{ metaplan }}</em>"
                        <span class="btn-group pull-right">
                            {% if user.is_trainer or user.is_superuser %}
                                <a class="btn btn-xs btn-warning" href="{% url 'metaplans:update' pk=metaplan.id %}"><i class="fa fa-pencil"></i></a>
                                <a class="btn btn-xs btn-danger" href="{% url 'metaplans:delete' pk=metaplan.id %}"><i class="fa fa-trash"></i></a>
                            {% endif %}
                        </span>
                    </div>
                    <div class="panel-body">
                        <div class="row">
                            <div class="col-xs-12 text-center">
                                <strong>{{ metaplan.get_propositions|length }}</strong>
                                <div>{% trans 'propositions' %}</div>
                            </div>
                        </div>
                        <br>
                        <div class="btn-group btn-group-justified">
                            <a class="btn btn-warning btn-sm" href="{% url 'metaplans:export' pk=metaplan.id %}"><i class="fa fa-download"></i> {% trans 'Export' %}</a>
                            <a class="btn btn-primary btn-sm" href="{% url 'metaplans:detail' pk=metaplan.id %}"><i class="fa fa-info"></i> {% trans 'Details' %}</a>
                        </div>
                    </div>
                </div>
            </div>
        {% empty %}
        <div class="alert alert-info">
            {% trans 'No metaplans yet.' %}
        </div>
        {% endfor %}
    </div>
{% endblock main %}
