khana/templates/gymnast_scores.html

158 lines
6.4 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>
<td>
<a href="{% url 'score_update' score.id %}">
<span class="tim-icons icon-pencil text-warning"></span>
</a>
</td>
<td class="text-left"><a href="{% url 'event_details' score.event.id %}">{{ score.event.name }}</a></td>
<td class="text-center">{{ score.event.datebegin | date:"d-m-Y" }}</td>
<td class="text-center">{{ 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],]
});
});
</script>
{% else %}
<p>No scores to display.</p>
{% endif %}
</div>
<div class="card-footer text-right text-muted pt-0">
<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>
<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:"m/d/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:"m/d/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:"m/d/Y" }}',
y: '{{ score.total }}'
},
{% 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>