Jarvis/jarvis/followup/templates/heightweight/list.html

120 lines
6.4 KiB
HTML

{% extends "listing.html" %}
{% load has_group %}
{% 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">
<div class="col-10 pr-0">
<h4 class="">{% if gymnast %}<a href="{% url 'gymnast_details_tab' gymnast.id 'physiological' %}"><i>{{ gymnast }}</i></a>'s{% endif %} Height/Weight listing </h4>
</div>
<div class="col-2 ml-auto pl-0">
<div class="text-right">
{% if request.user|has_group:"trainer" %}
<a href="{% if gymnast %}{% url 'heightweight_create_for_gymnast' gymnast.id %}{% else %}{% url 'heightweight_create' %}{% endif %}">
<button type="submit" value="add" class="btn btn-icon btn-warning ">
<i class="fas fa-plus"></i>
</button>
</a>
{% endif %}
</div>
</div>
</div>
<div class="card-body pt-1">
{% if heightweight_list %}
<table class="table tablesorter table-striped mb-0" data-sort="table" id="heightweight_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">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 heightweight in heightweight_list %}
<tr>
<td>
<a href="{% url 'heightweight_update' heightweight.id %}">
<span class="tim-icons icon-pencil text-warning"></span>
</a>
</td>
<td class="text-left">{{ heightweight.date | date:"j-n-Y" }}</td>
{% if not gymnast %}
<td class="text-left">{% if gymnast.id in request.session.available_gymnast or request.user.is_superuser %}<a href="{% url 'gymnast_details' heightweight.gymnast.id %}">{% endif %}{{ heightweight.gymnast }}</a></td>
{% endif %}
<td class="text-center">{{ heightweight.height }}</td>
<td class="text-center">{% if heightweight.hips_height == None %}-{% else %}{{ heightweight.hips_height }}{% endif %}</td>
<td class="text-center">{{ heightweight.weight }}</td>
<td class="text-center">
{% if gymnast %}
{% if gymnast.gender == 0 %}
{% if heightweight.bmi < 19 %}
<span class="text-danger"><b>{{ heightweight.bmi | floatformat:2 }}</b></span>
{% elif heightweight.bmi < 21 %}
<span class="text-warning"><b>{{ heightweight.bmi | floatformat:2 }}</b></span>
{% elif heightweight.bmi < 23 %}
<span class="text-success"><b>{{ heightweight.bmi | floatformat:2 }}</b></span>
{% elif heightweight.bmi < 25 %}
<span class="text-warning"><b>{{ heightweight.bmi | floatformat:2 }}</b></span>
{% else %}
<span class="text-danger"><b>{{ heightweight.bmi | floatformat:2 }}</b></span>
{% endif %}
{% else %}
{% if heightweight.bmi < 21 %}
<span class="text-danger"><b>{{ heightweight.bmi | floatformat:2 }}</b></span>
{% elif heightweight.bmi < 23 %}
<span class="text-warning"><b>{{ heightweight.bmi | floatformat:2 }}</b></span>
{% elif heightweight.bmi < 25 %}
<span class="text-success"><b>{{ heightweight.bmi | floatformat:2 }}</b></span>
{% elif heightweight.bmi < 27 %}
<span class="text-warning"><b>{{ heightweight.bmi | floatformat:2 }}</b></span>
{% else %}
<span class="text-danger"><b>{{ heightweight.bmi | floatformat:2 }}</b></span>
{% endif %}
{% endif %}
{% else %}
<b>{{ heightweight.bmi | floatformat:2 }}</b>
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<p class="text-muted">There are no scores corresponding to your criterias</p>
{% endif %}
</div>
</div>
</div>
</div>
{% endblock %}
{% block footerscript %}
<script type="text/javascript">
$(document).ready(function () {
$('[data-sort="table"]').tablesorter({
headers: {
0: { sorter: false },
},
dateFormat: "uk",
sortList: [[1, 1]]
});
$('#heightweight_table').DataTable({
scrollY: '50vh',
scrollCollapse: true,
paging: false,
searching: false,
ordering: false,
"bInfo" : false,
});
});
</script>
{% endblock %}