2023-04-25 17:06:14 +02:00
|
|
|
{% extends "listing.html" %}
|
|
|
|
{% load has_group %}
|
2024-04-10 12:15:20 +02:00
|
|
|
{% load static %}
|
2023-04-25 17:06:14 +02:00
|
|
|
|
|
|
|
{% block datacontent %}
|
|
|
|
<div class="row justify-content-center">
|
|
|
|
<div class="col-12 col-sm-12 col-md-12 col-lg-12 col-xl-12">
|
|
|
|
<div class="card">
|
|
|
|
<div class="card-header row">
|
2024-01-25 10:56:59 +01:00
|
|
|
<div class="col-10 pr-0">
|
2024-02-11 16:56:12 +01:00
|
|
|
<h4 class="">{% if gymnast %}<a href="{% url 'gymnast_details_tab' gymnast.id 'physiological' %}"><i>{{ gymnast }}</i></a>'s{% endif %} Height/Weight listing </h4>
|
2023-04-25 17:06:14 +02:00
|
|
|
</div>
|
2024-01-25 10:56:59 +01:00
|
|
|
<div class="col-2 ml-auto pl-0">
|
2023-04-25 17:06:14 +02:00
|
|
|
<div class="text-right">
|
|
|
|
{% if request.user|has_group:"trainer" %}
|
2024-04-10 12:15:20 +02:00
|
|
|
<a href="{% if gymnast %}{% url 'heightweight_create_for_gymnast' gymnast.id %}{% else %}{% url 'height_weight_create' %}{% endif %}">
|
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>
|
2024-01-25 10:56:59 +01:00
|
|
|
<div class="card-body pt-1">
|
2024-04-10 12:15:20 +02:00
|
|
|
{% if gymnast %}
|
|
|
|
<div class="row">
|
|
|
|
<div class="col-md-6">
|
|
|
|
<table class="table tablesorter table-striped mb-0" data-sort="table" id="height_weight_table">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th></th>
|
|
|
|
<th class="header text-left">Date</th>
|
|
|
|
<th class="header text-center">Height</th>
|
|
|
|
<th class="header text-center">Hips height</th>
|
|
|
|
<th class="header text-center">Weight</th>
|
|
|
|
<th class="header text-center">BMI</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
{% for height_weight in height_weight_list %}
|
|
|
|
<tr>
|
|
|
|
<td>
|
|
|
|
<a href="{% url 'heightweight_update' height_weight.id %}">
|
|
|
|
<span class="tim-icons icon-pencil text-warning"></span>
|
|
|
|
</a>
|
|
|
|
</td>
|
|
|
|
<td class="text-left">{{ height_weight.date | date:"j-n-Y" }}</td>
|
|
|
|
<td class="text-center">{{ height_weight.height }}</td>
|
|
|
|
<td class="text-center">{% if height_weight.hips_height == None %}-{% else %}{{ height_weight.hips_height }}{% endif %}</td>
|
|
|
|
<td class="text-center">{{ height_weight.weight }}</td>
|
|
|
|
<td class="text-center">
|
|
|
|
{% if gymnast %}
|
|
|
|
{% if gymnast.gender == 0 %}
|
|
|
|
{% if height_weight.bmi < 19 %}
|
|
|
|
<span class="text-danger"><b>{{ height_weight.bmi | floatformat:2 }}</b></span>
|
|
|
|
{% elif height_weight.bmi < 21 %}
|
|
|
|
<span class="text-warning"><b>{{ height_weight.bmi | floatformat:2 }}</b></span>
|
|
|
|
{% elif height_weight.bmi < 23 %}
|
|
|
|
<span class="text-success"><b>{{ height_weight.bmi | floatformat:2 }}</b></span>
|
|
|
|
{% elif height_weight.bmi < 25 %}
|
|
|
|
<span class="text-warning"><b>{{ height_weight.bmi | floatformat:2 }}</b></span>
|
|
|
|
{% else %}
|
|
|
|
<span class="text-danger"><b>{{ height_weight.bmi | floatformat:2 }}</b></span>
|
|
|
|
{% endif %}
|
|
|
|
{% else %}
|
|
|
|
{% if height_weight.bmi < 21 %}
|
|
|
|
<span class="text-danger"><b>{{ height_weight.bmi | floatformat:2 }}</b></span>
|
|
|
|
{% elif height_weight.bmi < 23 %}
|
|
|
|
<span class="text-warning"><b>{{ height_weight.bmi | floatformat:2 }}</b></span>
|
|
|
|
{% elif height_weight.bmi < 25 %}
|
|
|
|
<span class="text-success"><b>{{ height_weight.bmi | floatformat:2 }}</b></span>
|
|
|
|
{% elif height_weight.bmi < 27 %}
|
|
|
|
<span class="text-warning"><b>{{ height_weight.bmi | floatformat:2 }}</b></span>
|
|
|
|
{% else %}
|
|
|
|
<span class="text-danger"><b>{{ height_weight.bmi | floatformat:2 }}</b></span>
|
|
|
|
{% endif %}
|
|
|
|
{% endif %}
|
|
|
|
{% else %}
|
|
|
|
<b>{{ height_weight.bmi | floatformat:2 }}</b>
|
|
|
|
{% endif %}
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
{% endfor %}
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</div>
|
2024-04-11 16:41:15 +02:00
|
|
|
<div class="col-md-6 pl-0 pr-0 pt-3">
|
|
|
|
<canvas id="chart_height_weight" class="chartjs" width="100%">Your browser doesn't support canvas</canvas>
|
2024-04-10 12:15:20 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{% else %}
|
|
|
|
{% if height_weight_list %}
|
|
|
|
<table class="table tablesorter table-striped mb-0" data-sort="table" id="height_weight_table">
|
2023-04-25 17:06:14 +02:00
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th></th>
|
|
|
|
<th class="header text-left">Date</th>
|
2024-01-25 10:56:59 +01:00
|
|
|
{% if not gymnast %}
|
2023-04-25 17:06:14 +02:00
|
|
|
<th class="header text-left">Gymnast</th>
|
2024-01-25 10:56:59 +01:00
|
|
|
{% endif %}
|
|
|
|
<th class="header text-center">Height</th>
|
|
|
|
<th class="header text-center">Hips height</th>
|
|
|
|
<th class="header text-center">Weight</th>
|
|
|
|
<th class="header text-center">BMI</th>
|
2023-04-25 17:06:14 +02:00
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
2024-04-10 12:15:20 +02:00
|
|
|
{% for height_weight in height_weight_list %}
|
2023-04-25 17:06:14 +02:00
|
|
|
<tr>
|
|
|
|
<td>
|
2024-04-10 12:15:20 +02:00
|
|
|
<a href="{% url 'height_weight_update' height_weight.id %}">
|
2023-04-25 17:06:14 +02:00
|
|
|
<span class="tim-icons icon-pencil text-warning"></span>
|
|
|
|
</a>
|
|
|
|
</td>
|
2024-04-10 12:15:20 +02:00
|
|
|
<td class="text-left">{{ height_weight.date | date:"j-n-Y" }}</td>
|
2024-01-25 10:56:59 +01:00
|
|
|
{% if not gymnast %}
|
2024-04-10 12:15:20 +02:00
|
|
|
<td class="text-left">{% if gymnast.id in request.session.available_gymnast or request.user.is_superuser %}<a href="{% url 'gymnast_details' height_weight.gymnast.id %}">{% endif %}{{ height_weight.gymnast }}</a></td>
|
2024-01-25 10:56:59 +01:00
|
|
|
{% endif %}
|
2024-04-10 12:15:20 +02:00
|
|
|
<td class="text-center">{{ height_weight.height }}</td>
|
|
|
|
<td class="text-center">{% if height_weight.hips_height == None %}-{% else %}{{ height_weight.hips_height }}{% endif %}</td>
|
|
|
|
<td class="text-center">{{ height_weight.weight }}</td>
|
2024-02-11 16:56:12 +01:00
|
|
|
<td class="text-center">
|
2023-11-21 11:24:48 +01:00
|
|
|
{% if gymnast %}
|
|
|
|
{% if gymnast.gender == 0 %}
|
2024-04-10 12:15:20 +02:00
|
|
|
{% if height_weight.bmi < 19 %}
|
|
|
|
<span class="text-danger"><b>{{ height_weight.bmi | floatformat:2 }}</b></span>
|
|
|
|
{% elif height_weight.bmi < 21 %}
|
|
|
|
<span class="text-warning"><b>{{ height_weight.bmi | floatformat:2 }}</b></span>
|
|
|
|
{% elif height_weight.bmi < 23 %}
|
|
|
|
<span class="text-success"><b>{{ height_weight.bmi | floatformat:2 }}</b></span>
|
|
|
|
{% elif height_weight.bmi < 25 %}
|
|
|
|
<span class="text-warning"><b>{{ height_weight.bmi | floatformat:2 }}</b></span>
|
2023-11-21 11:24:48 +01:00
|
|
|
{% else %}
|
2024-04-10 12:15:20 +02:00
|
|
|
<span class="text-danger"><b>{{ height_weight.bmi | floatformat:2 }}</b></span>
|
2023-11-21 11:24:48 +01:00
|
|
|
{% endif %}
|
|
|
|
{% else %}
|
2024-04-10 12:15:20 +02:00
|
|
|
{% if height_weight.bmi < 21 %}
|
|
|
|
<span class="text-danger"><b>{{ height_weight.bmi | floatformat:2 }}</b></span>
|
|
|
|
{% elif height_weight.bmi < 23 %}
|
|
|
|
<span class="text-warning"><b>{{ height_weight.bmi | floatformat:2 }}</b></span>
|
|
|
|
{% elif height_weight.bmi < 25 %}
|
|
|
|
<span class="text-success"><b>{{ height_weight.bmi | floatformat:2 }}</b></span>
|
|
|
|
{% elif height_weight.bmi < 27 %}
|
|
|
|
<span class="text-warning"><b>{{ height_weight.bmi | floatformat:2 }}</b></span>
|
2023-11-21 11:24:48 +01:00
|
|
|
{% else %}
|
2024-04-10 12:15:20 +02:00
|
|
|
<span class="text-danger"><b>{{ height_weight.bmi | floatformat:2 }}</b></span>
|
2023-11-21 11:24:48 +01:00
|
|
|
{% endif %}
|
|
|
|
{% endif %}
|
|
|
|
{% else %}
|
2024-04-10 12:15:20 +02:00
|
|
|
<b>{{ height_weight.bmi | floatformat:2 }}</b>
|
2023-11-21 11:24:48 +01:00
|
|
|
{% endif %}
|
|
|
|
</td>
|
2023-04-25 17:06:14 +02:00
|
|
|
</tr>
|
|
|
|
{% endfor %}
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
{% else %}
|
|
|
|
<p class="text-muted">There are no scores corresponding to your criterias</p>
|
|
|
|
{% endif %}
|
2024-04-10 12:15:20 +02:00
|
|
|
{% endif %}
|
2023-04-25 17:06:14 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{% endblock %}
|
|
|
|
|
|
|
|
{% block footerscript %}
|
2024-04-10 12:15:20 +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">
|
|
|
|
$(document).ready(function () {
|
|
|
|
$('[data-sort="table"]').tablesorter({
|
|
|
|
headers: {
|
|
|
|
0: { sorter: false },
|
|
|
|
},
|
|
|
|
dateFormat: "uk",
|
|
|
|
sortList: [[1, 1]]
|
|
|
|
});
|
|
|
|
|
2024-04-10 12:15:20 +02:00
|
|
|
$('#height_weight_table').DataTable({
|
2024-01-25 17:51:07 +01:00
|
|
|
scrollY: '50vh',
|
2023-04-25 17:06:14 +02:00
|
|
|
scrollCollapse: true,
|
|
|
|
paging: false,
|
|
|
|
searching: false,
|
|
|
|
ordering: false,
|
2023-11-21 09:10:28 +01:00
|
|
|
"bInfo" : false,
|
2023-04-25 17:06:14 +02:00
|
|
|
});
|
|
|
|
});
|
2024-04-10 12:15:20 +02:00
|
|
|
|
|
|
|
{% if height_weight_list %}
|
2024-04-10 14:02:46 +02:00
|
|
|
var timeFormat = 'DD-M-YYYY';
|
2024-04-10 12:15:20 +02:00
|
|
|
var ctx = document.getElementById("chart_height_weight").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)');
|
|
|
|
|
2024-04-11 08:42:03 +02:00
|
|
|
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)');
|
|
|
|
|
2024-04-10 12:15:20 +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 %}
|
|
|
|
]
|
|
|
|
|
2024-04-11 08:42:03 +02:00
|
|
|
var bmi_value = [
|
|
|
|
{% for height_weight in height_weight_list %}
|
|
|
|
{
|
|
|
|
x: '{{ height_weight.date | date:"d-m-Y" }}',
|
|
|
|
y: '{{ height_weight.bmi }}'
|
|
|
|
},
|
|
|
|
{% endfor %}
|
|
|
|
]
|
|
|
|
|
2024-04-10 12:15:20 +02:00
|
|
|
var height_weight_data = {
|
|
|
|
datasets: [
|
|
|
|
{
|
|
|
|
label: 'Weight',
|
|
|
|
cubicInterpolationMode: 'monotone',
|
|
|
|
backgroundColor: gradient_stroke_pink,
|
|
|
|
borderColor: border_color_pink,
|
|
|
|
pointBackgroundColor: border_color_pink,
|
|
|
|
fill: true,
|
|
|
|
data: height_values,
|
2024-04-11 08:42:03 +02:00
|
|
|
hidden: true,
|
2024-04-10 12:15:20 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
label: 'Height',
|
|
|
|
cubicInterpolationMode: 'monotone',
|
|
|
|
backgroundColor: gradient_stroke_orange,
|
|
|
|
borderColor: border_color_orange,
|
|
|
|
pointBackgroundColor: border_color_orange,
|
|
|
|
fill: true,
|
2024-04-11 08:42:03 +02:00
|
|
|
data: weight_values,
|
|
|
|
hidden: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: 'BMI',
|
|
|
|
cubicInterpolationMode: 'monotone',
|
|
|
|
backgroundColor: gradient_stroke_green,
|
|
|
|
borderColor: border_color_green,
|
|
|
|
pointBackgroundColor: border_color_green,
|
|
|
|
fill: true,
|
|
|
|
data: bmi_value,
|
2024-04-10 12:15:20 +02:00
|
|
|
},
|
|
|
|
],
|
|
|
|
};
|
|
|
|
|
|
|
|
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-04-25 17:06:14 +02:00
|
|
|
</script>
|
|
|
|
{% endblock %}
|