188 lines
8.0 KiB
HTML
188 lines
8.0 KiB
HTML
{% load has_group %}
|
||
|
||
<div class="row justify-content-center ml-1">
|
||
<div class="col-12">
|
||
<div class="card mb-4">
|
||
<div class="card-header">
|
||
<div class="row">
|
||
<div class="col-8">
|
||
<h4>Season Informations</h4>
|
||
</div>
|
||
{% if request.user|has_group:"trainer" %}
|
||
<div class="col-1 ml-auto">
|
||
<div class="text-right">
|
||
<a href="{% url 'season_information_create_for_gymnast' gymnast.id %}">
|
||
<button type="submit" value="add" class="btn btn-icon btn-warning ">
|
||
<i class="fas fa-plus"></i>
|
||
</button>
|
||
</a>
|
||
</div>
|
||
</div>
|
||
{% endif %}
|
||
</div>
|
||
</div>
|
||
<div class="card-body pt-0">
|
||
{% if season_information_list %}
|
||
<table class="table tablesorter table-striped mb-0" data-sort="table" id="score_table">
|
||
<thead>
|
||
<tr>
|
||
<th></th>
|
||
<th class="header text-center">Season</th>
|
||
<th class="header text-center"># training/w</th>
|
||
<th class="header text-center"># hours/w</th>
|
||
<th class="header text-center"># S&C/w</th>
|
||
<th class="header text-center"># S&C hours/w</th>
|
||
<th class="header text-center">category</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
{% for season_information in season_information_list %}
|
||
<tr>
|
||
<td>
|
||
<a href="{% url 'season_information_update' season_information.id %}">
|
||
<span class="tim-icons icon-pencil text-warning"></span>
|
||
</a>
|
||
</td>
|
||
<td class="text-center">{{ season_information.season }}</td>
|
||
<td class="text-center">{{ season_information.number_of_training_sessions_per_week }}</td>
|
||
<td class="text-center"><b>{{ season_information.number_of_hours_per_week }}</b></td>
|
||
<td class="text-center">{{ season_information.number_of_s_and_c_sessions_per_week }}</td>
|
||
<td class="text-center"><b>{{ season_information.number_of_s_and_c_hours_per_week }}</b></td>
|
||
<td class="text-center"><b>{{ season_information.get_category_display }}</b></td>
|
||
</tr>
|
||
{% endfor %}
|
||
</tbody>
|
||
</table>
|
||
{% else %}
|
||
There are no scores corresponding to your criterias
|
||
{% endif %}
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<script type="text/javascript">
|
||
|
||
$('#span_week_button_generate').hide();
|
||
$('#span_week_comparison_button_generate').hide();
|
||
$('#span_month_button_generate').hide();
|
||
$('#span_season_button_generate').hide();
|
||
|
||
function check_comparison_fields(){
|
||
alert("check comparison fields")
|
||
if($('#select_week_number1').val() == '')
|
||
return false;
|
||
|
||
if($('#select_week_number2').val() == '')
|
||
return false;
|
||
|
||
if ($('#select_week_number2').val() == $('#select_week_number2').val())
|
||
return false;
|
||
|
||
return true;
|
||
}
|
||
|
||
function show_comparison_button(){
|
||
var tmp_url = "{% url 'gymnast_generate_report_week_comparison' gymnast.id '_season_source_' 9999 '_season_target_' 8888 %}";
|
||
|
||
season_source = $('#select_season_for_week1').val()
|
||
week_source = $('#select_week_number1').val()
|
||
season_target = $('#select_season_for_week2').val()
|
||
week_target = $('#select_week_number2').val()
|
||
|
||
target_url = tmp_url.replace('_season_source_', season_source).replace('9999', week_source).replace('_season_target_', season_target).replace('8888', week_target);
|
||
|
||
$('#week_comprison_pdf_link').attr('href', target_url);
|
||
$('#span_week_comparison_button_generate').show()
|
||
}
|
||
|
||
$('#select_season_for_week').change(function(){
|
||
var tmp_url = "{% url 'get_distinct_week_number_for_season_and_gymnast' gymnast.id '_season_label_' %}";
|
||
var season_label = $(this).children("option:selected").val();
|
||
target_url = tmp_url.replace('_season_label_', season_label);
|
||
|
||
$.getJSON(target_url, function(data) {
|
||
if (!$.trim(data))
|
||
$('#week_management').hide();
|
||
else
|
||
$('#week_management').show();
|
||
|
||
$("#select_week_number option").remove(); // Remove all <option> child tags.
|
||
$.each(data, function(key, value) { // Iterates through a collection
|
||
$("#select_week_number").append( // Append an object to the inside of the select box
|
||
$("<option></option>").text(value).val(value)
|
||
);
|
||
});
|
||
});
|
||
});
|
||
|
||
$('#select_season_for_week1').change(function(){
|
||
var test = check_comparison_fields();
|
||
if(test)
|
||
show_comparison_button();
|
||
else
|
||
$('#span_week_comparison_button_generate').hide();
|
||
});
|
||
|
||
$('#select_week_number1').change(function(){
|
||
var test = check_comparison_fields();
|
||
if(test)
|
||
show_comparison_button();
|
||
else
|
||
$('#span_week_comparison_button_generate').hide();
|
||
});
|
||
|
||
$('#select_season_for_week2').change(function(){
|
||
var test = check_comparison_fields();
|
||
if(test)
|
||
show_comparison_button();
|
||
else
|
||
$('#span_week_comparison_button_generate').hide();
|
||
});
|
||
|
||
$('#select_week_number2').change(function(){
|
||
var test = check_comparison_fields();
|
||
if(test)
|
||
show_comparison_button();
|
||
else
|
||
$('#span_week_comparison_button_generate').hide();
|
||
});
|
||
|
||
|
||
$('#select_week_number').change(function(){
|
||
if ($('#select_week_number').val() != "") {
|
||
var tmp_url = "{% url 'gymnast_report_export_for_week_number' gymnast.id '_season_label_' 9999 %}";
|
||
var season_label = $('#select_season_for_week').children("option:selected").val();
|
||
var week_number = $('#select_week_number').children("option:selected").val();
|
||
target_url = tmp_url.replace('_season_label_', season_label).replace('9999', week_number);
|
||
$('#week_pdf_link').attr('href', target_url);
|
||
$('#span_week_button_generate').show();
|
||
} else
|
||
$('#span_week_button_generate').hide();
|
||
});
|
||
|
||
$('#select_month_number').change(function(){
|
||
if ($('#select_month_number').val() != "") {
|
||
var tmp_url = "{% url 'gymnast_report_export_for_month_number' gymnast.id '_season_label_' 9999 %}";
|
||
var season_label = $('#select_season_for_month').children("option:selected").val();
|
||
var month_number = $('#select_month_number').children("option:selected").val();
|
||
target_url = tmp_url.replace('_season_label_', season_label).replace('9999', month_number);
|
||
$('#month_pdf_link').attr('href', target_url);
|
||
$('#span_month_button_generate').show();
|
||
} else
|
||
$('#span_month_button_generate').hide();
|
||
});
|
||
|
||
$('#select_season').change(function(){
|
||
if ($('#select_season').val() != "") {
|
||
var tmp_url = "{% url 'gymnast_report_export_for_season' gymnast.id '_season_label_' %}";
|
||
var season_label = $('#select_season').children("option:selected").val();
|
||
target_url = tmp_url.replace('_season_label_', season_label);
|
||
$('#season_pdf_link').attr('href', target_url);
|
||
$('#span_season_button_generate').show();
|
||
} else
|
||
$('#span_season_button_generate').hide();
|
||
});
|
||
|
||
</script>
|