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



{% block title %}Graphs{% endblock %}

{% block content %}
<div id="workouts" class="grid_6 alpha">
<h1>Workouts</h1>
	{% if workouts %}
		<table class="listtable" width=100% >
		<thead>
		<tr>
			<th> Date</th>
			<th> Time</th>
			<th> Name</th>
			<th> Type</th>
			<th> Delete</th>
			<th> C2 upload</th>
		</tr>
		</thead>
		<tbody>
		{% for workout in workouts %}
		<tr>
			<td> {{ workout.date }} </td>
			<td> {{ workout.starttime }} </td>
			<td><a href="/rowers/workout/{{workout.id}}/edit"> {{ workout.name }}</a> </td>
			<td> {{ workout.workouttype }} </td>
			<td> <a href="/rowers/workout/{{ workout.id }}/deleteconfirm">D</td>
			{% if not workout.uploadedtoc2 %}
			<td> <a href="/rowers/workout/{{ workout.id }}/c2upload">C2</td>
			{% else %}
			<td> &nbsp; </td>
			{% endif %}
		</tr>

		{% endfor %}
		</table>
		</tbody>
	{% else %}
		<p>No workouts found</p>
	{% endif %}

</div>

<div id="graphs" class="grid_6 omega">
<h1>Recent Graphs</h1>
	{% if graphs1 %}

		{% for graph in graphs1 %}
			{% if forloop.counter == 1 %}
		<div id="thumb-container" class="grid_2 alpha">
		<a href="/rowers/graph/{{ graph.id }}/">
		<img src="/{{ graph.filename }}" 
			onerror="this.src='/static/img/waiting.png'"
			alt="{{ graph.filename }}" width="120" height="100"></a>
		</div>	
			{% elif forloop.counter == 3 %}
		<div id="thumb-container" class="grid_2 omega">
		<a href="/rowers/graph/{{ graph.id }}/">
		<img src="/{{ graph.filename }}" 
			onerror="this.src='/static/img/waiting.png'"
			alt="{{ graph.filename }}" width="120" height="100"></a>
		</div>	

			{% else %}
		<div id="thumb-container" class="grid_2">
		<a href="/rowers/graph/{{ graph.id }}/">
		<img src="/{{ graph.filename }}" 
			onerror="this.src='/static/img/waiting.png'"
			alt="{{ graph.filename }}" width="120" height="100"></a>
		</div>
			{% endif %}
		{% endfor %}


		{% for graph in graphs2 %}
			{% if forloop.counter == 1 %}
		<div id="thumb-container" class="grid_2 alpha">
		<a href="/rowers/graph/{{ graph.id }}/">
		<img src="/{{ graph.filename }}" 
			onerror="this.src='/static/img/waiting.png'"
			alt="{{ graph.filename }}" width="120" height="100"></a>
		</div>	
			{% elif forloop.counter == 3 %}
		<div id="thumb-container" class="grid_2 omega">
		<a href="/rowers/graph/{{ graph.id }}/">
		<img src="/{{ graph.filename }}" 
			onerror="this.src='/static/img/waiting.png'"
			alt="{{ graph.filename }}" width="120" height="100"></a>
		</div>	

			{% else %}
		<div id="thumb-container" class="grid_2">
		<a href="/rowers/graph/{{ graph.id }}/">
		<img src="/{{ graph.filename }}" 
			onerror="this.src='/static/img/waiting.png'"
			alt="{{ graph.filename }}" width="120" height="100"></a>
		</div>
			{% endif %}
		{% endfor %}




	{% else %}
		<p> No graphs found </p>
	{% endif %}
</div>
{% endblock %}
