{% extends 'info/base.html' %}
    {% load static %}

    {% block content %}
                  <div class="card mb-3">
            <div class="card-header">
              <i class="fas fa-table"></i>
            <b>Attendance</b></div>
            <div class="card-body">
              <div class="table-responsive">
                <table class="table table-bordered text-center" id="dataTable" width="100%" cellspacing="0">
                  <thead class="thead-light ">
                    <tr>
                        <th>Course ID</th>
                        <th>Course name</th>
                        <th>Attended classes</th>
                        <th>Total classes</th>
                        <th>Attendance %</th>
                        <th>Classes to attend</th>
                    </tr>
                  </thead>
                  <tbody>
                    {% for a in att_list %}
                    <tr>
                        <td>{{ a.course_id }}</td>
                        <td><a href="{% url 'attendance_detail' a.student.USN a.course.id %}">{{a.course.name}}</a></td>
                        <td>{{ a.att_class }}</td>
                        <td>{{ a.total_class }}</td>
                        {% if a.attendance < 75 %}
                            <td class="p-3 mb-2 bg-danger text-white">{{ a.attendance }}</td>
                        {% else %}
                            <td class="p-3 mb-2 bg-success text-white">{{ a.attendance }}</td>
                        {% endif %}
                        <td>{{ a.classes_to_attend }}</td>
                    </tr>
                    {% empty %}
                            <p>student has no courses</p>
                    {% endfor %}

                  </tbody>
                </table>
              </div>
            </div>
          </div>


    {% endblock %}

