done manual add and user_analysis_select
This commit is contained in:
@@ -14,6 +14,31 @@
|
|||||||
</script>
|
</script>
|
||||||
<script>
|
<script>
|
||||||
$( document ).ready(function() {
|
$( document ).ready(function() {
|
||||||
|
var boattypes = {
|
||||||
|
'1x': '1x (single)',
|
||||||
|
'2x': '2x (double)',
|
||||||
|
'2x+': '2x+ (coxed double)',
|
||||||
|
'2-': '2- (pair)',
|
||||||
|
'2+': '2+ (coxed pair)',
|
||||||
|
'3x+': '3x+ (coxed triple)',
|
||||||
|
'3x-': '3x- (triple)',
|
||||||
|
'4x': '4x (quad)',
|
||||||
|
'4x+': '4x+ (coxed quad)',
|
||||||
|
'4-': '4- (four)',
|
||||||
|
'4+': '4+ (coxed four)',
|
||||||
|
'8+': '8+ (eight)',
|
||||||
|
'8x+': '8x+ (octuple scull)',
|
||||||
|
}
|
||||||
|
|
||||||
|
var ergtypes = {
|
||||||
|
'static': 'Concept2 static',
|
||||||
|
'dynamic': 'Concept2 dynamic',
|
||||||
|
'slides': 'Concept2 slides',
|
||||||
|
'rp3': 'RP3',
|
||||||
|
'waterrower': 'Water Rower',
|
||||||
|
'other': 'Other Indoor Rower',
|
||||||
|
}
|
||||||
|
|
||||||
$('#id_workouttype').on('change', function(){
|
$('#id_workouttype').on('change', function(){
|
||||||
if (
|
if (
|
||||||
$(this).val() == 'water'
|
$(this).val() == 'water'
|
||||||
@@ -21,11 +46,47 @@ $( document ).ready(function() {
|
|||||||
|| $(this).val() == 'c-boat'
|
|| $(this).val() == 'c-boat'
|
||||||
|| $(this).val() == 'churchboat'
|
|| $(this).val() == 'churchboat'
|
||||||
) {
|
) {
|
||||||
$('#id_boattype').toggle(true);
|
var $el = $('#id_boattype');
|
||||||
|
$el.empty();
|
||||||
|
$.each(boattypes, function(key,value) {
|
||||||
|
if ( key == '{{ workout.boattype }}') {
|
||||||
|
$el.append($("<option></option").attr("value", key).attr("selected", "selected").text(value));
|
||||||
} else {
|
} else {
|
||||||
|
$el.append($("<option></option").attr("value", key).text(value));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$el.toggle(true);
|
||||||
|
|
||||||
|
}
|
||||||
|
else if (
|
||||||
|
$(this).val() == 'rower'
|
||||||
|
) {
|
||||||
|
var $el = $('#id_boattype');
|
||||||
|
$el.empty();
|
||||||
|
$.each(ergtypes, function(key,value) {
|
||||||
|
if ( key == '{{ workout.boattype }}') {
|
||||||
|
$el.append($("<option></option").attr("value", key).attr("selected", "selected").text(value));
|
||||||
|
} else {
|
||||||
|
$el.append($("<option></option").attr("value", key).text(value));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$el.toggle(true);
|
||||||
|
}
|
||||||
|
else {
|
||||||
$('#id_boattype').toggle(false);
|
$('#id_boattype').toggle(false);
|
||||||
$('#id_boattype').val('1x');
|
$('#id_boattype').val('1x');
|
||||||
}
|
}
|
||||||
|
if (
|
||||||
|
$(this).val() == 'rower'
|
||||||
|
|| $(this).val() == 'dynamic'
|
||||||
|
|| $(this).val() == 'slides'
|
||||||
|
) {
|
||||||
|
$('#id_dragfactor').toggle(true);
|
||||||
|
} else {
|
||||||
|
$('#id_dragfactor').toggle(false);
|
||||||
|
$('#id_dragfactor').val('0');
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
$('#id_workouttype').change();
|
$('#id_workouttype').change();
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -20,6 +20,30 @@
|
|||||||
// Get the form fields and hidden div
|
// Get the form fields and hidden div
|
||||||
var modality = $("#id_modality");
|
var modality = $("#id_modality");
|
||||||
var hidden = $("#id_waterboattype");
|
var hidden = $("#id_waterboattype");
|
||||||
|
var boattypes = {
|
||||||
|
'1x': '1x (single)',
|
||||||
|
'2x': '2x (double)',
|
||||||
|
'2x+': '2x+ (coxed double)',
|
||||||
|
'2-': '2- (pair)',
|
||||||
|
'2+': '2+ (coxed pair)',
|
||||||
|
'3x+': '3x+ (coxed triple)',
|
||||||
|
'3x-': '3x- (triple)',
|
||||||
|
'4x': '4x (quad)',
|
||||||
|
'4x+': '4x+ (coxed quad)',
|
||||||
|
'4-': '4- (four)',
|
||||||
|
'4+': '4+ (coxed four)',
|
||||||
|
'8+': '8+ (eight)',
|
||||||
|
'8x+': '8x+ (octuple scull)',
|
||||||
|
}
|
||||||
|
|
||||||
|
var ergtypes = {
|
||||||
|
'static': 'Concept2 static',
|
||||||
|
'dynamic': 'Concept2 dynamic',
|
||||||
|
'slides': 'Concept2 slides',
|
||||||
|
'rp3': 'RP3',
|
||||||
|
'waterrower': 'Water Rower',
|
||||||
|
'other': 'Other Indoor Rower',
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Hide the fields.
|
// Hide the fields.
|
||||||
@@ -30,6 +54,20 @@
|
|||||||
|
|
||||||
if (modality.val() == 'water') {
|
if (modality.val() == 'water') {
|
||||||
hidden.show();
|
hidden.show();
|
||||||
|
var $el = $('#id_waterboattype');
|
||||||
|
$el.empty();
|
||||||
|
$.each(boattypes, function(key,value) {
|
||||||
|
$el.append($("<option></option").attr("value", key).attr("selected", "selected").text(value));
|
||||||
|
});
|
||||||
|
$el.toggle(true);
|
||||||
|
} else if (modality.val() == 'rower') {
|
||||||
|
hidden.show();
|
||||||
|
var $el = $('#id_waterboattype');
|
||||||
|
$el.empty();
|
||||||
|
$.each(ergtypes, function(key,value) {
|
||||||
|
$el.append($("<option></option").attr("value", key).attr("selected", "selected").text(value));
|
||||||
|
});
|
||||||
|
$el.toggle(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -44,6 +82,24 @@
|
|||||||
if (otwtypes.includes(Value)) {
|
if (otwtypes.includes(Value)) {
|
||||||
// Show the hidden fields.
|
// Show the hidden fields.
|
||||||
hidden.show();
|
hidden.show();
|
||||||
|
var $el = $('#id_waterboattype');
|
||||||
|
var $label = $("label[for='"+$el.attr('id') + "']")
|
||||||
|
$el.empty();
|
||||||
|
$.each(boattypes, function(key,value) {
|
||||||
|
$el.append($("<option></option").attr("value", key).attr("selected", "selected").text(value));
|
||||||
|
});
|
||||||
|
$label.text("Water Boat Type")
|
||||||
|
$el.toggle(true);
|
||||||
|
} else if (Value == 'rower') {
|
||||||
|
hidden.show();
|
||||||
|
var $el = $('#id_waterboattype');
|
||||||
|
var $label = $("label[for='"+$el.attr('id') + "']")
|
||||||
|
$el.empty();
|
||||||
|
$.each(ergtypes, function(key,value) {
|
||||||
|
$el.append($("<option></option").attr("value", key).attr("selected", "selected").text(value));
|
||||||
|
});
|
||||||
|
$label.text("Erg Boat Type")
|
||||||
|
$el.toggle(true);
|
||||||
} else {
|
} else {
|
||||||
// Make sure that the hidden fields are indeed
|
// Make sure that the hidden fields are indeed
|
||||||
// hidden.
|
// hidden.
|
||||||
|
|||||||
Reference in New Issue
Block a user