221 lines
6.4 KiB
HTML
221 lines
6.4 KiB
HTML
{% extends "base.html" %}
|
|
{% load staticfiles %}
|
|
{% load rowerfilters %}
|
|
|
|
{% block title %}New 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>Create Sessions for {{ rower.user.first_name }} {{ rower.user.last_name }}</h1>
|
|
</div>
|
|
<div id="timeperiod" class="grid_2 dropdown">
|
|
<button class="grid_2 alpha button gray small dropbtn">Select Time Period ({{ timeperiod|verbosetimeperiod }})</button>
|
|
<div class="dropdown-content">
|
|
<a class="button gray small alpha"
|
|
href="/rowers/sessions/create/today/rower/{{ rower.id }}">
|
|
Today
|
|
</a>
|
|
<a class="button gray small alpha"
|
|
href="/rowers/sessions/create/thisweek/rower/{{ rower.id }}">
|
|
This Week
|
|
</a>
|
|
<a class="button gray small alpha"
|
|
href="/rowers/sessions/create/thismonth/rower/{{ rower.id }}">
|
|
This Month
|
|
</a>
|
|
<a class="button gray small alpha"
|
|
href="/rowers/sessions/create/lastweek/rower/{{ rower.id }}">
|
|
Last Week
|
|
</a>
|
|
<a class="button gray small alpha"
|
|
href="/rowers/sessions/create/lastmonth/rower/{{ rower.id }}">
|
|
Last Month
|
|
</a>
|
|
<a class="button gray small alpha"
|
|
href="/rowers/sessions/create/nextweek/rower/{{ rower.id }}">
|
|
Next Week
|
|
</a>
|
|
<a class="button gray small alpha"
|
|
href="/rowers/sessions/create/nextmonth/rower/{{ rower.id }}">
|
|
Next Month
|
|
</a>
|
|
</div>
|
|
</div>
|
|
{% if user.is_authenticated and user|is_manager %}
|
|
<div class="grid_2 dropdown">
|
|
<button class="grid_2 alpha button green small dropbtn">
|
|
Change Rower
|
|
</button>
|
|
<div class="dropdown-content">
|
|
{% for member in user|team_rowers %}
|
|
<a class="button green small" href="/rowers/sessions/create/{{ timeperiod }}/rower/{{ member.id }}">{{ member.user.first_name }} {{ member.user.last_name }}</a>
|
|
{% endfor %}
|
|
</div>
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
|
|
<div class="grid_12 alpha">
|
|
<div id="right" class="grid_6 alpha">
|
|
<h1>Plan</h1>
|
|
<p>
|
|
Click on session name to view
|
|
</p>
|
|
<table class="listtable shortpadded" width="80%">
|
|
<thead>
|
|
<tr>
|
|
<th>After</th>
|
|
<th>Before</th>
|
|
<th>Name</th>
|
|
<th>Value</th>
|
|
<th> </th>
|
|
<th>Edit</th>
|
|
<th>Clone</th>
|
|
<th>Delete</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for ps in plannedsessions %}
|
|
<tr>
|
|
<td> {{ ps.startdate|date:"Y-m-d" }} </td>
|
|
<td> {{ ps.enddate|date:"Y-m-d" }} </td>
|
|
<td>
|
|
{% if ps.name != '' %}
|
|
<a class="small"
|
|
href="/rowers/sessions/{{ ps.id }}">{{ ps.name }}</a>
|
|
{% else %}
|
|
<a class="small"
|
|
href="/rowers/sessions/{{ ps.id }}">Unnamed Session</a>
|
|
{% endif %}
|
|
</td>
|
|
<td> {{ ps.sessionvalue }} </td>
|
|
<td> {{ ps.sessionunit }} </td>
|
|
<td>
|
|
<a class="small" href="/rowers/sessions/{{ ps.id }}/edit/{{ timeperiod }}/rower/{{ rower.id }}">Edit</a>
|
|
</td>
|
|
<td>
|
|
<a class="small" href="/rowers/sessions/{{ ps.id }}/clone/{{ timeperoid }}/rower/{{ rower.id }}">Clone</a>
|
|
</td>
|
|
|
|
<td>
|
|
<a class="small" href="/rowers/sessions/{{ ps.id }}/deleteconfirm">Delete</a>
|
|
</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
|
|
|
|
<div class="grid_6 omega">
|
|
<h1>New Session</h1>
|
|
<form enctype="multipart/form-data" action="{{ formloc }}" method="post">
|
|
{% if form.errors %}
|
|
<p style="color: red;">
|
|
Please correct the error{{ form.errors|pluralize }} below.
|
|
</p>
|
|
{% endif %}
|
|
|
|
<table>
|
|
{{ form.as_table }}
|
|
</table>
|
|
{% csrf_token %}
|
|
<div id="formbutton" class="grid_1 prefix_4 suffix_1">
|
|
<input class="button green" type="submit" value="Save">
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
<div class="grid_6 prefix_6" id="id_guidance">
|
|
|
|
</div>
|
|
{% endblock %}
|
|
|
|
{% block scripts %}
|
|
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
|
|
<script>
|
|
$(document).ready(function(){
|
|
$("td #id_sessionmode").change(function() {
|
|
|
|
if (this.value == 'TRIMP') {
|
|
$("td #id_sessionunit").prop("value","None");
|
|
$('#id_guidance').html("<p>TRIMP has no unit</p>");
|
|
}
|
|
if (this.value == 'distance') {
|
|
$("td #id_sessionunit").prop("value","m");
|
|
$('#id_guidance').html("<p>Distance: Set value to meters</p>");
|
|
}
|
|
if (this.value == 'time') {
|
|
$("td #id_sessionunit").prop("value","min");
|
|
$('#id_guidance').html("<p>Time: Set value to minutes</p>");
|
|
}
|
|
|
|
if (this.value == 'rScore') {
|
|
$("td #id_sessionunit").prop("value","None");
|
|
$('#id_guidance').html("<p>rScore has no unit</p>");
|
|
}
|
|
|
|
});
|
|
|
|
$("td #id_sessiontype").change(function() {
|
|
|
|
if (this.value == 'session') {
|
|
$("td #id_criterium").prop("value","none");
|
|
$('#id_guidance').html("<p>For Training Sessions, the default criterium is 'Approximately'</p>");
|
|
}
|
|
if (this.value == 'test') {
|
|
$("td #id_criterium").prop("value","exact");
|
|
$("td #id_sessionmode").prop("value","distance");
|
|
$("td #id_sessionunit").prop("value","m");
|
|
$('#id_guidance').html("<p>Set mode to distance. For Mandatory Tests, only distance or time are allowed.</p><p>For Mandatory Tests, the only criterium is 'Exactly'</p>");
|
|
}
|
|
if (this.value == 'challenge') {
|
|
$("td #id_criterium").prop("value","minimum");
|
|
$('#id_guidance').html("<p>For Challenges, the default criterium is 'At Least'</p>");
|
|
}
|
|
|
|
if (this.value == 'cycletarget') {
|
|
$("td #id_criterium").prop("value","none");
|
|
$('#id_guidance').html("<p>For Cycle Targets, the default criterium is 'Approximately'</p>");
|
|
}
|
|
|
|
}
|
|
|
|
);
|
|
|
|
$("td #id_sessionunit").change(function() {
|
|
|
|
if (this.value == 'm') {
|
|
$("td #id_sessionmode").prop("value","distance");
|
|
$('#id_guidance').html("<p>Mode was set to distance</p>");
|
|
}
|
|
if (this.value == 'km') {
|
|
$("td #id_sessionmode").prop("value","distance");
|
|
$('#id_guidance').html("<p>Mode was set to distance</p>");
|
|
}
|
|
if (this.value == 'None') {
|
|
$("td #id_sessionmode").prop("value","rScore");
|
|
$('#id_guidance').html("<p>Mode was set to rScore</p>");
|
|
}
|
|
if (this.value == 'min') {
|
|
$("td #id_sessionmode").prop("value","time");
|
|
$('#id_guidance').html("<p>Mode was set to time</p>");
|
|
}
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|
|
|
|
});
|
|
|
|
</script>
|
|
{% endblock %}
|