{% load rowerfilters %}
  <p>
  <table width="100%" class="listtable shortpadded">
    <thead>
      <tr>
        <th>Date</th>
        <th>Registration Deadline</th>
        <th>Event</th>
        <th>Country</th>
        <th>Course</th>
        <th></th>
        <th></th>
        <th>Click for Details</th>
      </tr>
    </thead>
    <tbody>
  {% for race in races %}
  <tr>
    <td>{{ race.startdate|date:"Y-m-d" }}</td>
    <td>
      {% if race.registration_closure %}
      {{ race.registration_closure|date:"Y-m-d H:i e" }}
      {% else %}
      {{ race.startdate|date:"Y-m-d" }} {{ race.start_time }}
      {% endif %}
    </td>
    <td><a href="/rowers/virtualevent/{{ race.id }}">{{ race.name }}</a></td>
    {% if race.sessiontype == 'race' %}
    <td>{{ race.course.country }}</td>
    {% else %}
    <td>Worldwide Indoor Challenge</td>
    {% endif %}
    <td><a href="/rowers/courses/{{ race.course.id }}">{{ race.course.name }}</a></td>
    <td>{{ race.sessionvalue }}</td>
    <td>{{ race.sessionunit }}</td>
    <td>
      {% if rower %}
      {% if race|can_register:rower %}
      <a class="white dot" href="/rowers/virtualevent/{{ race.id }}">&nbsp;</a>
      {% elif race|race_complete:rower %}
      <a class="green dot" href="/rowers/virtualevent/{{ race.id }}">&nbsp;</a>
      {% elif race|can_submit:rower %}
      <a class="orange dot" href="/rowers/virtualevent/{{ race.id }}">&nbsp;</a>
      {% elif race|future_registered:rower %}
      <a class="orange dot" href="/rowers/virtualevent/{{ race.id }}">&nbsp;</a>
      {% elif race|past_not_registered:rower %}
      <a class="blue dot" href="/rowers/virtualevent/{{ race.id }}">&nbsp;</a>
      {% else %}
      <a class="red dot" href="/rowers/virtualevent/{{ race.id }}">&nbsp;</a>
      {% endif %}
      {% endif %}
    </td>
  </tr>
  {% endfor %}
  </tbody>
  </table>
  </p>
