2023-04-25 17:06:14 +02:00
|
|
|
{% load has_group %}
|
|
|
|
{% load is_user_equal_to_gymnast %}
|
|
|
|
|
|
|
|
<div class="row justify-content-center ml-3 pr-0">
|
|
|
|
<div class="col-md-12 pr-0">
|
|
|
|
<div class="card">
|
|
|
|
<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">
|
2023-07-05 09:33:03 +02:00
|
|
|
{% if wellbeing_list %}
|
|
|
|
<div><canvas id="chartjs_wellbeing" class="chartjs" width="400" height="200"></canvas></div>
|
2023-04-25 17:06:14 +02:00
|
|
|
|
2023-07-05 09:33:03 +02:00
|
|
|
<div class="row">
|
|
|
|
<div class="col-md-8 col-l-6 col-xl-4 offset-xl-4">
|
|
|
|
<table class="table tablesorter table-striped table-condensed" id="wellbeing_table">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th style="width: 4%"></th>
|
|
|
|
<th style="width: 48%" class="header text-center">Date</th>
|
|
|
|
<th style="width: 12%" class="header text-center">Mindstate</th>
|
|
|
|
<th style="width: 12%" class="header text-center">Sleep</th>
|
|
|
|
<th style="width: 12%" class="header text-center">Stress</th>
|
|
|
|
<th style="width: 12%" class="header text-center">Fatigue</th>
|
|
|
|
<th style="width: 12%" class="header text-center">Muscle soreness</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
{% for wellbeing in wellbeing_list %}
|
|
|
|
<tr class="routine_{{ score.routine_type }}">
|
|
|
|
<td>
|
|
|
|
<a href="{% url 'score_update' wellbeing.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-right">{{ wellbeing.date | date:"d-m-Y" }}</td>
|
|
|
|
<td class="text-right">{{ wellbeing.mindstate }} </td>
|
|
|
|
<td class="text-right">{{ wellbeing.sleep }} </td>
|
|
|
|
<td class="text-right">{{ wellbeing.stress }} </td>
|
|
|
|
<td class="text-right">{{ wellbeing.fatigue }} </td>
|
|
|
|
<td class="text-right">{{ wellbeing.muscle_soreness }} </td>
|
|
|
|
</tr>
|
|
|
|
{% endfor %}
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</div>
|
2023-04-25 17:06:14 +02:00
|
|
|
</div>
|
2023-07-05 09:33:03 +02:00
|
|
|
<script type="text/javascript">
|
|
|
|
$(document).ready(function () {
|
|
|
|
$('#wellbeing_table').tablesorter({
|
|
|
|
headers: {
|
|
|
|
0: { sorter: false },
|
|
|
|
},
|
|
|
|
dateFormat: "uk",
|
|
|
|
sortList: [[1, 0],]
|
|
|
|
});
|
2023-04-25 17:06:14 +02:00
|
|
|
|
2023-07-05 09:33:03 +02:00
|
|
|
});
|
|
|
|
</script>
|
2023-04-25 17:06:14 +02:00
|
|
|
{% else %}
|
2023-07-05 09:33:03 +02:00
|
|
|
<p class="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">
|
|
|
|
{% if request.user|has_group:"trainer" or request.user|is_user_equal_to_gymnast:gymnastid %}
|
2023-07-05 09:33:03 +02:00
|
|
|
<a href="{% url 'wellbeing_create_for_gymnast' gymnastid %}">
|
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>
|
|
|
|
{% endif %}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
2023-07-05 09:33:03 +02:00
|
|
|
new Chart(document.getElementById("chartjs_wellbeing"), {
|
2023-04-25 17:06:14 +02:00
|
|
|
type: 'line',
|
|
|
|
data: {
|
|
|
|
datasets: [
|
2023-07-05 09:33:03 +02:00
|
|
|
{% if wellbeing_list %}
|
2023-04-25 17:06:14 +02:00
|
|
|
{
|
|
|
|
label: 'Mindstate',
|
|
|
|
backgroundColor: 'rgb(255, 99, 132, 0.25)',
|
|
|
|
borderColor: 'rgb(255, 99, 132)',
|
|
|
|
fill: true,
|
|
|
|
data: [
|
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" }}',
|
|
|
|
y: '{{ wellbeing.mindstate }}'
|
2023-04-25 17:06:14 +02:00
|
|
|
},
|
|
|
|
{% endfor %}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{% endif %}
|
|
|
|
],
|
|
|
|
},
|
|
|
|
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>
|