{% extends 'training_template.html' %}

{% block training_content %}
    <div class="row">
        <div class="col-md-12">
            <p>You can add trainee groups in bulk to lessons, this is useful if you have a regular cohort of trainees
                taking
                a particular course.</p>
            <p>Groups act as one-time selection tools, once the group has been added to a session later changes to the
                group
                will not be reflected in the session.</p>

            <form action="new/" method="post">
                {% csrf_token %}
                <p class="input-group">
                    <span class="input-group-addon">New Group</span>
                    <input type="text" name="name" placeholder="Name" class="form-control"/>
                    <span class="input-group-btn">
                <button type="submit" class="btn btn-secondary"><i class="fa fa-plus"></i></button>
            </span>
                </p>
            </form>

            {% if tgs %}
                <table class="table table-sm table-striped">
                    <tr>
                        <th></th>
                        <th>Group</th>
                        <th>Members</th>
                        <th></th>
                    </tr>
                    {% for group in tgs %}
                        <tr>
                            <td>{{ group.uid }}</td>
                            <td>{{ group.name }}</td>
                            <td>{{ group.trainees_list_with_links|safe }}</td>
                            <td class="action-icons">
                                <a href="{% url 'xsd_training:TraineeGroupUpdate' group.pk %}">
                                    <i class="fa fa-pencil"></i>
                                </a>
                                <a href="{% url 'xsd_training:TraineeGroupHistory' group.pk %}">
                                    <i class="fa fa-history"></i>
                                </a>
                                <a href="{% url 'xsd_training:TraineeGroupDelete' group.pk %}">
                                    <i class="fa fa-trash"></i>
                                </a>
                            </td>

                        </tr>
                    {% endfor %}
                </table>
            {% else %}
                <h2 class="no-trainee">No Groups </h2>
            {% endif %}
        </div>
    </div>
{% endblock %}
