{% extends 'training_template.html' %}
{% load staticfiles %}

{% block training_content %}
    <div class="row">
    <div class="col-md-12">
        <h1>Complete {{ session.uid }}</h1>
        <p>You are completing the session which took place on {{ session.when }} at {{ session.where }}.</p>
    </div>
    <form action="." method="POST">
        <div class="span7">
            {{ performed_lessons_formset.management_form }}
            <table class="table table-sm table-striped table-session">
                <tr>
                    <th>Trainee</th>
                    <th>Lesson</th>
                    <th>Instructor</th>
                    <th>Completed?</th>
                    <th>Partial</th>
                    <th>Public Notes</th>
                    <th>Private Notes</th>
                </tr>
                {% for form in performed_lessons_formset %}
                    <tr>
                        <td>{{ form.id }}{{ form.instance.trainee.get_full_name }}</td>
                        <td>{{ form.instance.lesson }}</td>
                        <td>{{ form.instance.instructor.get_full_name }}</td>
                        <td>{{ form.completed }}</td>
                        <td>{{ form.partially_completed }}</td>
                        <td>{{ form.public_notes }}</td>
                        <td>{{ form.private_notes }}</td>
                    </tr>
                    {% empty %}
                    </table>
                    <h2 class="no-trainee">No Trainees Added Yet</h3>
                {% endfor %}

                </table>


        </div>

        {% csrf_token %}
        <div class="span2">
            <p><strong>Completed?</strong></p>
            <p>Checked indicates that the trainee attended and completed the lesson to the relevant skill performance
                standard, they will immediately have this lesson show up on their profile as completed.</p>
            <p>Unchecked indicates that the trainee was a no-show or did not finish the lesson. If the lesson is not
                marked as partially completed it will be removed.</p>

            <p><strong>Partial?</strong></p>
            <p>Check partial if the lesson was partially completed, make a note as to how much of the lesson was
                completed. This will show up when the pool sheet is generated for the re-planned lesson.</p>

            <p><strong>Notes</strong></p>
            <p>Public notes are shown to the trainee and all instructors and database officers with the training
                permission. Private notes are not shown to the trainee.</p>

            <p><strong>Saving and Completing</strong></p>
            <p>You can save the progress of this form before 'completing the session'. After you complete the session
                you may not come back to this page and edit it later.</p>

        </div>
        {% if is_training %}
            <div class="col-md-12 ">
                <div class="form-actions">
                    <div class="btn-group pull-left">
                        <a class="btn btn-secondary" href="{% url 'xsd_training:SessionPlanner' session.pk %}"><i
                                class="fa fa-remove"></i> Cancel</a>
                    </div>

                    <div class="btn-group pull-right">
                        <button type="submit" class="btn btn-secondary" name="save"><i class="fa fa-save"></i> Save Form
                        </button>
                        <input type="submit" class="btn btn-success" name="complete" value="Complete Session"/>
                    </div>
                </div>
            </form>
        {% endif %}
    </div>
{% endblock %}
