Update wellbeing listing for a gymnast
This commit is contained in:
parent
c3cde290e9
commit
222cf41a95
|
@ -187,17 +187,8 @@
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
var timeFormat = 'DD-M-YYYY';
|
|
||||||
|
|
||||||
$('#injury_table').tablesorter({
|
|
||||||
headers: {
|
|
||||||
0: { sorter: false },
|
|
||||||
},
|
|
||||||
dateFormat: "uk",
|
|
||||||
sortList: [[1, 1]]
|
|
||||||
});
|
|
||||||
|
|
||||||
{% if height_weight_list %}
|
{% if height_weight_list %}
|
||||||
|
var timeFormat = 'DD-M-YYYY';
|
||||||
var ctx = document.getElementById("chart_height_weight").getContext("2d");
|
var ctx = document.getElementById("chart_height_weight").getContext("2d");
|
||||||
|
|
||||||
var border_color_pink = 'rgb(255, 99, 132)';
|
var border_color_pink = 'rgb(255, 99, 132)';
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
{% extends "listing.html" %}
|
{% extends "listing.html" %}
|
||||||
{% load has_group %}
|
{% load has_group %}
|
||||||
|
{% load static %}
|
||||||
|
|
||||||
{% block datacontent %}
|
{% block datacontent %}
|
||||||
<div class="row justify-content-center">
|
<div class="row justify-content-center">
|
||||||
|
@ -8,7 +9,17 @@
|
||||||
<div class="card-header row">
|
<div class="card-header row">
|
||||||
<div class="col-10 pr-0">
|
<div class="col-10 pr-0">
|
||||||
<h4 class="">
|
<h4 class="">
|
||||||
{% if gymnast %}<i>{% if gymnast.id in request.session.available_gymnast or request.user.is_superuser %}<a href="{% url 'gymnast_details_tab' gymnast.id 'physiological' %}"><i>{% endif %}{{ gymnast }}</i></a>'s {% endif %} Well being list
|
{% if gymnast %}
|
||||||
|
<i>
|
||||||
|
{% if gymnast.id in request.session.available_gymnast or request.user.is_superuser %}
|
||||||
|
<a href="{% url 'gymnast_details_tab' gymnast.id 'physiological' %}">
|
||||||
|
{% endif %}
|
||||||
|
{{ gymnast }}
|
||||||
|
</i>
|
||||||
|
{% if gymnast.id in request.session.available_gymnast or request.user.is_superuser %}
|
||||||
|
</a>
|
||||||
|
{% endif %}'s
|
||||||
|
{% endif %} Well being listing
|
||||||
</h4>
|
</h4>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-2 ml-auto pl-0">
|
<div class="col-2 ml-auto pl-0">
|
||||||
|
@ -24,71 +35,133 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
{% if wellbeing_list %}
|
{% if gymnast %}
|
||||||
<table class="table tablesorter table-striped mb-0" data-sort="table" id="mindstate_table">
|
<div class="row">
|
||||||
<thead>
|
<div class="col-md-6">
|
||||||
<tr>
|
<table class="table tablesorter table-striped mb-0" data-sort="table" id="mindstate_table">
|
||||||
<th></th>
|
<thead>
|
||||||
<th class="header text-left">Date</th>
|
<tr>
|
||||||
{% if not gymnast %}
|
<th></th>
|
||||||
<th class="header text-left">Gymnast</th>
|
<th class="header text-left">Date</th>
|
||||||
{% endif %}
|
<th class="header text-center">Mindstate</th>
|
||||||
<th class="header text-center">Mindstate</th>
|
<th class="header text-center">Sleep</th>
|
||||||
<th class="header text-center">Sleep</th>
|
<th class="header text-center">Stress</th>
|
||||||
<th class="header text-center">Stress</th>
|
<th class="header text-center">Fatigue</th>
|
||||||
<th class="header text-center">Fatigue</th>
|
<th class="header text-center">Muscle soreness</th>
|
||||||
<th class="header text-center">Muscle soreness</th>
|
</tr>
|
||||||
</tr>
|
</thead>
|
||||||
</thead>
|
<tbody>
|
||||||
<tbody>
|
{% for wellbeing in wellbeing_list %}
|
||||||
{% for wellbeing in wellbeing_list %}
|
<tr>
|
||||||
<tr>
|
<td>
|
||||||
<td>
|
<a href="{% url 'wellbeing_update' wellbeing.id %}">
|
||||||
<a href="{% url 'wellbeing_update' wellbeing.id %}">
|
<span class="tim-icons icon-pencil text-warning"></span>
|
||||||
<span class="tim-icons icon-pencil text-warning"></span>
|
</a>
|
||||||
</a>
|
</td>
|
||||||
</td>
|
<td class="text-left">
|
||||||
<td class="text-left">
|
{% if wellbeing.gymnast.id in request.session.available_gymnast or request.user.is_superuser %}<a href="{% url 'wellbeing_details' wellbeing.id %}">{% endif %}{{ wellbeing.date | date:"j-n-Y" }}</a>
|
||||||
{% if wellbeing.gymnast.id in request.session.available_gymnast or request.user.is_superuser %}<a href="{% url 'wellbeing_details' wellbeing.id %}">{% endif %}{{ wellbeing.date | date:"j-n-Y" }}</a>
|
</td>
|
||||||
</td>
|
<td class="text-center">
|
||||||
{% if not gymnast %}
|
{% if wellbeing.mindstate < 5%}<b><span class="text-danger">{% endif %}
|
||||||
<td class="text-left">
|
{{ wellbeing.mindstate }}
|
||||||
{% if wellbeing.gymnast.id in request.session.available_gymnast or request.user.is_superuser %}<a href="{% url 'gymnast_details_tab' wellbeing.gymnast.id 'physiological' %}">{% endif %}
|
{% if wellbeing.mindstate < 5%}</b></span>{% endif %}
|
||||||
{{ wellbeing.gymnast }}
|
</td>
|
||||||
</a>
|
<td class="text-center">
|
||||||
</td>
|
{% if wellbeing.sleep < 5%}<b><span class="text-danger">{% endif %}
|
||||||
{% endif %}
|
{{ wellbeing.sleep }}
|
||||||
<td class="text-right">
|
{% if wellbeing.sleep < 5%}</b></span>{% endif %}
|
||||||
{% if wellbeing.mindstate < 5%}<b><span class="text-danger">{% endif %}
|
</td>
|
||||||
{{ wellbeing.mindstate }}
|
<td class="text-center">
|
||||||
{% if wellbeing.mindstate < 5%}</b></span>{% endif %}
|
{% if wellbeing.stress > 5%}<b><span class="text-danger">{% endif %}
|
||||||
</td>
|
{{ wellbeing.stress }}
|
||||||
<td class="text-right">
|
{% if wellbeing.stress > 5%}</b></span>{% endif %}
|
||||||
{% if wellbeing.sleep < 5%}<b><span class="text-danger">{% endif %}
|
</td>
|
||||||
{{ wellbeing.sleep }}
|
<td class="text-center">
|
||||||
{% if wellbeing.sleep < 5%}</b></span>{% endif %}
|
{% if wellbeing.fatigue > 5%}<b><span class="text-danger">{% endif %}
|
||||||
</td>
|
{{ wellbeing.fatigue }}
|
||||||
<td class="text-right">
|
{% if wellbeing.fatigue > 5%}</b></span>{% endif %}
|
||||||
{% if wellbeing.stress > 5%}<b><span class="text-danger">{% endif %}
|
</td>
|
||||||
{{ wellbeing.stress }}
|
<td class="text-center">
|
||||||
{% if wellbeing.stress > 5%}</b></span>{% endif %}
|
{% if wellbeing.muscle_soreness > 5%}<b><span class="text-danger">{% endif %}
|
||||||
</td>
|
{{ wellbeing.muscle_soreness }}
|
||||||
<td class="text-right">
|
{% if wellbeing.muscle_soreness > 5%}</b></span>{% endif %}
|
||||||
{% if wellbeing.fatigue > 5%}<b><span class="text-danger">{% endif %}
|
</td>
|
||||||
{{ wellbeing.fatigue }}
|
</tr>
|
||||||
{% if wellbeing.fatigue > 5%}</b></span>{% endif %}
|
{% endfor %}
|
||||||
</td>
|
</tbody>
|
||||||
<td class="text-right">
|
</table>
|
||||||
{% if wellbeing.muscle_soreness > 5%}<b><span class="text-danger">{% endif %}
|
</div>
|
||||||
{{ wellbeing.muscle_soreness }}
|
<div class="col-md-6">
|
||||||
{% if wellbeing.muscle_soreness > 5%}</b></span>{% endif %}
|
<canvas id="chart_wellbeing" class="chartjs" width="400" height="200"></canvas>
|
||||||
</td>
|
</div>
|
||||||
</tr>
|
</div>
|
||||||
{% endfor %}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
{% else %}
|
{% else %}
|
||||||
<p class="text-muted">There are no well being corresponding to your criterias</p>
|
{% if wellbeing_list %}
|
||||||
|
<table class="table tablesorter table-striped mb-0" data-sort="table" id="mindstate_table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th></th>
|
||||||
|
<th class="header text-left">Date</th>
|
||||||
|
{% if not gymnast %}
|
||||||
|
<th class="header text-left">Gymnast</th>
|
||||||
|
{% endif %}
|
||||||
|
<th class="header text-center">Mindstate</th>
|
||||||
|
<th class="header text-center">Sleep</th>
|
||||||
|
<th class="header text-center">Stress</th>
|
||||||
|
<th class="header text-center">Fatigue</th>
|
||||||
|
<th class="header text-center">Muscle soreness</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{% for wellbeing in wellbeing_list %}
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<a href="{% url 'wellbeing_update' wellbeing.id %}">
|
||||||
|
<span class="tim-icons icon-pencil text-warning"></span>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
<td class="text-left">
|
||||||
|
{% if wellbeing.gymnast.id in request.session.available_gymnast or request.user.is_superuser %}<a href="{% url 'wellbeing_details' wellbeing.id %}">{% endif %}{{ wellbeing.date | date:"j-n-Y" }}</a>
|
||||||
|
</td>
|
||||||
|
{% if not gymnast %}
|
||||||
|
<td class="text-left">
|
||||||
|
{% if wellbeing.gymnast.id in request.session.available_gymnast or request.user.is_superuser %}<a href="{% url 'gymnast_details_tab' wellbeing.gymnast.id 'physiological' %}">{% endif %}
|
||||||
|
{{ wellbeing.gymnast }}
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
{% endif %}
|
||||||
|
<td class="text-right">
|
||||||
|
{% if wellbeing.mindstate < 5%}<b><span class="text-danger">{% endif %}
|
||||||
|
{{ wellbeing.mindstate }}
|
||||||
|
{% if wellbeing.mindstate < 5%}</b></span>{% endif %}
|
||||||
|
</td>
|
||||||
|
<td class="text-right">
|
||||||
|
{% if wellbeing.sleep < 5%}<b><span class="text-danger">{% endif %}
|
||||||
|
{{ wellbeing.sleep }}
|
||||||
|
{% if wellbeing.sleep < 5%}</b></span>{% endif %}
|
||||||
|
</td>
|
||||||
|
<td class="text-right">
|
||||||
|
{% if wellbeing.stress > 5%}<b><span class="text-danger">{% endif %}
|
||||||
|
{{ wellbeing.stress }}
|
||||||
|
{% if wellbeing.stress > 5%}</b></span>{% endif %}
|
||||||
|
</td>
|
||||||
|
<td class="text-right">
|
||||||
|
{% if wellbeing.fatigue > 5%}<b><span class="text-danger">{% endif %}
|
||||||
|
{{ wellbeing.fatigue }}
|
||||||
|
{% if wellbeing.fatigue > 5%}</b></span>{% endif %}
|
||||||
|
</td>
|
||||||
|
<td class="text-right">
|
||||||
|
{% if wellbeing.muscle_soreness > 5%}<b><span class="text-danger">{% endif %}
|
||||||
|
{{ wellbeing.muscle_soreness }}
|
||||||
|
{% if wellbeing.muscle_soreness > 5%}</b></span>{% endif %}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
{% else %}
|
||||||
|
<p class="text-muted">There are no well being corresponding to your criterias</p>
|
||||||
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -97,6 +170,7 @@
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block footerscript %}
|
{% block footerscript %}
|
||||||
|
<script src="{% static "js/template_users/chart_gradient_color.js" %}"></script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
$('[data-sort="table"]').tablesorter({
|
$('[data-sort="table"]').tablesorter({
|
||||||
|
@ -116,5 +190,172 @@
|
||||||
"bInfo" : false,
|
"bInfo" : false,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
{% if wellbeing_list %}
|
||||||
|
var timeFormat = 'DD-M-YYYY';
|
||||||
|
var ctx = document.getElementById("chart_wellbeing").getContext("2d");
|
||||||
|
|
||||||
|
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)');
|
||||||
|
|
||||||
|
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)');
|
||||||
|
|
||||||
|
var mindstate_values = [
|
||||||
|
{% for wellbeing in wellbeing_list %}
|
||||||
|
{
|
||||||
|
x: '{{ wellbeing.date | date:"d-m-Y" }}',
|
||||||
|
y: '{{ wellbeing.mindstate }}'
|
||||||
|
},
|
||||||
|
{% endfor %}
|
||||||
|
];
|
||||||
|
|
||||||
|
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 %}
|
||||||
|
];
|
||||||
|
|
||||||
|
var wellbeing_data = {
|
||||||
|
datasets: [
|
||||||
|
{
|
||||||
|
label: 'Mindstate',
|
||||||
|
cubicInterpolationMode: 'monotone',
|
||||||
|
backgroundColor: gradient_stroke_pink,
|
||||||
|
borderColor: border_color_pink,
|
||||||
|
pointBackgroundColor: border_color_pink,
|
||||||
|
fill: true,
|
||||||
|
data: mindstate_values,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
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',
|
||||||
|
backgroundColor: gradient_stroke_blue,
|
||||||
|
borderColor: border_color_blue,
|
||||||
|
pointBackgroundColor: border_color_blue,
|
||||||
|
fill: true,
|
||||||
|
data: fatigue_values,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Muscle',
|
||||||
|
cubicInterpolationMode: 'monotone',
|
||||||
|
backgroundColor: gradient_stroke_yellow,
|
||||||
|
borderColor: border_color_yellow,
|
||||||
|
pointBackgroundColor: border_color_yellow,
|
||||||
|
fill: true,
|
||||||
|
data: muscle_soreness_values,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
|
new Chart(ctx, {
|
||||||
|
type: 'line',
|
||||||
|
data: wellbeing_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 %}
|
||||||
</script>
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
Loading…
Reference in New Issue