Ultron/templates/people/gymnasts/details.html

179 lines
7.2 KiB
HTML
Raw Normal View History

2021-11-02 14:05:32 +01:00
{% extends "base.html" %}
{% load skill_doughnut %}
{% load level_chart_bar %}
2022-02-07 12:09:29 +01:00
{% load has_group %}
{% load is_user_equal_to_gymnast %}
2021-11-17 10:39:16 +01:00
{% block page_title %}{{ gymnast.first_name }} {{ gymnast.last_name }}{% endblock %}
2021-11-02 14:05:32 +01:00
{% block content %}
<div class="row">
<div class="col-12 col-sm-4 col-md-4 col-lg-4">
2021-12-26 17:49:48 +01:00
<div class="card card-user mb-4">
2021-11-02 14:05:32 +01:00
<div class="card-body">
<div class="author">
<div class="block block-one"></div>
<div class="block block-two"></div>
<div class="block block-three"></div>
<div class="block block-four"></div>
<a href="javascript:void(0)">
2021-11-17 10:39:16 +01:00
{% if gymnast.picture %}
<img src="{{ gymnast.picture.url }}" alt="{{ gymnast }}" class="avatar">
2021-11-02 14:05:32 +01:00
{% endif %}
2021-11-17 10:39:16 +01:00
<h4 class="title">{{ gymnast.first_name }} {{ gymnast.last_name }}</h4>
2021-11-02 14:05:32 +01:00
</a>
2021-12-13 15:51:07 +01:00
<p class="description">
{{ gymnast.club.name }}
</p>
2021-11-02 14:05:32 +01:00
</div>
<div class="card-description">
2021-12-13 15:51:07 +01:00
{% if height_weight %}
<b>{{ height_weight.0.height }}cm - {{ height_weight.0.weight }}kg</b> ({{ height_weight.0.date | date:"d-m-Y" }})<br />
2021-12-13 15:51:07 +01:00
{% endif %}
<b>{{ gymnast.trainings_by_week }} training/week</b> for <b>{{ gymnast.hours_by_week }} hours/week</b><br />
<br />
2022-02-15 07:41:19 +01:00
{% if user_is_trainer and gymnast.informations %}
2022-09-27 08:24:01 +02:00
<p>{{ gymnast.to_markdown | safe }}</p>
2022-02-15 07:41:19 +01:00
<br />
{% endif %}
<li>
<b>10 |</b> : <b>{{ best_straightjump.0.tof }}</b> ({{ best_straightjump.0.date | date:"d-m-Y" }})
</li>
<li>
<b>Routine</b> : {% if best_routine %}<b>{{ best_routine.0.tof }}</b> ({{ best_routine.0.date | date:"d-m-Y" }}){% else %} (no information){% endif %}
</li>
2022-09-30 11:36:03 +02:00
<a href="{% url 'gymnast_report_export' gymnast.id %}">PDF</a>
</div>
2021-11-02 14:05:32 +01:00
</div>
</div>
</div>
<div class="col-12 col-sm-4 col-md-4 col-lg-4">
2021-12-26 17:49:48 +01:00
{% if gymnast_nb_known_skills %}
{% generate_skill_doughnut gymnast.id %}
{% else %}
<p class="text-muted mt-3">No learned skill statistics.</p>
2021-12-26 17:49:48 +01:00
{% endif %}
2021-11-02 14:05:32 +01:00
</div>
2021-12-26 17:49:48 +01:00
<div class="col-12 col-sm-4 col-md-4 card mb-4">
{% if gymnast_nb_known_skills %}
{% generate_level_chart_bar gymnast.id %}
2021-12-08 09:30:13 +01:00
{% else %}
2021-12-26 17:49:48 +01:00
<p class="text-muted mt-3">No level/rank information.</p>
2021-12-08 09:30:13 +01:00
{% endif %}
2021-11-02 14:05:32 +01:00
</div>
2021-12-08 09:30:13 +01:00
2021-11-02 14:05:32 +01:00
</div>
<div class="row">
<div class="col-3 col-sm-1 col-md-1 col-lg-1 col-xl-1">
<ul class="nav nav-pills nav-pills-primary nav-pills-icons flex-column">
<li class="nav-item">
<a class="nav-link get-info{% if tab is None or tab == 'level' %} active{% endif %}" data-toggle="tab" href="#skill" data-ref="#skill" data-url="skill/" id="display_skill">
2021-12-19 21:14:04 +01:00
<i class="tim-icons icon-sound-wave"></i> <!-- Level -->
</a>
</li>
2022-09-27 08:24:01 +02:00
2021-12-05 15:18:31 +01:00
<li class="nav-item">
2021-12-18 22:40:15 +01:00
<a class="nav-link get-info{% if tab == 'routine' %} active{% endif %}" data-toggle="tab" href="#routine" data-ref="#routine" data-url="routine/" id="display_routines">
2021-12-19 21:14:04 +01:00
<i class="tim-icons icon-components"></i> <!-- Routines -->
2021-12-05 15:18:31 +01:00
</a>
</li>
<li class="nav-item">
2021-12-18 22:40:15 +01:00
<a class="nav-link get-info{% if tab == 'scores' %} active{% endif %}" data-toggle="tab" href="#scores" data-ref="#scores" data-url="scores_chrono/" id="display_scores_chrono">
2021-12-19 21:14:04 +01:00
<i class="fal fa-crosshairs"></i> <!-- Scores -->
</a>
</li>
2022-02-15 07:41:19 +01:00
{% if user_is_trainer or request.user|is_user_equal_to_gymnast:gymnast.id %}
2022-02-07 12:09:29 +01:00
<li class="nav-item">
<a class="nav-link get-info{% if tab == 'physiological' %} active{% endif %}" data-toggle="tab" href="#physiological" data-ref="#physiological" data-url="physiological/" id="display_physiological">
<i class="fal fa-stethoscope"></i> <!-- Physical -->
</a>
</li>
{% endif %}
<li class="nav-item">
2021-12-18 22:40:15 +01:00
<a class="nav-link get-info{% if tab == 'event' %} active{% endif %}" data-toggle="tab" href="#event" data-ref="#event" data-url="event/" id="display_event">
2021-12-19 21:14:04 +01:00
<i class="fal fa-calendar-day"></i> <!-- Events -->
</a>
</li>
</ul>
</div>
2021-12-26 17:49:48 +01:00
<div class="col-12 col-sm-11 col-md-11 col-lg-11 pr-0">
<div class="tab-content">
<div class="tab-pane{% if tab is None or tab == 'skill' %} active{% endif %}" id="skill"></div>
2022-09-27 08:24:01 +02:00
2021-12-18 22:40:15 +01:00
<div class="tab-pane{% if tab == 'routine' %} active{% endif %}" id="routine"></div>
2021-12-13 15:51:07 +01:00
2021-12-18 22:40:15 +01:00
<div class="tab-pane{% if tab == 'scores' %} active{% endif %}" id="scores"></div>
2022-02-15 07:41:19 +01:00
{% if user_is_trainer or request.user|is_user_equal_to_gymnast:gymnast.id %}
2022-02-07 12:09:29 +01:00
<div class="tab-pane{% if tab == 'physiological' %} active{% endif %}" id="physiological"></div>
{% endif %}
2022-09-27 08:24:01 +02:00
2021-12-18 22:40:15 +01:00
<div class="tab-pane{% if tab == 'event' %} active{% endif %}" id="event"></div>
<!-- TODO : message d'erreur si TAB non géré. -->
</div>
</div>
</div>
{% endblock %}
2021-11-02 14:05:32 +01:00
{% block footerscript %}
2021-11-02 14:05:32 +01:00
<script type="text/javascript">
$(document).ready(function() {
2022-02-15 07:41:19 +01:00
var default_url = "{% url 'gymnast_details' gymnast.id %}";
var tab_div = '';
{% if tab is None or tab == 'skill' %}
tab_url = default_url + 'skill/';
2022-02-15 07:41:19 +01:00
tab_div = '#skill';
{% elif tab == 'routine' %}
tab_url = default_url + 'routine/';
2022-02-15 07:41:19 +01:00
tab_div = '#routine';
{% elif tab == 'scores' %}
tab_url = default_url + 'scores_chrono/';
2022-02-15 07:41:19 +01:00
tab_div = '#scores';
{% elif tab == 'physiological' %}
tab_url = default_url + 'physiological/';
tab_div = '#physiological'
{% elif tab == 'event' %}
tab_url = default_url + 'event/';
2022-02-15 07:41:19 +01:00
tab_div = '#event';
{% endif %}
$.ajax({
url: tab_url,
dataType: "html",
success: function(data) {
$(tab_div).replaceWith($(tab_div).html(data));
},
error: function (exception) {
console.log(exception);
}
});
$('.get-info').click(function(){
$.ajax({
url: default_url + $(this).data("url"),
dataType: "html",
context: $(this),
success: function(data) {
$($(this).data("ref")).replaceWith($($(this).data("ref")).html(data));
},
error: function (exception) {
console.log(exception);
}
});
});
});
2021-11-02 14:05:32 +01:00
</script>
{% endblock %}