{% extends "almanac/base.html" %}

{% block title %} Almanac - {{chart}} {% endblock %}

{% block flag %}

{% endblock %}

{% block content %}
<td valign="top" bgcolor="white" width="565" colspan="2" style="padding:2px;">
  <h1>Almanac</h1>
  <h2>{{chart.place}} tides for {{chart.year}}</h2>
  <p>By month: <a href="jan">Jan</a> | <a href="feb">Feb</a> | <a href="mar">Mar</a> | <a href="apr">Apr</a> | <a href="may">May</a> | <a href="jun">Jun</a> | <a href="jul">Jul</a> | <a href="aug">Aug</a> | <a href="sep">Sep</a> | <a href="oct">Oct</a> | <a href="nov">Nov</a> | <a href="dec">Dec</a></p>
  {% load typogrify humanize %}
	<table id="tides" cellpadding=3 border=1>
		<colgroup>
			<col class="time">
			<col class="vzebra-odd" span="2">
			<col class="vzebra-even" span="2">
			<col class="vzebra-odd" span="2">
			<col class="vzebra-even" span="2">
		<thead>
	    <tr><th colspan=1>Date</th><th colspan=2>Tide 1</th><th colspan=2>Tide 2</th><th colspan=2>Tide 3</th><th colspan=2>Tide 4</th><th colspan=2>Sun</th><th colspan=2>Moon</th></tr>
		<tr><th></th><th>time</th><th>hgt</th><th>time</th><th>hgt</th><th>time</th><th>hgt</th><th>time</th><th>hgt</th><th>Rise</th><th>Set</th><th>Phase</th><th>Time</th></tr>
	</thead>	
	  <tbody>
        {% load almanac_tags %}
	{% for td in chart.tideday_set.all %} 
		<tr style="{% cycle 'background:#eee' 'background:#cdd' %}">
		  <td class="date">{{td.day.date|date:"M j"}}</td>
		  <td>{% bold_afternoon_time td.tide_1.time "%-I:%M"%}</td><td>{{td.tide_1.level|floatformat}}</td>
		  <td>{% bold_afternoon_time td.tide_2.time "%-I:%M" %}</td><td>{{td.tide_2.level|floatformat}}</td>
		  <td>{% bold_afternoon_time td.tide_3.time "%-I:%M" %}</td><td>{{td.tide_3.level|floatformat}}</td>
		  {% if td.tide_4 %}<td>{% bold_afternoon_time td.tide_4.time "%-I:%M" %}</td><td>{{td.tide_4.level|floatformat}}{% else %}<td colspan=2>---</td>{% endif %}</td>
		  <td>{% bold_afternoon_time td.day.sunrise "%-I:%M" %}</td>
		  <td>{% bold_afternoon_time td.day.sunset "%-I:%M" %}</td>
		  <td>{% ifnotequal td.day.get_moonphase_display None %}{{td.day.get_moonphase_display}}{% endifnotequal %}</td>
		  <td>{% bold_afternoon_time td.day.moonphase_time "%-I:%M" %}</td>
		</tr>		 
	{% endfor %}
	  </tbody>
	</table>
</td>
</tr>
{% endblock %}

{% block sidebar %}

{% endblock %}
