Ultron/templates/people/gymnasts/physiological_followup.html

276 lines
10 KiB
HTML

<div class="row justify-content-center ml-1">
<div class="col-md-6">
<div class="card mb-4">
<div class="card-header">
<h4>Height/Weight</h4>
</div>
<div class="card-body pt-0 pb-0 pr-0 pl-0">
{% if height_weight_list %}
<div>
<canvas id="chartjs_height_weight_state" class="chartjs" width="400" height="200"></canvas>
</div>
{% else %}
<p class="pl-3 text-muted">No height/weight recorded for this gymnast.</p>
{% endif %}
</div>
<div class="card-footer text-right text-muted pt-0">
{% if height_weight_list %}
<a href="{% url 'heightweight_list_for_gymnast' gymnast_id %}">
<button type="submit" value="add" class="btn btn-icon btn-warning ">
<i class="fal fa-line-height"></i>
</button>
</a>
{% endif %}
<a href="{% url 'heightweight_create_for_gymnast' gymnast_id %}">
<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 class="col-md-6">
<div class="card mb-4">
<div class="card-header">
<h4>Mindstates</h4>
</div>
<div class="card-body pt-0 pb-0 pr-0 pl-0">
{% if mindstate_list %}
<div>
<canvas id="chartjs_mindstate" class="chartjs" width="400" height="200"></canvas>
</div>
{% else %}
<p class="pl-3 text-muted">No mindstate recorded for this gymnast.</p>
{% endif %}
</div>
<div class="card-footer text-right text-muted pt-0">
{% if mindstate_list %}
<a href="{% url 'mindstate_list_for_gymnast' gymnast_id %}">
<button type="submit" value="add" class="btn btn-icon btn-warning ">
<i class="fal fa-file-medical-alt"></i>
</button>
</a>
{% endif %}
<a href="{% url 'mindstate_create_for_gymnast' gymnast_id %}">
<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 class="row justify-content-center ml-1">
<div class="col-md-12">
<div class="card">
<div class="card-header">
<h4>Accidents</h4>
</div>
<div class="card-body pt-0 pb-0">
{% if accident_list %}
<table class="table tablesorter table-striped table-condensed" id="accident_table">
<thead>
<tr>
<th style="width: 3%"></th>
<th class="header text-center" style="width: 10%">Date</th>
<th class="header text-left" style="width: 50%">Skill</th>
<th class="header text-left" style="width: 40%"># Week Off</th>
</tr>
</thead>
<tbody>
{% for accident in accident_list %}
<tr>
<td class="text-left">
<a href="{% url 'accident_update' accident.id %}">
&nbsp;<span class="tim-icons icon-pencil text-warning"></span>
</a>
</td>
<td class="text-center"><a href="{% url 'accident_details' accident.id %}">{{ accident.date | date:"d-m-Y" }}</a></td>
<td class="text-left">{% if accident.skill %}<a href="{% url 'skill_details' accident.skill.id %}">{{ accident.skill }}</a>{% else %}-{% endif %}</td>
<td class="text-left">{{ accident.nb_week_off }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<p class="text-muted">No accident known for this gymnast.</p>
{% endif %}
</div>
<div class="card-footer text-right text-muted pt-0">
<a href="{% url 'accident_create_for_gymnast' gymnast_id %}">
<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">
// var xAxes = [{
// type: "time",
// time: {
// parser: 'DD-MM-YYYY',
// round: 'day'
// },
// scaleLabel: {
// display: true,
// }
// }];
var ctx = document.getElementById("chartjs_height_weight_state").getContext("2d");
var gradientStroke_1 = ctx.createLinearGradient(0, 230, 0, 50);
var gradientStroke_2 = ctx.createLinearGradient(0, 230, 0, 50);
gradientStroke_1.addColorStop(1, 'rgba(255, 99, 132, 0.4)');
gradientStroke_1.addColorStop(0.75, 'rgba(255, 99, 132, 0.3)');
gradientStroke_1.addColorStop(0.5, 'rgba(255, 99, 132, 0.2)');
gradientStroke_1.addColorStop(0.25, 'rgba(255, 99, 132, 0)');
gradientStroke_2.addColorStop(1, 'rgba(255, 159, 64, 0.4)');
gradientStroke_2.addColorStop(0.75, 'rgba(255, 159, 64, 0.3)');
gradientStroke_2.addColorStop(0.5, 'rgba(255, 159, 64, 0.2)');
gradientStroke_2.addColorStop(0.25, 'rgba(255, 159, 64, 0)');
var height_weight_data = {
datasets:[
{% if height_weight_list %}
{
label: 'Weight',
backgroundColor: gradientStroke_1,
borderColor: 'rgb(255, 99, 132)',
pointBackgroundColor: 'rgb(255, 99, 132)',
fill: true,
data: [
{% for height_weight in height_weight_list %}
{
x: '{{ height_weight.date | date:"d-m-Y" }}',
y: '{{ height_weight.weight }}'
},
{% endfor%}
]
},
{
label: 'Height',
backgroundColor: gradientStroke_2,
borderColor: 'rgb(255, 159, 64)',
pointBackgroundColor: 'rgb(255, 159, 64)',
fill: true,
data: [
{% for height_weight in height_weight_list %}
{
x: '{{ height_weight.date | date:"d-m-Y" }}',
y: '{{ height_weight.height | add:"-100" }}'
},
{% endfor%}
]
},
{% endif %}
],
};
new Chart(document.getElementById("chartjs_height_weight_state"),{
// tooltips: {
// backgroundColor: '#f5f5f5',
// titleFontColor: '#333',
// bodyFontColor: '#666',
// bodySpacing: 4,
// xPadding: 12,
// mode: "nearest",
// intersect: 0,
// position: "nearest"
// },
responsive: true,
type: 'line',
data: height_weight_data,
options: {
scales: {
xAxes: [{
type: "time",
time: {
parser: 'DD-MM-YYYY',
round: 'day'
},
scaleLabel: {
display: true,
}
}],
yAxes: [{
scaleLabel: {
display: true,
},
}],
},
legend: {
display: true,
position: 'bottom',
}
},
});
var ctx = document.getElementById("chartjs_mindstate").getContext("2d");
var gradient_stroke_1 = ctx.createLinearGradient(0, 230, 0, 50);
gradient_stroke_1.addColorStop(1, 'rgba(75, 192, 192, 0.4)');
gradient_stroke_1.addColorStop(0.75, 'rgba(75, 192, 192, 0.3)');
gradient_stroke_1.addColorStop(0.5, 'rgba(75, 192, 192, 0.2)');
gradient_stroke_1.addColorStop(0.25, 'rgba(75, 192, 192, 0)');
var mindstate_data = {
datasets:[
{% if mindstate_list %}
{
label: 'Mindstate',
backgroundColor: gradient_stroke_1,
borderColor: 'rgb(75, 192, 192)',
pointBackgroundColor: 'rgb(75, 192, 192)',
fill: true,
data: [
{% for state in mindstate_list %}
{
x: '{{ state.date | date:"d-m-Y" }}',
y: '{{ state.score }}'
},
{% endfor%}
]
},
{% endif %}
],
};
new Chart(document.getElementById("chartjs_mindstate"),{
type: 'line',
data: mindstate_data,
options: {
scales: {
xAxes: [{
type: "time",
time: {
parser: 'DD-MM-YYYY',
round: 'day'
},
scaleLabel: {
display: true,
}
}],
yAxes: [{
scaleLabel: {
display: true,
},
ticks: {
beginAtZero: true,
max: 10
}
}]
},
legend: {
display: false,
}
},
});
</script>