2022-02-07 12:09:29 +01:00
|
|
|
{% load has_group %}
|
|
|
|
{% load is_user_equal_to_gymnast %}
|
|
|
|
|
2021-12-26 17:49:48 +01:00
|
|
|
<div class="row justify-content-center ml-1">
|
2021-12-27 06:40:23 +01:00
|
|
|
<div class="col-md-6">
|
2021-12-05 15:19:16 +01:00
|
|
|
<div class="card">
|
|
|
|
<div class="card-header">
|
2021-12-24 12:14:03 +01:00
|
|
|
<h4>Actives Routines</h4>
|
2021-12-05 15:19:16 +01:00
|
|
|
</div>
|
2021-12-24 22:08:29 +01:00
|
|
|
<div class="card-body pt-0 pb-0 pr-0 pl-0">
|
|
|
|
{% if ghr_list %}
|
|
|
|
<div class="pr-1 pl-1">
|
|
|
|
<table class="table tablesorter table-striped table-condensed" data-sort="table" id="routine_table">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th style="width: 8%" class="header text-left">Type</th>
|
|
|
|
<th style="width: 30%" class="header text-left">Label</th>
|
|
|
|
<th style="width: 15%" class="header text-left">From</th>
|
|
|
|
<th style="width: 10%" class="header text-center">Diff.</th>
|
|
|
|
<th style="width: 10%" class="header text-center">Level</th>
|
|
|
|
<th style="width: 10%" class="header text-center">Rank</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
{% for ghr in ghr_list %}
|
|
|
|
<tr>
|
|
|
|
<td class="text-center">{{ ghr.get_routine_type_display }}</td>
|
|
|
|
<td class="text-left"><a href="{% url 'routine_details' ghr.routine.id %}">{{ ghr.routine.short_label }}</a></td>
|
|
|
|
<td class="text-center">{{ ghr.datebegin | date:"d-m-Y"}}</td>
|
|
|
|
<!-- <td class="text-center">{% if ghr.dateend %}{{ ghr.dateend | date:"d F Y" }}{% else %}… to now.{% endif %}</td> -->
|
|
|
|
<td class="text-center">{{ ghr.routine.difficulty }}</td>
|
|
|
|
<td class="text-center">{{ ghr.routine.level }}</td>
|
|
|
|
<td class="text-center">{{ ghr.routine.rank }}</td>
|
|
|
|
</tr>
|
|
|
|
{% endfor %}
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</div>
|
2021-12-05 15:19:16 +01:00
|
|
|
{% else %}
|
2021-12-24 22:08:29 +01:00
|
|
|
<p class="pl-3 text-muted">There are no routines associated to this gymnast.</p>
|
2021-12-05 15:19:16 +01:00
|
|
|
{% endif %}
|
|
|
|
</div>
|
2021-12-24 12:14:03 +01:00
|
|
|
<div class="card-footer text-right text-muted pt-0">
|
2022-09-01 12:48:36 +02:00
|
|
|
{% if ghr_list %}
|
2021-12-24 12:14:03 +01:00
|
|
|
<a href="{% url 'routine_list_for_gymnast' gymnast_id %}">
|
2022-02-08 18:55:48 +01:00
|
|
|
<button type="submit" value="list" class="btn btn-icon btn-warning mr-2">
|
2021-12-24 12:14:03 +01:00
|
|
|
<i class="tim-icons icon-components"></i> <!-- Routines -->
|
|
|
|
</button>
|
|
|
|
</a>
|
2022-09-01 12:48:36 +02:00
|
|
|
{% endif %}
|
2021-12-24 12:14:03 +01:00
|
|
|
|
2022-09-04 16:04:22 +02:00
|
|
|
{% if request.user|has_group:"trainer" or request.user|is_user_equal_to_gymnast:gymnast_id %}
|
2022-02-07 12:09:29 +01:00
|
|
|
<a href="{% url 'link_routine_to_gymnast' gymnast_id %}">
|
|
|
|
<button type="submit" value="add" class="btn btn-icon btn-warning ">
|
|
|
|
<i class="tim-icons icon-simple-add"></i>
|
|
|
|
</button>
|
|
|
|
</a>
|
|
|
|
{% endif %}
|
2021-12-24 12:14:03 +01:00
|
|
|
</div>
|
2021-12-05 15:19:16 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
2021-12-24 07:48:46 +01:00
|
|
|
|
2021-12-24 12:14:03 +01:00
|
|
|
<div class="col-md-6">
|
|
|
|
<div class="card">
|
|
|
|
<div class="card-header">
|
|
|
|
<h4>Routine's statistics</h4>
|
|
|
|
</div>
|
2021-12-24 22:08:29 +01:00
|
|
|
<div class="card-body pt-0 pb-0 pr-0 pl-0">
|
2021-12-24 07:48:46 +01:00
|
|
|
{% if routine_done_list %}
|
2021-12-24 22:08:29 +01:00
|
|
|
<div class="pr-1 pl-1">
|
|
|
|
<table class="table tablesorter table-striped table-condensed" data-sort="table" id="stats_table">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th style="width: 15%" class="header text-center">Date</th>
|
|
|
|
<th style="width: 30%" class="header text-left">Routine</th>
|
|
|
|
<th style="width: 8%" class="header text-center">Type</th>
|
|
|
|
<th style="width: 10%" class="header text-center"># Try</th>
|
|
|
|
<th style="width: 12%" class="header text-center"># Success</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
{% for routinedone in routine_done_list %}
|
|
|
|
<tr>
|
|
|
|
<td class="text-center">{{ routinedone.date | date:"d-m-Y"}}</td>
|
2022-02-08 18:55:48 +01:00
|
|
|
<td class="text-left">
|
|
|
|
{% if routinedone.routine %}
|
|
|
|
<a href="{% url 'routine_details' routinedone.routine.id %}">{{ routinedone.routine.long_label }}</a>
|
|
|
|
{% else %}
|
|
|
|
-
|
|
|
|
{% endif %}
|
|
|
|
</td>
|
2021-12-24 22:08:29 +01:00
|
|
|
<td class="text-center">{{ routinedone.get_routine_type_display }}</td>
|
|
|
|
<td class="text-center">{{ routinedone.number_of_try }}</td>
|
|
|
|
<td class="text-center">{{ routinedone.number_of_successes }}</td>
|
|
|
|
</tr>
|
|
|
|
{% endfor %}
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</div>
|
2021-12-24 07:48:46 +01:00
|
|
|
{% else %}
|
2021-12-24 22:08:29 +01:00
|
|
|
<p class="pl-3 text-muted">There are no routine's statistics associated to this gymnast.</p>
|
2021-12-24 07:48:46 +01:00
|
|
|
{% endif %}
|
|
|
|
</div>
|
2022-02-08 07:40:33 +01:00
|
|
|
<div class="card-footer pt-0 row">
|
2022-09-01 12:48:36 +02:00
|
|
|
{% if routine_done_list %}
|
|
|
|
<div class="col-md-6 text-muted pt-0">
|
2022-02-08 07:40:33 +01:00
|
|
|
<a href="#">
|
2022-02-10 19:35:27 +01:00
|
|
|
<button type="submit" value="list" class="btn btn-icon btn-success mr-2 action-button" data-routine_type="1" data-success="1">
|
2022-02-08 07:40:33 +01:00
|
|
|
+R1
|
2022-02-07 12:09:29 +01:00
|
|
|
</button>
|
|
|
|
</a>
|
2022-02-08 07:40:33 +01:00
|
|
|
<a href="#">
|
2022-02-10 19:35:27 +01:00
|
|
|
<button type="submit" value="list" class="btn btn-icon btn-success mr-4 action-button" data-routine_type="2" data-success="1">
|
2022-02-08 07:40:33 +01:00
|
|
|
+R2
|
|
|
|
</button>
|
|
|
|
</a>
|
|
|
|
|
|
|
|
<a href="#">
|
2022-02-10 19:35:27 +01:00
|
|
|
<button type="submit" value="list" class="btn btn-icon btn-danger mr-2 action-button" data-routine_type="1" data-success="0">
|
2022-02-08 07:40:33 +01:00
|
|
|
+R1
|
|
|
|
</button>
|
|
|
|
</a>
|
|
|
|
<a href="#">
|
2022-02-10 19:35:27 +01:00
|
|
|
<button type="submit" value="list" class="btn btn-icon btn-danger action-button" data-routine_type="2" data-success="0">
|
2022-02-08 07:40:33 +01:00
|
|
|
+R2
|
|
|
|
</button>
|
|
|
|
</a>
|
2022-09-01 12:48:36 +02:00
|
|
|
{% endif %}
|
2022-02-08 07:40:33 +01:00
|
|
|
</div>
|
2022-09-01 12:48:36 +02:00
|
|
|
<div class="col-md-6 text-right text-muted pt-0">
|
|
|
|
{% if routine_done_list %}
|
2022-02-08 07:40:33 +01:00
|
|
|
<a href="{% url 'routinedone_list_for_gymnast' gymnast_id %}">
|
2022-02-08 18:55:48 +01:00
|
|
|
<button type="submit" value="list" class="btn btn-icon btn-warning mr-2">
|
2022-02-08 07:40:33 +01:00
|
|
|
<i class="fal fa-chart-bar"></i>
|
|
|
|
</button>
|
|
|
|
</a>
|
2022-09-01 12:48:36 +02:00
|
|
|
{% endif %}
|
2022-02-08 07:40:33 +01:00
|
|
|
|
2022-09-04 16:04:22 +02:00
|
|
|
{% if request.user|has_group:"trainer" or request.user|is_user_equal_to_gymnast:gymnast_id %}
|
2022-02-08 07:40:33 +01:00
|
|
|
<a href="{% url 'routinedone_create_for_gymnast' gymnast_id %}">
|
|
|
|
<button type="submit" value="add" class="btn btn-icon btn-warning ">
|
|
|
|
<i class="tim-icons icon-simple-add"></i>
|
|
|
|
</button>
|
|
|
|
</a>
|
|
|
|
{% endif %}
|
|
|
|
</div>
|
2021-12-24 07:48:46 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2021-12-05 15:19:16 +01:00
|
|
|
</div>
|
2021-12-19 21:14:04 +01:00
|
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
$(document).ready(function() {
|
2021-12-24 12:14:03 +01:00
|
|
|
$('#routine_table').tablesorter({
|
|
|
|
// headers: {
|
|
|
|
// 0: { sorter: false }, // disable first column
|
|
|
|
// },
|
|
|
|
dateFormat: "uk",
|
|
|
|
sortList: [[0,0], ]
|
|
|
|
})
|
|
|
|
|
|
|
|
$('#stats_table').tablesorter({
|
|
|
|
// headers: {
|
|
|
|
// 0: { sorter: false }, // disable first column
|
|
|
|
// },
|
2021-12-19 21:14:04 +01:00
|
|
|
dateFormat: "uk",
|
2021-12-28 10:25:29 +01:00
|
|
|
sortList: [[0,1], ]
|
2021-12-19 21:14:04 +01:00
|
|
|
})
|
2022-02-08 18:55:48 +01:00
|
|
|
|
|
|
|
$('.action-button').click(function(){
|
|
|
|
$.ajax({
|
|
|
|
url: "{% url 'increment_routinedone' %}",
|
|
|
|
method: "POST",
|
|
|
|
data: {
|
|
|
|
gymnast_id: {{ gymnast_id }},
|
|
|
|
success: $(this).data("success"),
|
|
|
|
routine_type: $(this).data("routine_type"),
|
|
|
|
csrfmiddlewaretoken: '{{ csrf_token }}'
|
|
|
|
},
|
|
|
|
}).done(function() {
|
|
|
|
// number_of_jump = number_of_jump + 1;
|
|
|
|
});
|
|
|
|
});
|
2021-12-19 21:14:04 +01:00
|
|
|
});
|
|
|
|
</script>
|