{% extends "newbase.html" %}
{% load staticfiles %}
{% load rowerfilters %}
{% load tz %}

{% block scripts %}
{% include "monitorjobs.html" %}
{% endblock %}

{% block title %}Comment Workout {% endblock %}

{% block main %}
<p>
  {% if workout|previousworkout:rower.user %}
  <a href="/rowers/workout/{{ workout|previousworkout:rower.user }}/comment/"
     title="Jump to preceding workout"><em>Previous</em></a>&nbsp;
  {% endif %}
  {% if workout|nextworkout:rower.user %}
  <a href="/rowers/workout/{{ workout|nextworkout:rower.user }}/comment/"
     title="Jump to following workout"><em>Next</em></a>
  {% endif %}
</p>

<h1>Comments {{ workout.name }}</h1>
  
<ul class="main-content">
  <li class="grid_4">
    {% localtime on %}
    <table width=100%>
      <tr>
        <th>Rower:</th><td>{{ first_name }} {{ last_name }}</td>
      </tr><tr>
        <th>Date/Time:</th><td>{{ workout.startdatetime }}</td>
      </tr><tr>
        <th>Distance:</th><td>{{ workout.distance }}m</td>
      </tr><tr>
        <th>Duration:</th><td>{{ workout.duration |durationprint:"%H:%M:%S.%f" }}</td>
      </tr><tr>
        <th>Public link to this workout</th>
        <td>
	  <a href="/rowers/workout/{{ workout.id|encode }}/">https://rowsandall.com/rowers/workout/{{ workout.id|encode }}/</a>
        <td>
      </tr>
    </table>
    {% endlocaltime %}
  </li>
  <li class="grid_2">
    {% for c in comments %}
    <p>
      {{ c.created }}
      <b>{{ c.user.first_name }} {{ c.user.last_name }}</b>
      <div class="talk-bubble tri-right left-top">
        <div class="talktext">
          {{ c.comment }}
        </div>
      </div>
    </p>
    {% endfor %}
    <form enctype="multipart/form-data" action="/rowers/workout/{{ workout.id|encode }}/comment/" method="post">
      <table width=100%>
        {{ form.as_table }}
      </table>
      {% csrf_token %}
      <input type="submit" value="Save">
    </form>
  </li>
  {% for graph in graphs %}
  <li>
    <a href="/rowers/graph/{{ graph.id }}/">
    <img src="/{{ graph.filename }}" 
	 onerror="this.src='/static/img/rowingtimer.gif'"
	 alt="{{ graph.filename }}" width="120" height="100">
    </a>
  </li>
  {% endfor %}
  
  <li class="grid_2">
    <h1>Workout Summary</h1>
    
    <p>
      <pre>
        {{ workout.summary }}
      </pre>
    </p>
    
  </li>

  <li class="grid_2">
    <script src="https://cdn.pydata.org/bokeh/release/bokeh-1.0.4.min.js"></script>
    <script async="true" type="text/javascript">
      Bokeh.set_log_level("info");
    </script>
  
    {{ gmscript |safe }}
  
    <div id="mapdiv">
      {{ gmdiv|safe }}
    </div>
  </li>
</ul>

{% endblock %}

{% block sidebar %}
{% include 'menu_workout.html' %}
{% endblock %}
