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

{% block actions %}
    <a class="btn btn-success" href="{% url 'brainstormers:create_group' brainstormer_uuid=object.id %}"><i class="fa fa-plus"></i> {% trans 'Add group' %}</a>
    <a class="btn btn-default" href="{{ brainstormer.session.get_brainstormer_list_url }}">{% trans 'Back to brainstormer list' %}</a>
{% endblock %}

{% block subtitle %}
    {% blocktrans with title=object %}Brainstormer Propositions List of "{{ title }}"{% endblocktrans %}
    <small>"{{ object.training_session.training }}" - {{ object.training_session.date|date:"j F Y" }}</small>
{% endblock subtitle %}

{% block main %}
    <div class="row-fluid">
        {% for group, propositions in object.get_grouped_propositions.items %}
            <div class="col-md-6">
                <div class="panel panel-default">

                    <div class="panel-heading text-center" style="background-color:{{ group.color }};">
                        {% if group.name %}{{ group.name|capfirst }}{% else %}{% trans 'Unnamed group' %}{% endif %}
                        <span class="btn-group pull-right">
                            <a class="btn btn-xs btn-success" href="{{ group.get_create_proposition_url }}"><i class="fa fa-plus"></i></a>
                            {% if not group.is_default_group %}
                                <a class="btn btn-xs btn-warning" href="{% url 'brainstormers:update_group' brainstormer_uuid=object.id group_uuid=group.id %}"><i class="fa fa-pencil"></i></a>
                                <a class="btn btn-xs btn-danger" href="{% url 'brainstormers:delete_group' brainstormer_uuid=object.id group_uuid=group.id %}"><i class="fa fa-trash"></i></a>
                            {% endif %}
                        </span>
                    </div>

                    <ul class="list-group">
                        {% for proposition in propositions %}
                            <li class="list-group-item">"{{ proposition.text }}" <i>by {{ proposition.user }}</i>
                            <span class="btn-group pull-right">
                                <a class="btn btn-xs btn-warning" href="{% url 'brainstormers:update_proposition' brainstormer_uuid=object.id proposition_uuid=proposition.id %}"><i class="fa fa-pencil"></i></a>
                                <a class="btn btn-xs btn-danger" href="{% url 'brainstormers:delete_proposition' brainstormer_uuid=object.id proposition_uuid=proposition.id %}"><i class="fa fa-trash"></i></a>
                            </span>
                        {% empty %}
                            <li class="list-group-item"><i>{% trans 'No propositions yet.' %}</i></li>
                        {% endfor %}
                    </ul>

                </div>
            </div>
        {% endfor %}
    </div>
{% endblock main %}
