khana/templates/gymnast_scores_chrono.html

615 lines
22 KiB
HTML

<div class="row justify-content-center ml-3 pr-0">
<div class="col-md-12 pr-0">
<div class="card">
<div class="card-header">
<h4>Scores</h4>
</div>
<div class="card-body pt-0 pb-0">
{% if score_list %}
<div>
<canvas id="chartjs_routine" class="chartjs" width="400" height="200"></canvas>
</div>
<table class="table tablesorter table-striped table-condensed" id="scores_table">
<thead>
<tr>
<th style="width: 3%"></th>
<th style="width: 35%" class="header text-left">Event</th>
<th style="width: 10%" class="header text-center">Date</th>
<th style="width: 10%" class="header text-center">Routine</th>
<th style="width: 7%" class="header text-center">Exe.</th>
<th style="width: 7%" class="header text-center">Dif.</th>
<th style="width: 7%" class="header text-center">ToF</th>
<th style="width: 7%" class="header text-center">HD</th>
<th style="width: 7%" class="header text-center">Pen.</th>
<th style="width: 7%" class="header text-center">Total</th>
</tr>
</thead>
<tbody>
{% for score in score_list %}
<tr class="routine_{{ score.routine_type }}">
<td>
<a href="{% url 'score_update' score.id %}">
<button type="button" rel="tooltip" class="btn btn-link btn-sm btn-icon">
<span class="tim-icons icon-pencil text-warning"></span>
</button>
</a>
</td>
<td class="text-left"><a href="{% url 'event_details' score.event.id %}">{{ score.event.name }}</a></td>
<td class="text-right">{{ score.event.datebegin | date:"d-m-Y" }}</td>
<td class="text-right">{{ score.get_routine_type_display }}</td>
<td class="text-right">{{ score.point_execution }}</td>
<td class="text-right">{{ score.point_difficulty }}</td>
<td class="text-right">{{ score.point_time_of_flight }}</td>
<td class="text-right">{{ score.point_horizontal_displacement }}</td>
<td class="text-center">-{% if score.penality > 0 %}{{ score.penality }}{% endif %}</td>
<td class="text-right"><b>{{ score.total }}</b></td>
</tr>
{% endfor %}
</tbody>
</table>
<script type="text/javascript">
$(document).ready(function() {
$('#scores_table').tablesorter({
headers: {
0: { sorter: false },
},
dateFormat: "uk",
sortList: [[2,0],]
});
$('#checkbox_l1, #checkbox_l2, #checkbox_l3').change(function(){
if($('#checkbox_l1').is(':checked'))
$('.routine_0').show();
else
$('.routine_0').hide();
if($('#checkbox_l2').is(':checked'))
$('.routine_1').show();
else
$('.routine_1').hide();
if($('#checkbox_l3').is(':checked'))
$('.routine_2').show();
else
$('.routine_2').hide();
{% if request.session.template == 1 %}
// now add stripes to alternating rows
$("#scores_table tr:visible").each(function(index){
// but first remove color that may have been added by previous changes:
$(this).css("background-color", "inherit");
if(index % 2 != 0)
$(this).css("background-color", "#f9f9f9");
});
{% endif %}
});
});
</script>
{% else %}
<p>No scores to display.</p>
{% endif %}
</div>
<div class="card-footer text-right text-muted pt-0 row justify-content-end">
<div class="col-4">
L1 <input type="checkbox" name="checkbox" class="bootstrap-switch" id="checkbox_l1" checked />
L2 <input type="checkbox" name="checkbox" class="bootstrap-switch" id="checkbox_l2" checked />
L3 <input type="checkbox" name="checkbox" class="bootstrap-switch" id="checkbox_l3" checked />
</div>
<div class="col-4 align-self-end">
<a href="{% url 'score_create_for_gymnast' gymnastid %}">
<button type="submit" value="add" class="btn btn-icon btn-warning ">
<i class="tim-icons icon-simple-add"></i>
</button>
</a>
</div>
</div>
</div>
</div>
</div>
<script type="text/javascript">
new Chart(document.getElementById("chartjs_routine"),{
type: 'line',
data:{
datasets:[
{% if score_routine1_list %}
{
label: 'L1',
backgroundColor: 'rgb(255, 99, 132, 0.25)',
borderColor: 'rgb(255, 99, 132)',
fill: true,
data: [
{% for score in score_routine1_list %}
{
x: '{{ score.event.datebegin | date:"d-m-Y" }}',
y: '{{ score.total }}'
},
{% endfor%}
]
},
{% endif %}
{% if score_routine2_list %}
{
label: 'L2',
backgroundColor: 'rgb(255, 159, 64, 0.25)',
borderColor: 'rgb(255, 159, 64)',
fill: true,
data: [
{% for score in score_routine2_list %}
{
x: '{{ score.event.datebegin | date:"d-m-Y" }}',
y: '{{ score.total }}'
},
{% endfor%}
]
},
{% endif %}
{% if score_routine3_list %}
{
label: 'L3',
backgroundColor: 'rgb(54, 162, 235, 0.25)',
borderColor: 'rgb(54, 162, 235)',
fill: true,
data: [
{% for score in score_routine3_list %}
{
x: '{{ score.event.datebegin | date:"d-m-Y" }}',
y: '{{ score.total }}'
},
{% endfor%}
]
},
{% endif %}
],
},
options: {
scales: {
xAxes: [{
type: "time",
time: {
format: 'DD-MM-YYYY',
round: 'day'
},
scaleLabel: {
display: true,
}
}, ],
yAxes: [{
scaleLabel: {
display: true,
}
}]
},
legend: {
display: true,
position: 'bottom',
}
},
});
</script>
<div class="row justify-content-center ml-3 pr-0">
<div class="col-md-12 pr-0">
<div class="card">
<div class="card-header">
<h4>Chrono</h4>
</div>
<div class="card-body">
{% if chrono_list %}
<div>
<!-- <canvas id="chartSimpleWithGradient"></canvas> -->
<canvas id="chartjs_chrono" class="chartjs" width="400" height="200"></canvas>
</div>
{% endif %}
<a href="{% url 'chrono_create_for_gym' gymnastid %}">
<button type="submit" value="add" class="btn btn-icon btn-warning ">
<i class="tim-icons icon-simple-add"></i>
</button>
</a>
<!-- <div class="flextable table-actions">
<div class="flextable-item flextable-primary">
&nbsp;
</div>
<div class="flextable-item">
<div class="btn-group">
<button type="button" class="btn btn-primary-outline">
<a href="{% url 'chrono_create_for_gym' gymnastid %}"><span class="icon icon-plus"></span></a>
</button>
</div>
</div>
</div> -->
{% if chrono_list %}
<table class="table table-striped table-condensed tablesorter" id="chrono_table">
<thead>
<tr>
<th style="width: 5%">&nbsp;</th>
<th style="width: 10%" class="header">Date</th>
<th style="width: 35%" class="header text-left">Routine</th>
<th style="width: 25%" class="header">Type</th>
<th style="width: 25%" class="header text-center">Score</th>
</tr>
</thead>
<tbody>
{% for chrono in chrono_list %}
<tr>
<td>
<a href="{% url 'chrono_update' chrono.id %}">
<button type="button" rel="tooltip" class="btn btn-link btn-sm btn-icon">
<span class="tim-icons icon-pencil text-warning"></span>
</button>
</a>
</td>
<td>{{ chrono.date | date:"d-m-Y" }}</a></td>
<td class="text-left"><a href="{% url 'routine_details' chrono.routine.id %}">{{ chrono.routine.longLabel }}</a></td>
<td>{{ chrono.get_routine_type_display }}</td>
<td class="text-center">{{ chrono.score }}</td>
</tr>
{% endfor %}
</tbody>
</table>
<script type="text/javascript">
$(document).ready(function() {
$('#chrono_table').tablesorter({
headers: {
0: { sorter: false },
},
dateFormat: "uk",
sortList: [[1,1],]
});
});
</script>
{% else %}
No chrono results to display.
{% endif %}
</div>
</div>
</div>
</div>
<script type="text/javascript">
// gradientChartOptionsConfigurationPurple = {
// maintainAspectRatio: false,
// legend: {
// display: false
// },
// tooltips: {
// backgroundColor: '#f5f5f5',
// titleFontColor: '#333',
// bodyFontColor: '#666',
// bodySpacing: 4,
// xPadding: 12,
// mode: "nearest",
// intersect: 0,
// position: "nearest"
// },
// responsive: true,
// scales: {
// yAxes: [{
// barPercentage: 1.6,
// gridLines: {
// drawBorder: false,
// color: 'rgba(186,84,245,0.1)',
// zeroLineColor: "transparent",
// },
// ticks: {
// suggestedMin: 60,
// suggestedMax: 125,
// padding: 20,
// fontColor: "#9e9e9e"
// }
// }],
// xAxes: [{
// barPercentage: 1.6,
// gridLines: {
// drawBorder: false,
// color: 'rgba(186,84,245,0.1)',
// zeroLineColor: "transparent",
// },
// ticks: {
// padding: 20,
// fontColor: "#9e9e9e"
// }
// }]
// }
// };
// gradientChartOptionsConfigurationBlue = {
// maintainAspectRatio: false,
// legend: {
// display: false
// },
// tooltips: {
// backgroundColor: '#f5f5f5',
// titleFontColor: '#333',
// bodyFontColor: '#666',
// bodySpacing: 4,
// xPadding: 12,
// mode: "nearest",
// intersect: 0,
// position: "nearest"
// },
// responsive: true,
// scales: {
// yAxes: [{
// barPercentage: 1.6,
// gridLines: {
// drawBorder: false,
// color: 'rgba(29,140,248,0.0)',
// zeroLineColor: "transparent",
// },
// ticks: {
// suggestedMin: 60,
// suggestedMax: 125,
// padding: 20,
// fontColor: "#9e9e9e"
// }
// }],
// xAxes: [{
// barPercentage: 1.6,
// gridLines: {
// drawBorder: false,
// color: 'rgba(29,140,248,0.1)',
// zeroLineColor: "transparent",
// },
// ticks: {
// padding: 20,
// fontColor: "#9e9e9e"
// }
// }]
// }
// };
// gradientBarChartConfiguration = {
// maintainAspectRatio: false,
// legend: {
// display: false
// },
// tooltips: {
// backgroundColor: '#f5f5f5',
// titleFontColor: '#333',
// bodyFontColor: '#666',
// bodySpacing: 4,
// xPadding: 12,
// mode: "nearest",
// intersect: 0,
// position: "nearest"
// },
// responsive: true,
// scales: {
// yAxes: [{
// gridLines: {
// drawBorder: false,
// color: 'rgba(253,93,147,0.1)',
// zeroLineColor: "transparent",
// },
// ticks: {
// suggestedMin: 60,
// suggestedMax: 125,
// padding: 20,
// fontColor: "#9e9e9e"
// }
// }],
// xAxes: [{
// gridLines: {
// drawBorder: false,
// color: 'rgba(253,93,147,0.1)',
// zeroLineColor: "transparent",
// },
// ticks: {
// padding: 20,
// fontColor: "#9e9e9e"
// }
// }]
// }
// };
// gradientBarChartConfigurationWithGrid = {
// maintainAspectRatio: false,
// legend: {
// display: false
// },
// tooltips: {
// backgroundColor: '#f5f5f5',
// titleFontColor: '#333',
// bodyFontColor: '#666',
// bodySpacing: 4,
// xPadding: 12,
// mode: "nearest",
// intersect: 0,
// position: "nearest"
// },
// responsive: true,
// scales: {
// yAxes: [{
// gridLines: {
// drawBorder: false,
// color: 'rgba(253,93,147,0.1)',
// zeroLineColor: "transparent",
// },
// ticks: {
// suggestedMin: 60,
// suggestedMax: 125,
// padding: 20,
// fontColor: "#9e9e9e"
// }
// }],
// xAxes: [{
// gridLines: {
// drawBorder: false,
// color: 'rgba(253,93,147,0.1)',
// zeroLineColor: "transparent",
// },
// ticks: {
// padding: 20,
// fontColor: "#9e9e9e"
// }
// }]
// }
// };
// var ctx = document.getElementById("chartSimpleWithGradient").getContext("2d");
// var gradientStroke = ctx.createLinearGradient(0, 230, 0, 50);
// gradientStroke.addColorStop(1, 'rgba(72,72,176,0.4)');
// gradientStroke.addColorStop(0.8, 'rgba(72,72,176,0.2)');
// gradientStroke.addColorStop(0, 'rgba(119,52,169,0)'); //purple colors
// var myChart = new Chart(ctx, {
// type: 'line',
// responsive: true,
// data: {
// labels: ['JUL', 'AUG', 'SEP', 'OCT', 'NOV', 'DEC'],
// datasets: [{
// label: "Data",
// fill: true,
// backgroundColor: gradientStroke,
// borderColor: '#ba54f5',
// borderWidth: 2,
// borderDash: [],
// borderDashOffset: 0.0,
// pointBackgroundColor: '#be55ed',
// pointBorderColor: 'rgba(255,255,255,0)',
// pointHoverBackgroundColor: '#be55ed',
// //pointHoverBorderColor:'rgba(35,46,55,1)',
// pointBorderWidth: 20,
// pointHoverRadius: 4,
// pointHoverBorderWidth: 15,
// pointRadius: 4,
// data: [80, 100, 70, 80, 120, 80],
// }]
// },
// options: gradientChartOptionsConfigurationPurple
// });
/*
red: 'rgb(255, 99, 132)',
orange: 'rgb(255, 159, 64)',
yellow: 'rgb(255, 205, 86)',
green: 'rgb(75, 192, 192)',
blue: 'rgb(54, 162, 235)',
purple: 'rgb(153, 102, 255)',
grey: 'rgb(201, 203, 207)'
http://www.chartjs.org/samples/latest/scales/time/line-point-data.html
*/
new Chart(document.getElementById("chartjs_chrono"),{
type: 'line',
data:{
datasets:[
{% if chrono_10c %}
{
label: '10 |',
backgroundColor: 'rgb(75, 192, 192, 0.25)',
borderColor: 'rgb(75, 192, 192)',
fill: true,
data: [
{% for chrono in chrono_10c %}
{
x: '{{ chrono.date | date:"m/d/Y" }}',
y: '{{ chrono.score }}'
},
{% endfor%}
]
},
{% endif %}
{% if chrono_r1 %}
{
label: 'L1',
backgroundColor: 'rgb(54, 162, 235, 0.25)',
borderColor: 'rgb(54, 162, 235)',
fill: true,
data: [
{% for chrono in chrono_r1 %}
{
x: '{{ chrono.date | date:"m/d/Y" }}',
y: '{{ chrono.score }}'
},
{% endfor%}
]
},
{% endif %}
{% if chrono_r2 %}
{
label: 'L2',
backgroundColor: 'rgb(153, 102, 255, 0.25)',
borderColor: 'rgb(153, 102, 255)',
fill: true,
data: [
{% for chrono in chrono_r2 %}
{
x: '{{ chrono.date | date:"m/d/Y" }}',
y: '{{ chrono.score }}'
},
{% endfor%}
]
},
{% endif %}
{% if chrono_rf %}
{
label: 'L3',
backgroundColor: 'rgb(255, 205, 86, 0.25)',
borderColor: 'rgb(255, 205, 86)',
fill: true,
data: [
{% for chrono in chrono_rf %}
{
x: '{{ chrono.date | date:"m/d/Y" }}',
y: '{{ chrono.score }}'
},
{% endfor%}
]
},
{% endif %}
],
},
options: {
scales: {
xAxes: [{
type: "time",
time: {
format: 'MM/DD/YYYY',
round: 'day'
},
scaleLabel: {
display: true,
}
}, ],
yAxes: [{
scaleLabel: {
display: true,
}
}]
},
legend: {
display: true,
position: 'bottom',
}
},
});
</script>