guidance added for plannedsession forms
This commit is contained in:
@@ -116,6 +116,9 @@
|
||||
<input class="button green" type="submit" value="Save">
|
||||
</div>
|
||||
</form>
|
||||
<div class="grid_6" id="id_guidance">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
@@ -123,69 +126,84 @@
|
||||
{% 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");
|
||||
}
|
||||
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");
|
||||
$("td #id_sessionmode").prop("value","distance");
|
||||
$("td #id_sessionunit").prop("value","m");
|
||||
}
|
||||
if (this.value == 'challenge') {
|
||||
$("td #id_criterium").prop("value","minimum");
|
||||
}
|
||||
|
||||
if (this.value == 'cycletarget') {
|
||||
$("td #id_criterium").prop("value","none");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
);
|
||||
|
||||
$("td #id_sessionunit").change(function() {
|
||||
|
||||
if (this.value == 'm') {
|
||||
$("td #id_sessionmode").prop("value","distance");
|
||||
}
|
||||
if (this.value == 'km') {
|
||||
$("td #id_sessionmode").prop("value","distance");
|
||||
}
|
||||
if (this.value == 'None') {
|
||||
$("td #id_sessionmode").prop("value","rScore");
|
||||
}
|
||||
if (this.value == 'min') {
|
||||
$("td #id_sessionmode").prop("value","time");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
);
|
||||
|
||||
|
||||
$("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 %}
|
||||
|
||||
Reference in New Issue
Block a user