{% extends 'dashboard/base-dashboard.html' %}

{% block content %}

<div class="row">
    <h1 class="text-center pt-5 pb-5">Students</h1>
</div>

<div class="row d-flex justify-content-center text-center">
        <div class="col-md-6 col-sm-12">
            <div class="table-responsive">
                <table class="table caption-top">
                    <thead>
                        <tr>
                            <th scope="col">First Name</th>
                            <th scope="col">Last Name</th>
                            <th scope="col">Grade</th>
                            <th scope="col">Classroom</th>
                            <th scope="col">Risk</th>
                            <th scope="col">Actions</th>
                        </tr>
                    </thead>
                    <tbody>
                        {% comment %} {% if students.count() is not 0  %} {% endcomment %}
                            {% for student in students %}
                            <tr>
                                <td>{{ student.first_name }}</td>
                                <td>{{ student.last_name }}</td>
                                <td>{{ student.grade }}</td>
                                <td>{{ student.classroom.name }} </td>
                                {% if student.risk == 'GREAT' %}
                                    <td class="text-success">{{ student.risk }}</td>
                                {% elif student.risk == 'AT_RISK' %}
                                    <td class="text-danger">AT RISK</td>
                                {% else %}
                                    <td>{{ student.risk }}</td>
                                {% endif %}                          
                                <td>
                                    <div class="d-flex justify-content-between">
                                        <a href="{% url 'student_info:studentInfo' student.pk %}" class="btn btn-primary">View</a>
                                        <a href="{% url 'exam:q1' student.pk %}" class="btn btn-primary">Take PreReader Exam</a>
                                    </div>
                                </td>
                            </tr>  
                        {% endfor %} 
                        {% comment %} {% else %}
                            <h3>You have no students.</h3>
                        {% endif %}                                                                                           {% endcomment %}
                    </tbody>
            </div>
        </div>
    </div>

{% endblock content %}