147 lines
3.9 KiB
HTML
147 lines
3.9 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/multicreate/today/rower/{{ rower.id }}">
|
|
Today
|
|
</a>
|
|
<a class="button gray small alpha"
|
|
href="/rowers/sessions/multicreate/thisweek/rower/{{ rower.id }}">
|
|
This Week
|
|
</a>
|
|
<a class="button gray small alpha"
|
|
href="/rowers/sessions/multicreate/thismonth/rower/{{ rower.id }}">
|
|
This Month
|
|
</a>
|
|
<a class="button gray small alpha"
|
|
href="/rowers/sessions/multicreate/lastweek/rower/{{ rower.id }}">
|
|
Last Week
|
|
</a>
|
|
<a class="button gray small alpha"
|
|
href="/rowers/sessions/multicreate/lastmonth/rower/{{ rower.id }}">
|
|
Last 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/multicreate/{{ timeperiod }}/rower/{{ member.id }}">{{ member.user.first_name }} {{ member.user.last_name }}</a>
|
|
{% endfor %}
|
|
</div>
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
|
|
<div class="grid_12 alpha">
|
|
<p>
|
|
On this page, you can create and edit sessions for an entire time
|
|
period.
|
|
</p>
|
|
<form id="ps-form-table" method="post">
|
|
{% csrf_token %}
|
|
{{ ps_formset.management_form }}
|
|
<table width="100%">
|
|
<thead>
|
|
<tr>
|
|
<th> </th>
|
|
{% for field in ps_formset.0.visible_fields %}
|
|
<td>{{ field.label_tag }}</td>
|
|
{% endfor %}
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for form in ps_formset %}
|
|
<tr id="id_form_row">
|
|
<td> {{ forloop.counter }}
|
|
{% if form.instance.pk %}{{ form.DELETE }}{% endif %}
|
|
{{ form.id }}
|
|
{% for field in form.hidden_fields %}
|
|
{{ field }}
|
|
{% endfor %}
|
|
{% for field in form.visible_fields %}
|
|
<td>
|
|
{{ field }}
|
|
</td>
|
|
{% endfor %}
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
<a class="button gray small grid_2" href="/rowers/sessions/multicreate/thisweek/rower/{{ rower.id }}/extra/{{ extrasessions }}">Add More</a>
|
|
<button class="button green small grid_2" type="submit">Submit</button>
|
|
</form>
|
|
|
|
</div>
|
|
{% endblock %}
|
|
|
|
{% block scripts %}
|
|
|
|
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
|
|
<script src="/static/js/jquery.formset.js"></script>
|
|
<script>
|
|
$(document).ready(function(){
|
|
|
|
$('#ps-form-table tbody tr').formset({
|
|
addText: ''
|
|
});
|
|
|
|
$("td #id_sessionmode").change(function() {
|
|
|
|
if (this.value == 'TRIMP') {
|
|
$("td #id_sessionunit").prop("value","None");
|
|
}
|
|
if (this.value == 'distance') {
|
|
$("td #id_sessionunit").prop("value","m");
|
|
}
|
|
if (this.value == 'time') {
|
|
$("td #id_sessionunit").prop("value","min");
|
|
}
|
|
|
|
if (this.value == 'rScore') {
|
|
$("td #id_sessionunit").prop("value","None");
|
|
}
|
|
|
|
});
|
|
|
|
$("td #id_sessiontype").change(function() {
|
|
|
|
if (this.value == 'session') {
|
|
$("td #id_criterium").prop("value","none");
|
|
}
|
|
if (this.value == 'test') {
|
|
$("td #id_criterium").prop("value","exact");
|
|
}
|
|
if (this.value == 'challenge') {
|
|
$("td #id_criterium").prop("value","minimum");
|
|
}
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|
|
});
|
|
|
|
</script>
|
|
{% endblock %}
|