Jarvis/jarvis/people/templates/gymnasts/tabs/tab_physiological.html

380 lines
14 KiB
HTML
Raw Normal View History

2023-07-05 09:33:03 +02:00
{% load static %}
2023-04-25 17:06:14 +02:00
<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>
2023-04-25 17:06:14 +02:00
</div>
<div class="card-body pt-0 pb-0 pr-0 pl-0">
{% if height_weight_list %}
<div><canvas id="chart_height_weight" 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="fas fa-plus"></i>
</button>
</a>
</div>
</div>
</div>
<div class="col-md-6">
<div class="card mb-4">
<div class="card-header">
2023-07-05 09:33:03 +02:00
<h4>Well Being</h4>
2023-04-25 17:06:14 +02:00
</div>
<div class="card-body pt-0 pb-0 pr-0 pl-0">
2023-07-05 09:33:03 +02:00
{% if wellbeing_list %}
2023-10-11 14:41:14 +02:00
<div><canvas id="chart_wellbeing" class="chartjs" width="400" height="200"></canvas></div>
2023-04-25 17:06:14 +02:00
{% else %}
2023-07-05 09:33:03 +02:00
<p class="pl-3 text-muted">No well being recorded for this gymnast.</p>
2023-04-25 17:06:14 +02:00
{% endif %}
</div>
<div class="card-footer text-right text-muted pt-0">
2023-07-05 09:33:03 +02:00
{% if wellbeing_list %}
<a href="{% url 'wellbeing_list_for_gymnast' gymnast_id %}">
2023-04-25 17:06:14 +02:00
<button type="submit" value="add" class="btn btn-icon btn-warning ">
<i class="fal fa-file-medical-alt"></i>
</button>
</a>
{% endif %}
2023-07-05 09:33:03 +02:00
<a href="{% url 'wellbeing_create_for_gymnast' gymnast_id %}">
2023-04-25 17:06:14 +02:00
<button type="submit" value="add" class="btn btn-icon btn-warning ">
<i class="fas fa-plus"></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">
2023-07-06 23:37:07 +02:00
<h4>Injuries</h4>
2023-04-25 17:06:14 +02:00
</div>
<div class="card-body pt-0 pb-0">
2023-07-06 23:37:07 +02:00
{% if injuries_list %}
<table class="table tablesorter table-striped table-condensed" id="injury_table">
2023-04-25 17:06:14 +02:00
<thead>
<tr>
<th style="width: 3%"></th>
<th class="header text-center" style="width: 10%">Date</th>
2023-07-06 23:37:07 +02:00
<th class="header text-left" style="width: 10%">Mechanism</th>
2023-10-11 12:12:01 +02:00
<th class="header text-left" style="width: 10%">Type</th>
2023-07-06 23:37:07 +02:00
<th class="header text-left" style="width: 25%">Location</th>
<th class="header text-left" style="width: 10%">Side</th>
<th class="header text-left" style="width: 25%">Skill</th>
2023-07-06 23:37:07 +02:00
<th class="header text-center" style="width: 10%"># Week Off</th>
2023-04-25 17:06:14 +02:00
</tr>
</thead>
<tbody>
2023-07-06 23:37:07 +02:00
{% for injury in injuries_list %}
2023-04-25 17:06:14 +02:00
<tr>
<td class="text-left">
2023-07-06 23:37:07 +02:00
<a href="{% url 'injury_update' injury.id %}">
2023-04-25 17:06:14 +02:00
&nbsp;<span class="tim-icons icon-pencil text-warning"></span>
</a>
</td>
2023-07-06 23:37:07 +02:00
<td class="text-center"><a href="{% url 'injury_details' injury.id %}">{{ injury.date | date:"d-m-Y" }}</a></td>
<td class="text-left">{{ injury.get_mechanism_display }}</td>
2023-10-11 14:35:53 +02:00
<td class="text-left">{{ injury.get_injury_type_display }}</td>
2023-07-06 23:37:07 +02:00
<td class="text-left">{{ injury.location }}</td>
<td class="text-left">{{ injury.get_body_side_display }}</td>
<td class="text-left">{% if injury.skill %}<a href="{% url 'skill_details' injury.skill.id %}">{{ injury.skill }}</a>{% else %}-{% endif %}</td>
2023-07-06 23:37:07 +02:00
<td class="text-center">{{ injury.nb_week_off }}</td>
2023-04-25 17:06:14 +02:00
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
2023-07-06 23:37:07 +02:00
<p class="text-muted">No injury known for this gymnast.</p>
2023-04-25 17:06:14 +02:00
{% endif %}
</div>
<div class="card-footer text-right text-muted pt-0">
2023-07-06 23:37:07 +02:00
<a href="{% url 'injury_create_for_gymnast' gymnast_id %}">
2023-04-25 17:06:14 +02:00
<button type="submit" value="add" class="btn btn-icon btn-warning ">
<i class="fas fa-plus"></i>
</button>
</a>
</div>
</div>
</div>
</div>
2023-07-05 09:33:03 +02:00
<script src="{% static "js/template_users/chart_gradient_color.js" %}"></script>
2023-04-25 17:06:14 +02:00
<script type="text/javascript">
var timeFormat = 'DD-MM-YYYY';
{% if height_weight_list %}
var ctx = document.getElementById("chart_height_weight").getContext("2d");
2023-07-05 09:33:03 +02:00
var border_color_pink = 'rgb(255, 99, 132)';
var gradient_stroke_pink = ctx.createLinearGradient(0, 230, 0, 50);
gradient_stroke_pink.addColorStop(1, 'rgba(255, 99, 132, 0.4)');
gradient_stroke_pink.addColorStop(0.75, 'rgba(255, 99, 132, 0.3)');
gradient_stroke_pink.addColorStop(0.5, 'rgba(255, 99, 132, 0.2)');
gradient_stroke_pink.addColorStop(0.25, 'rgba(255, 99, 132, 0)');
2023-04-25 17:06:14 +02:00
2023-07-05 09:33:03 +02:00
var border_color_orange = 'rgb(255, 159, 64)';
var gradient_stroke_orange = ctx.createLinearGradient(0, 230, 0, 50);
gradient_stroke_orange.addColorStop(1, 'rgba(255, 159, 64, 0.4)');
gradient_stroke_orange.addColorStop(0.75, 'rgba(255, 159, 64, 0.3)');
gradient_stroke_orange.addColorStop(0.5, 'rgba(255, 159, 64, 0.2)');
gradient_stroke_orange.addColorStop(0.25, 'rgba(255, 159, 64, 0)');
2023-04-25 17:06:14 +02:00
var height_values = [
{% for height_weight in height_weight_list %}
{
x: '{{ height_weight.date | date:"d-m-Y" }}',
y: '{{ height_weight.weight }}'
},
{% endfor %}
]
var weight_values = [
{% for height_weight in height_weight_list %}
{
x: '{{ height_weight.date | date:"d-m-Y" }}',
y: '{{ height_weight.height | add:"-100" }}'
},
{% endfor %}
]
var height_weight_data = {
datasets: [
{
label: 'Weight',
cubicInterpolationMode: 'monotone',
2023-07-05 09:33:03 +02:00
backgroundColor: gradient_stroke_pink,
borderColor: border_color_pink,
pointBackgroundColor: border_color_pink,
2023-04-25 17:06:14 +02:00
fill: true,
data: height_values,
},
{
label: 'Height',
cubicInterpolationMode: 'monotone',
2023-07-05 09:33:03 +02:00
backgroundColor: gradient_stroke_orange,
borderColor: border_color_orange,
pointBackgroundColor: border_color_orange,
2023-04-25 17:06:14 +02:00
fill: true,
data: weight_values
},
],
};
new Chart(ctx, {
responsive: true,
type: 'line',
data: height_weight_data,
options: {
scales: {
x: {
type: 'time',
display: true,
scaleLabel: {
display: true,
labelString: 'Date',
ticks: {
autoSkip: true,
source: 'data',
},
},
time: {
parser: timeFormat,
tooltipFormat: 'LL',
round: 'day',
},
},
},
plugins: {
legend: {
display: true,
position: 'bottom',
}
}
},
});
{% endif %}
2023-07-05 09:33:03 +02:00
{% if wellbeing_list %}
2023-10-11 14:35:53 +02:00
var ctx = document.getElementById("chart_wellbeing").getContext("2d");
2023-04-25 17:06:14 +02:00
2023-07-05 09:33:03 +02:00
var border_color_pink = 'rgb(255, 99, 132)';
var gradient_stroke_pink = ctx.createLinearGradient(0, 230, 0, 50);
gradient_stroke_pink.addColorStop(1, 'rgba(255, 99, 132, 0.4)');
gradient_stroke_pink.addColorStop(0.75, 'rgba(255, 99, 132, 0.3)');
gradient_stroke_pink.addColorStop(0.5, 'rgba(255, 99, 132, 0.2)');
gradient_stroke_pink.addColorStop(0.25, 'rgba(255, 99, 132, 0)');
var border_color_orange = 'rgb(255, 159, 64)';
var gradient_stroke_orange = ctx.createLinearGradient(0, 230, 0, 50);
gradient_stroke_orange.addColorStop(1, 'rgba(255, 159, 64, 0.4)');
gradient_stroke_orange.addColorStop(0.75, 'rgba(255, 159, 64, 0.3)');
gradient_stroke_orange.addColorStop(0.5, 'rgba(255, 159, 64, 0.2)');
gradient_stroke_orange.addColorStop(0.25, 'rgba(255, 159, 64, 0)');
var border_color_green = 'rgb(75, 192, 192)';
var gradient_stroke_green = ctx.createLinearGradient(0, 230, 0, 50);
gradient_stroke_green.addColorStop(1, 'rgba(75, 192, 192, 0.4)');
gradient_stroke_green.addColorStop(0.75, 'rgba(75, 192, 192, 0.3)');
gradient_stroke_green.addColorStop(0.5, 'rgba(75, 192, 192, 0.2)');
gradient_stroke_green.addColorStop(0.25, 'rgba(75, 192, 192, 0)');
2023-10-11 14:35:53 +02:00
var border_color_blue = 'rgb(54, 162, 235)';
var gradient_stroke_blue = ctx.createLinearGradient(0, 230, 0, 50);
gradient_stroke_blue.addColorStop(1, 'rgba(54, 162, 235, 0.4)');
gradient_stroke_blue.addColorStop(0.75, 'rgba(54, 162, 235, 0.3)');
gradient_stroke_blue.addColorStop(0.5, 'rgba(54, 162, 235, 0.2)');
gradient_stroke_blue.addColorStop(0.25, 'rgba(54, 162, 235, 0)');
var border_color_yellow = 'rgb(255, 205, 86)';
var gradient_stroke_yellow = ctx.createLinearGradient(0, 230, 0, 50);
gradient_stroke_yellow.addColorStop(1, 'rgba(255, 205, 86, 0.4)');
gradient_stroke_yellow.addColorStop(0.75, 'rgba(255, 205, 86, 0.3)');
gradient_stroke_yellow.addColorStop(0.5, 'rgba(255, 205, 86, 0.2)');
gradient_stroke_yellow.addColorStop(0.25, 'rgba(255, 205, 86, 0)');
2023-04-25 17:06:14 +02:00
var mindstate_values = [
2023-07-05 09:33:03 +02:00
{% for wellbeing in wellbeing_list %}
2023-04-25 17:06:14 +02:00
{
2023-07-05 09:33:03 +02:00
x: '{{ wellbeing.date | date:"d-m-Y" }}',
2023-10-11 14:35:53 +02:00
y: '{{ wellbeing.mind_state }}'
2023-04-25 17:06:14 +02:00
},
{% endfor %}
2023-07-05 09:33:03 +02:00
];
var sleep_values = [
{% for wellbeing in wellbeing_list %}
{
x: '{{ wellbeing.date | date:"d-m-Y" }}',
y: '{{ wellbeing.sleep }}'
},
{% endfor %}
];
var stress_values = [
{% for wellbeing in wellbeing_list %}
{
x: '{{ wellbeing.date | date:"d-m-Y" }}',
y: '{{ wellbeing.stress }}'
},
{% endfor %}
];
var fatigue_values = [
{% for wellbeing in wellbeing_list %}
{
x: '{{ wellbeing.date | date:"d-m-Y" }}',
y: '{{ wellbeing.fatigue }}'
},
{% endfor %}
];
var muscle_soreness_values = [
{% for wellbeing in wellbeing_list %}
{
x: '{{ wellbeing.date | date:"d-m-Y" }}',
y: '{{ wellbeing.muscle_soreness }}'
},
{% endfor %}
];
2023-04-25 17:06:14 +02:00
2023-07-05 09:33:03 +02:00
var wellbeing_data = {
2023-04-25 17:06:14 +02:00
datasets: [
{
label: 'Mindstate',
cubicInterpolationMode: 'monotone',
2023-07-05 09:33:03 +02:00
backgroundColor: gradient_stroke_pink,
borderColor: border_color_pink,
pointBackgroundColor: border_color_pink,
2023-04-25 17:06:14 +02:00
fill: true,
data: mindstate_values,
},
2023-07-05 09:33:03 +02:00
{
label: 'Sleep',
cubicInterpolationMode: 'monotone',
backgroundColor: gradient_stroke_orange,
borderColor: border_color_orange,
pointBackgroundColor: border_color_orange,
fill: true,
data: sleep_values,
},
{
label: 'Stress',
cubicInterpolationMode: 'monotone',
backgroundColor: gradient_stroke_green,
borderColor: border_color_green,
pointBackgroundColor: border_color_green,
fill: true,
data: stress_values,
},
{
label: 'Fatigue',
cubicInterpolationMode: 'monotone',
2023-10-11 14:35:53 +02:00
backgroundColor: gradient_stroke_blue,
borderColor: border_color_blue,
pointBackgroundColor: border_color_blue,
2023-07-05 09:33:03 +02:00
fill: true,
data: fatigue_values,
},
2023-10-11 14:35:53 +02:00
{
label: 'Muscle',
cubicInterpolationMode: 'monotone',
backgroundColor: gradient_stroke_yellow,
borderColor: border_color_yellow,
pointBackgroundColor: border_color_yellow,
fill: true,
data: muscle_soreness_values,
},
2023-04-25 17:06:14 +02:00
],
};
new Chart(ctx, {
type: 'line',
2023-07-05 09:33:03 +02:00
data: wellbeing_data,
2023-04-25 17:06:14 +02:00
options: {
scales: {
x: {
type: 'time',
display: true,
scaleLabel: {
display: true,
labelString: 'Date',
ticks: {
autoSkip: true,
source: 'data',
},
},
time: {
parser: timeFormat,
tooltipFormat: 'LL',
round: 'day',
},
},
},
plugins: {
legend: {
2023-07-05 09:33:03 +02:00
display: true,
position: 'bottom',
2023-04-25 17:06:14 +02:00
}
}
},
});
{% endif %}
</script>