{% extends "cvkbrnobase.html" %}
{% load i18n %}
{% load staticfiles %}
{% load rowerfilters %}
{% load tz %}

{% block title %}{% trans "Make a Reservation" %}{% endblock %}

{% block content %}
{% localtime on %}
<div id="workouts" class="grid_6 alpha">

    {% if form.errors %}
        <p style="color: red;">
            Please correct the error{{ form.errors|pluralize }} below.
        </p>
    {% endif %}

	<h1>{% trans "Make a reservation" %}</h1>


    <form enctype="multipart/form-data" action="" method="post">
        <table width=100%>
            {{ form.as_table }}
	<tr><th><label for="id_boat">{% trans "Boat:" %}</label></th>
		<td><select id="id_boat" name="boat">
		<option value="" selected="selected">---------</option>
		{% for boat in theboats %}
			<option value="{{ boat.id }}">{{boat.boatcode}} {{ boat.boatname }}</option>
		{% endfor %}
		</select></td>
	</tr>
        </table>
        {% csrf_token %}
   <div id="formbutton" class="grid_1 prefix_4 suffix_1">
        <input class="button green" type="submit" value="{% trans 'Save' %}">
   </div>
    </form>
</div>
<div id="reservations" class="grid_6 omega">
<h1>{% trans "Reservations" %}</h1>

<table class="listtable" width=100%>
<thead>
	<tr>
	<th>{% trans "Boat" %}</th>
	<th>{% trans "Date" %}</th>
	<th>{% trans "Departure time" %}</th>
	<th>{% trans "Return time" %}</th>
	<th>{% trans "Reserved by" %}</th>
	<th>{% trans "Delete" %}</th>
	</tr>
</thead>
<tbody>
	{% for outing in reservations %}
	<tr>
		<td> {{ outing.boat.boatname }} </td>
		<td> {{ outing.starttime |date:'d/m/y ' }} &nbsp;</td>
		<td> {{ outing.starttime |time:'H:i ' }} &nbsp;</td>
		<td> {{ outing.endtime |time:'H:i '}} &nbsp;</td>
		<td> {{ outing.rower.user.first_name }} {{ outing.rower.user.last_name }} </td>
		{% if user == outing.rower.user or thisclub_admin %}
		<td><a href="/cvkbrno/outing/{{ outing.id }}/delete">D</a></td>
		{% else %}
		<td>&nbsp;</td<
		{% endif %}
		<td>
	</tr>
	{% endfor %}
	
</tbody>
</table>

</div>

{% endlocaltime %}
{% endblock %}