Update chrono add and list management

This commit is contained in:
Gregory Trullemans 2024-04-11 16:29:15 +02:00
parent 514807204a
commit c3d34fe174
2 changed files with 57 additions and 57 deletions

View File

@ -24,63 +24,63 @@
</div>
</div>
<div class="card-body vh-100">
<div class="table-responsive">
{% if gymnast %}
<div class="row">
<div class="col-md-6">
<table class="table table-striped tablesorter" id="chrono_table">
<thead>
<tr>
<th style="width: 8%">&nbsp;</th>
<th style="width: 12%" class="header text-center">Date</th>
<th style="width: 20%" class="header text-center">Routine</th>
<th style="width: 15%" class="header text-center">Type</th>
<th style="width: 10%" class="header text-center">Score</th>
<th style="width: 10%" class="header text-center">TOF</th>
</tr>
</thead>
<tbody>
{% for chrono in chrono_list %}
<tr role="row" class="{% cycle 'odd' 'even' %}">
<td>
<a href="{% url 'chrono_update' chrono.id %}">
<span class="tim-icons icon-pencil text-warning"></span>
{% if gymnast %}
<div class="row">
<div class="col-md-6">
<table class="table table-striped tablesorter" id="chrono_table">
<thead>
<tr>
<th style="width: 8%">&nbsp;</th>
<th style="width: 12%" class="header text-center">Date</th>
<th style="width: 20%" class="header text-center">Routine</th>
<th style="width: 15%" class="header text-center">Type</th>
<th style="width: 10%" class="header text-center">Score</th>
<th style="width: 10%" class="header text-center">TOF</th>
</tr>
</thead>
<tbody>
{% for chrono in chrono_list %}
<tr role="row" class="{% cycle 'odd' 'even' %}">
<td>
<a href="{% url 'chrono_update' chrono.id %}">
<span class="tim-icons icon-pencil text-warning"></span>
</a>
&nbsp;
<a href="{% url 'jump_chrono_values_create_or_update' chrono.id %}">
<span class="far fa-search-plus text-warning"></span>
</a>
</td>
<td class="text-center">
{% if chrono.details.all %}
<a href="{% url 'jump_chrono_details' chrono.id %}">
{% endif %}
{{ chrono.date | date:"j-n-Y" }}
{% if chrono.details.all %}
</a>
&nbsp;
<a href="{% url 'jump_chrono_values_create_or_update' chrono.id %}">
<span class="far fa-search-plus text-warning"></span>
</a>
</td>
<td class="text-center">
{% if chrono.details.all %}
<a href="{% url 'jump_chrono_details' chrono.id %}">
{% endif %}
{{ chrono.date | date:"j-n-Y" }}
{% if chrono.details.all %}
</a>
{% endif %}
</td>
<td class="text-center">
{% if chrono.routine %}
{{ chrono.routine.long_label }}
{% else %}
{{ chrono.get_chrono_type_display }}
{% endif %}
</td>
<td class="text-center">{{ chrono.get_score_type_display }}</td>
<td class="text-center">{{ chrono.score }}</td>
<td class="text-center">{{ chrono.tof }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<div class="col-md-6">
<canvas id="chart_chrono" class="chartjs" width="400" height="200"></canvas>
</div>
{% endif %}
</td>
<td class="text-center">
{% if chrono.routine %}
{{ chrono.routine.long_label }}
{% else %}
{{ chrono.get_chrono_type_display }}
{% endif %}
</td>
<td class="text-center">{{ chrono.get_score_type_display }}</td>
<td class="text-center">{{ chrono.score }}</td>
<td class="text-center">{{ chrono.tof }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% else %}
{% if chrono_list %}
<div class="col-md-6 pl-0 pr-0">
<canvas id="chart_chrono" class="chartjs" width="100%"></canvas>
</div>
</div>
{% else %}
{% if chrono_list %}
<div class="table-responsive">
<table class="table table-striped tablesorter" id="chrono_table">
<thead>
<tr>
@ -128,8 +128,8 @@
{% else %}
<p class="text-muted">There are no chronos corresponding to your criterias.</p>
{% endif %}
{% endif %}
</div>
{% endif %}
</div>
</div>
{% endblock %}

View File

@ -476,7 +476,7 @@ def chrono_create_or_update(request, chrono_id=None, gymnast_id=None):
)
return HttpResponseRedirect(
reverse("gymnast_details_tab", args=(new_chrono.gymnast.id, "scores"))
reverse("chrono_list_for_gymnast", args=(new_chrono.gymnast.id,))
)
return render(request, "chronos/create.html", {"form": form})