{% extends 'game/base.html' %}

{% block title %}Students{% endblock %}

{% block css %}
{{block.super}}
  <link href="{% static "game/css/logged_students.css" %}" rel="stylesheet" type="text/css">
{% endblock %}

{% block content %}
<div id="wrapper">
  {% if currentClass %}
    <h4>Currently looking at class: {{currentClass}}</h4>
  {% endif %}
  <p>{{message}}</p>
  {% if classes %}
    <form name="class_selection" id="class_form" action="" method="post" onchange="class_selection.submit()">
  	{% csrf_token %}
  	<select name="classes">
  	  {% for class in classes %}
          <option value="{{class.id}}">{{class.name}}</option>
  	  {% endfor %}
      </select>
    </form>
  {% endif %}

  {% if studentData %}
    <table>
      <thead>
      {% for header in thead %}
        <th> {{header}} </th>
      {% endfor %}
      </thead>
      <tbody>
      {% for row in studentData %}
        <tr>
          <td> <img style="vertical-align:middle" src="{% static 'game/image/avatars/default-avatar.jpeg' %}"> </td>
          <td> {{row.0.user.user.first_name}} </td>
          <td> {{row.0.user.user.last_name}} </td>
          <td> {{row.1}} </td>
          <td> {{row.2}} </td>
          <td> {{row.3.id}}</td>
          <td> {{row.3.score}}</td>
          <td> {{row.4.id}}</td>
          <td> {{row.4.score}}</td>
        </tr>
        {% endfor %}
      </tbody>
    </table>
  {% else %}
	  <h5> Nobody to show. </h5>
  {% endif %}
</div>
{% endblock %}
