{% extends "base.html" %}
{% load staticfiles %}
{% load rowerfilters %}

{% block title %}Planned Session{% endblock %}

{% block content %}
<div class="grid_12 alpha">
  {% include "planningbuttons.html" %}

</div>
<div class="grid_12 alpha">
<div id="left" class="grid_6 alpha">
  <h1>Session {{ psdict.name.1 }}</h1>
  <table class="listtable shortpadded" width="80%">
    {% for attr in attrs %}
    {% for key,value in psdict.items %}
    {% if key == attr %}
    <tr>
      <td><b>{{ value.0 }}</b></td><td>{{ value.1 }}</td>
    </tr>
    {% endif %}
    {% endfor %}
    {% endfor %}
  </table>
</div>
<div id="right" class="grid_6 omega">
  <h1>Workouts attached</h1>
  <table class="listtable shortpadded" width="80%">
    <thead>
      <tr>
        <th>Date</th>
        <th>Name</th>
        <th>Distance</th>
        <th>Duration</th>
      </tr>
    </thead>
    <tbody>
    {% for workout in workouts %}
    <tr>
          <td> {{ workout.date|date:"Y-m-d" }} </td>
          <td>
            <a href={% url manager.defaultlandingpage id=workout.id %}>
              {{ workout.name }}
            </a>
          </td>
          <td> {{ workout.distance }}m</td>
          <td> {{ workout.duration |durationprint:"%H:%M:%S.%f" }} </td>      
    </tr>
    {% endfor %}
    </tbody>
  </table>
</div>
</div>
<div class="grid_12 alpha">
<div id="left" class="grid_6 alpha">
  <h1>Result</h1>
  <p>Status: {{ status }}</p>
  <p>Percentage complete: {{ ratio }} </p>
</div>
<div id="right" class="grid_6 omega">
  <h1>Stats</h1>
  <table class="listtable shortpadded" width="80%">
    <thead>
      <tr>
        <th>Name</th>
        <th>Minutes</th>
        <th>Meters</th>
        <th>rScore</th>
        <th>TRIMP</th>
      </tr>
    </thead>
    <tbody>
      {% for id, value in results.items %}
      <tr>
        <td>{{ value|lookup:'first_name' }} {{ value|lookup:'last_name' }}</td>
        <td>{{ value|lookup:'duration' }}</td>
        <td>{{ value|lookup:'distance' }}</td>
        <td>{{ value|lookup:'rscore' }}</td>
        <td>{{ value|lookup:'trimp' }}</td>
      </tr>
      {% endfor %}
    </tbody>
  </table>
</div>
</div>

{% endblock %}
