Private
Public Access
1
0

some UI improvements on planned sessions

This commit is contained in:
Sander Roosendaal
2018-02-23 11:06:58 +01:00
parent 9e461810c3
commit f08ec40a8a
9 changed files with 192 additions and 60 deletions

View File

@@ -144,6 +144,19 @@
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<script>
$(document).ready(function(){
var o = $("td #id_sessiontype").find(":selected").val();
if (o != 'coursetest') {
$("td #id_course").hide();
$("th label[for='id_course']").hide();
} else {
$("td #id_course").show();
$("th label[for='id_course']").show();
}
$("td #id_sessionmode").change(function() {
if (this.value == 'TRIMP') {
@@ -178,6 +191,22 @@
$("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 == 'coursetest') {
$("th label[for='id_course']").show();
$("td #id_course").show();
$("td #id_criterium").prop("value","none");
$("td #id_sessionmode").prop("value","distance");
$("td #id_sessionunit").prop("value","m");
$('#id_guidance').html("<p>Set mode to distance. For OTW Tests, only distance is allowed.</p><p>The exact value is not relevant because it is calculated from the course.</p>");
}
if (this.value != 'coursetest') {
$("th label[for='id_course']").hide();
$("td #id_course").hide();
}
if (this.value == 'challenge') {
$("td #id_criterium").prop("value","minimum");
$('#id_guidance').html("<p>For Challenges, the default criterium is 'At Least'</p>");