Jarvis/jarvis/objective/templates/trainingprograms/details.html

91 lines
3.8 KiB
HTML
Raw Normal View History

2024-02-25 20:02:20 +01:00
{% extends "base.html" %}
{% load has_group %}
{% block page_title %}{{ combination.short_label }}{% endblock %}
{% block content %}
<div class="row justify-content-center">
<div class="col-12 col-sm-12 col-md-8 col-lg-8 col-xl-6">
<div class="card">
<div class="card-body">
{% if trainingprogram_list %}
2024-03-01 13:52:54 +01:00
<table class="table table-striped tablesorter" id="trainingprogram_table">
2024-02-25 20:02:20 +01:00
<thead>
2024-03-01 13:52:54 +01:00
<tr>
2024-03-02 18:13:02 +01:00
<th colspan="5" class="text-center">{{ date|date:"l j F Y" }}</th>
2024-03-01 13:52:54 +01:00
</tr>
2024-02-25 20:02:20 +01:00
</thead>
2024-03-01 13:52:54 +01:00
<tbody>
2024-02-25 20:02:20 +01:00
{% for trainingprogram in trainingprogram_list %}
2024-03-01 13:52:54 +01:00
<tr role="row" class="{% cycle 'odd' 'even' %}">
<td>{{ trainingprogram.rank }}</td>
<td>{{ trainingprogram.passe.label }} {{ trainingprogram.passe.repetition }}</td>
2024-03-02 18:13:02 +01:00
<td class="text-center">{{ trainingprogram.passe.number_of_skill}}</td>
2024-03-01 13:52:54 +01:00
<td class="text-center">{{ trainingprogram.passe.difficulty }}</td>
2024-03-02 18:13:02 +01:00
{% if request.user|has_group:"trainer" %}
<td class="text-right p-2">
<a href="#" class="up">
<button type="submit" value="" class="btn btn-icon btn-warning mr-2">
<i class="fas fa-chevron-up"></i>
</button>
</a>
<a href="#" class="down">
<button type="submit" value="add" class="btn btn-icon btn-warning mr-2">
<i class="fas fa-chevron-down"></i>
</button>
</a>
</td>
{% endif %}
2024-03-01 13:52:54 +01:00
</tr>
{% endfor %}
</tbody>
2024-02-25 20:02:20 +01:00
<tr>
2024-03-01 13:52:54 +01:00
<td colspan="2" class="text-right"><b>TOTAL</b></td>
<td class="text-center"><b>{{ number_of_skill }}</b></td>
<td class="text-center"><b>{{ difficulty }}</b></td>
2024-03-02 18:13:02 +01:00
{% if request.user|has_group:"trainer" %}
<td></td>
{% endif %}
2024-02-25 20:02:20 +01:00
</tr>
</table>
{% endif %}
</div>
</div>
</div>
</div>
2024-03-02 18:13:02 +01:00
{% endblock %}
{% block footerscript %}
<script type="text/javascript">
$(document).ready(function(){
$(".up,.down").click(function(){
var row = $(this).parents("tr:first");
if ($(this).is(".up")) {
$.ajax({
url: "{% url 'switch_trainingprogram_line' %}",
method: "POST",
data: {
tp1: 5,
tp2: 6,
csrfmiddlewaretoken: '{{ csrf_token }}'
},
}).done(function() {
row.insertBefore(row.prev());
});
} else {
$.ajax({
url: "{% url 'switch_trainingprogram_line' %}",
method: "POST",
data: {
tp1: 6,
tp2: 5,
csrfmiddlewaretoken: '{{ csrf_token }}'
},
}).done(function() {
row.insertAfter(row.next());
});
}
});
});
</script>
2024-02-25 20:02:20 +01:00
{% endblock %}