Private
Public Access
1
0
Files
rowsandall/rowers/templates/plannedsession_multicreate.html
2018-02-14 11:27:17 +01:00

152 lines
4.5 KiB
HTML

{% extends "base.html" %}
{% load staticfiles %}
{% load rowerfilters %}
{% block title %}Plan entire microcycle{% 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. You see a list of the current sessions planned for the
selected time period. Each row in the table is a session. You can
remove a session by clicking "remove" at the end of a row.
You can edit the date in the forms. If you need to add a new session,
click the "Add More" button to add a new session. Use the "Submit"
button to commit any changes you made.
</p>
<form id="ps-form-table" method="post">
{% csrf_token %}
{{ ps_formset.management_form }}
<table width="100%">
<thead>
<tr>
<th>&nbsp;</th>
{% for field in ps_formset.0.visible_fields %}
<td>{{ field.label_tag }}</td>
{% endfor %}
</tr>
</thead>
<tbody>
{% for form in ps_formset %}
<tr class="session_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: ''
});
$("tr.session_form_row").each(function() {
var myrow = this;
$( myrow ).find('*[id*=sessionmode]').change(function() {
if (this.value == 'TRIMP') {
$( myrow ).find("*[id*=sessionunit]").prop('value','None');
}
if (this.value == 'distance') {
$( myrow ).find("*[id*=sessionunit]").prop('value','m');
}
if (this.value == 'time') {
$( myrow ).find("*[id*=sessionunit]").prop('value','min');
}
if (this.value == 'rScore') {
$( myrow ).find("*[id*=sessionunit]").prop('value','None');
}
});
$( myrow ).find('*[id*=sessionunit]').change(function() {
if (this.value == 'km') {
$( myrow ).find("*[id*=sessionmode]").prop('value','distance');
}
if (this.value == 'm') {
$( myrow ).find("*[id*=sessionmode]").prop('value','distance');
}
if (this.value == 'None') {
$( myrow ).find("*[id*=sessionmode]").prop('value','rScore');
}
if (this.value == 'min') {
$( myrow ).find("*[id*=sessionmode]").prop('value','time');
}
});
});
});
</script>
{% endblock %}