Add stability templates and URLs
This commit is contained in:
parent
27448d5962
commit
2bb2fb55eb
|
@ -0,0 +1,118 @@
|
|||
{% extends "base.html" %}
|
||||
{% load static %}
|
||||
{% load has_group %}
|
||||
|
||||
{% 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-header">
|
||||
<h4 class="">{% if injury_id %}Edit{% else %}Add{% endif %} injury</h4>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form action="{% if injury_id %}{% url 'injury_update' injury_id %}{% else %}{% url 'injury_create' %}{% endif %}" method="post" class="form-horizontal" id="formulaire" name="formulaire">
|
||||
{% csrf_token %}
|
||||
<div class="form-group row ">
|
||||
<label for="id_date" class="col-4 col-sm-3 col-form-label">Gymnast <span class="text-danger"><b>*</b></span></label>
|
||||
<div class="col-sm-8 col-md-6 col-lg-6 col-xl-6 {% if form.jumper.errors %}has-danger{% endif %}">
|
||||
{% if request.user|has_group:"trainer" %}
|
||||
{{ form.gymnast }}
|
||||
{{ form.gymnast_related }}
|
||||
{% if form.gymnast.errors %} <span class="btn btn-sm btn-danger-outline">{% for error in form.gymnast.errors %}{{ error }}{% endfor %}</span>{% endif %}
|
||||
{% else %}
|
||||
<input type="text" class="form-control" value="{{ request.user.first_name }} {{ request.user.last_name }}" readonly="readonly" />
|
||||
<input type="hidden" name="gymnast" id="gymnast" value="{{ request.user.gymnast.id }}" />
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row ">
|
||||
<label for="id_date" class="col-4 col-sm-3 col-form-label">{{ form.date.label }} <span class="text-danger"><b>*</b></span></label>
|
||||
<div class="col-sm-3 col-md-4 col-lg-4 col-xl-4 {% if form.date.errors %}has-danger{% endif %}">
|
||||
{{ form.date }}
|
||||
{% if form.date.errors %}<span class="btn btn-sm btn-danger-outline">{% for error in form.date.errors %}{{ error }}{% endfor %}</span>{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row ">
|
||||
<label for="id_skill" class="col-4 col-sm-3 col-form-label">Skill</label>
|
||||
<div class="col-sm-8 col-md-6 col-lg-6 col-xl-6 {% if form.skill.errors %}has-danger{% endif %}">
|
||||
{{ form.skill }}
|
||||
{{ form.skill_related }}
|
||||
{% if form.skill.errors %} <span class="btn btn-sm btn-danger-outline">{% for error in form.skill.errors %}{{ error }}{% endfor %}</span>{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row ">
|
||||
<label for="id_injury_type" class="col-4 col-sm-3 col-form-label">{{ form.injury_type.label }}<span class="text-danger"><b>*</b></span></label>
|
||||
<div class="col-sm-8 col-md-8 col-lg-8 col-xl-8 {% if form.injury_type.errors %}has-danger{% endif %}">
|
||||
{{ form.injury_type }}
|
||||
{% if form.injury_type.errors %} <span class="btn btn-sm btn-danger-outline">{% for error in form.injury_type.errors %}{{ error }}{% endfor %}</span>{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row ">
|
||||
<label for="id_mechanism" class="col-4 col-sm-3 col-form-label">{{ form.mechanism.label }} <span class="text-danger"><b>*</b></span></label>
|
||||
<div class="col-5 col-sm-3 col-md-4 col-lg-4 col-xl-4 {% if form.mechanism.errors %}has-danger{% endif %}">
|
||||
{{ form.mechanism }}
|
||||
{% if form.mechanism.errors %} <span class="btn btn-sm btn-danger-outline">{% for error in form.mechanism.errors %}{{ error }}{% endfor %}</span>{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row ">
|
||||
<label for="id_location" class="col-4 col-sm-3 col-form-label">{{ form.location.label }}<span class="text-danger"><b>*</b></span></label>
|
||||
<div class="col-sm-8 col-md-6 col-lg-6 col-xl-6 {% if form.location.errors %}has-danger{% endif %}">
|
||||
{{ form.location }}
|
||||
{% if form.location.errors %} <span class="btn btn-sm btn-danger-outline">{% for error in form.location.errors %}{{ error }}{% endfor %}</span>{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row ">
|
||||
<label for="id_body_side" class="col-4 col-sm-3 col-form-label">{{ form.body_side.label }}<span class="text-danger"><b>*</b></span></label>
|
||||
<div class="col-5 col-sm-3 col-md-4 col-lg-4 col-xl-4 {% if form.body_side.errors %}has-danger{% endif %}">
|
||||
{{ form.body_side }}
|
||||
{% if form.body_side.errors %} <span class="btn btn-sm btn-danger-outline">{% for error in form.body_side.errors %}{{ error }}{% endfor %}</span>{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row ">
|
||||
<label for="id_diagnosis" class="col-4 col-sm-3 col-form-label">{{ form.diagnosis.label }}</label>
|
||||
<div class="col-sm-9 col-md-9 col-lg-9 col-xl-9 {% if form.id_diagnosis.errors %}has-danger{% endif %}">
|
||||
{{ form.diagnosis }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row ">
|
||||
<label for="id_nb_week_off" class="col-4 col-sm-3 col-form-label"># Week off</label>
|
||||
<div class="col-sm-3 col-md-4 col-lg-2 {% if form.nb_week_off.errors %}has-danger{% endif %}">
|
||||
{{ form.nb_week_off }}
|
||||
{% if form.nb_week_off.errors %} <span class="btn btn-sm btn-danger-outline">{% for error in form.nb_week_off.errors %}{{ error }}{% endfor %}</span>{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row ">
|
||||
<label for="id_information" class="col-4 col-sm-3 col-form-label">Informations</label>
|
||||
<div class="col-sm-9 col-md-9 col-lg-9 col-xl-9 {% if form.id_informations.errors %}has-danger{% endif %}">
|
||||
{{ form.informations }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group text-center">
|
||||
<input type="submit" value="{% if injury_id %}Save{% else %}Add{% endif %}" class="btn btn-warning" />
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block footerscript %}
|
||||
<script type="text/javascript" >
|
||||
$(function(){
|
||||
blackDashboard.initDateTimePicker();
|
||||
});
|
||||
|
||||
const csrf_token = "{{ csrf_token|escapejs }}";
|
||||
const gymnast_lookup = "{% url 'gymnast_lookup' %}";
|
||||
const skill_lookup = "{% url 'skill_lookup' %}";
|
||||
</script>
|
||||
<script src="{% static "js/template_users/datepicker_maxdate_today.js" %}"></script>
|
||||
{% if request.session.template == 0 %}
|
||||
<script src="{% static "js/template_users/gymnast_autocomplete_black.js" %}"></script>
|
||||
<script src="{% static "js/template_users/skill_autocomplete_black.js" %}"></script>
|
||||
{% else %}
|
||||
<script src="{% static "js/template_users/gymnast_autocomplete.js" %}"></script>
|
||||
<script src="{% static "js/template_users/skill_autocomplete.js" %}"></script>
|
||||
{% endif %}
|
||||
{% endblock %}
|
|
@ -0,0 +1,59 @@
|
|||
{% extends "base.html" %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-12 col-sm-8 col-md-6">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h4 class="mb-0">Stability on {{ stability.date | date:"j N Y" }}</h4>
|
||||
<a href="{% url 'gymnast_details_tab' stability.gymnast.id 'physiological' %}">{{ stability.gymnast }}</a>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<table class="table table-striped">
|
||||
<tr>
|
||||
<td>Anterior chain</td>
|
||||
<td>{{ stability.anterior_chain }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Posterior chain left</td>
|
||||
<td>{{ stability.posterior_chain_left }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Posterior chain right</td>
|
||||
<td>{{ stability.posterior_chain_right }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Leg lowering</td>
|
||||
<td>{{ stability.leg_lowering }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>SL bridge</td>
|
||||
<td>
|
||||
{% for sl_bridge in stability_sl_bridge %}
|
||||
{{ sl_bridge }}
|
||||
{% endfor %}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Side plank leg raise</td>
|
||||
<td>
|
||||
{% for side_plank_leg_raise in stability_side_plank_leg_raise %}
|
||||
{{ side_plank_leg_raise }}
|
||||
{% endfor %}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div class="card-footer pl-0 pb-0">
|
||||
<a href="{% url 'stability_list' %}">
|
||||
<button type="submit" value="add" class="btn btn-icon btn-warning ">
|
||||
<i class="tim-icons icon-double-left"></i>
|
||||
</button>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
|
@ -0,0 +1,86 @@
|
|||
{% extends "listing.html" %}
|
||||
|
||||
{% block datacontent %}
|
||||
<div class="card mb-0">
|
||||
<div class="card-header">
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<h4 class=""> Stabilities Listing</h4>
|
||||
</div>
|
||||
<div class="col-1 ml-auto">
|
||||
<div class="text-right">
|
||||
<a href="{% url 'injury_create' %}">
|
||||
<button type="submit" value="add" class="btn btn-icon btn-warning ">
|
||||
<i class="fas fa-plus"></i>
|
||||
</button>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="table-responsive">
|
||||
{% if stabilities_list %}
|
||||
<table class="table tablesorter table-striped" data-sort="table" id="stability_table">
|
||||
<thead class="text-primary">
|
||||
<tr>
|
||||
<th style="width: 3%"></th>
|
||||
<th class="header text-left" style="width: 8%">Date</th>
|
||||
<th class="header text-left" style="width: 20%">Gymnast</th>
|
||||
<th class="header text-left">Ant. chain</th>
|
||||
<th class="header text-left">Post. chain L</th>
|
||||
<th class="header text-left">Post. chain R</th>
|
||||
<th class="header text-left">leg_lowering</th>
|
||||
<!-- <th class="header text-left">sl_bridge</th>
|
||||
<th class="header text-left">side_plank_leg_raise</th> -->
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for stability in stabilities_list %}
|
||||
<tr role="row" class="{% cycle 'odd' 'even' %}">
|
||||
<td>
|
||||
<a href="{% url 'injury_update' stability.id %}">
|
||||
<span class="tim-icons icon-pencil text-warning"></span>
|
||||
</a>
|
||||
</td>
|
||||
<td class="text-left"><a href="{% url 'stability_details' stability.id %}">{{ stability.date | date:"d-m-Y" }}</a></td>
|
||||
<td class="text-left"><a href="{% url 'gymnast_details_tab' stability.gymnast.id 'physiological' %}">{{ stability.gymnast }}</a></td>
|
||||
<td class="text-left">{{ stability.anterior_chain }}</td>
|
||||
<td class="text-left">{{ stability.posterior_chain_left }}</td>
|
||||
<td class="text-left">{{ stability.posterior_chain_right }}</td>
|
||||
<td class="text-left">{{ stability.leg_lowering }}</td>
|
||||
<!-- <td class="text-right">{{ stability.sl_bridge }}</td>
|
||||
<td class="text-right">{{ stability.side_plank_leg_raise }}</td> -->
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% else %}
|
||||
<p class="muted-text">There are no injury corresponding to your criterias.</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block footerscript %}
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function () {
|
||||
$('#stability_table').tablesorter({
|
||||
headers: {
|
||||
0: { sorter: false }, // disable first column
|
||||
},
|
||||
dateFormat: "uk",
|
||||
sortList: [[1, 1]]
|
||||
});
|
||||
|
||||
$('#stability_table').DataTable({
|
||||
scrollY: 500,
|
||||
paging: false,
|
||||
searching: false,
|
||||
ordering: false,
|
||||
"bInfo": false,
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
|
@ -11,7 +11,7 @@
|
|||
<h4 class=""><i class="icon-primary fal fa-laugh-wink"></i> Hi {{ user.username }} !</h4>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
Welcome to Ultron v0.9 <span class="text-muted">(last update : 14-7-2023)</span><br />
|
||||
Welcome to Ultron v0.10 <span class="text-muted">(last update : 20-8-2023)</span><br />
|
||||
This application is here to help coaches to manage the gymnasts (evolution, evaluation, routines, scores, …).
|
||||
This tool is not perfect so feel free to make improvement proposals, bug reports, … by sending me an <a href="mailto:gregory@flyingacrobaticstrampoline.be">email</a>.<br />
|
||||
<br />
|
||||
|
|
|
@ -54,7 +54,7 @@ urlpatterns = [
|
|||
path(r"learnedskill/new/", views.gymnast_learn_skill, name="gymnast_learn_skill"),
|
||||
#
|
||||
#
|
||||
# Score
|
||||
# SCORE
|
||||
path(r"score/", views.score_listing, name="score_listing"),
|
||||
path(
|
||||
r"score/gymnast/<int:gymnast_id>/",
|
||||
|
@ -72,7 +72,7 @@ urlpatterns = [
|
|||
),
|
||||
#
|
||||
#
|
||||
# Injury
|
||||
# INJURY
|
||||
path(r"injury/search/", views.injury_listing, name="injury_search"),
|
||||
path(r"injury/", views.injury_listing, name="injury_list"),
|
||||
path(r"injury/add/", views.injury_create_or_update, name="injury_create"),
|
||||
|
@ -91,7 +91,27 @@ urlpatterns = [
|
|||
),
|
||||
#
|
||||
#
|
||||
# Mindstate
|
||||
# STABILITY
|
||||
path(r"stability/", views.stability_listing, name="stability_list"),
|
||||
path(r"stability/gymnast/<int:gymnast_id>/", views.stability_listing, name="stability_list"),
|
||||
# path(r"stability/search/", views.injury_listing, name="stability_search"),
|
||||
# path(r"stability/add/", views.injury_create_or_update, name="stability_create"),
|
||||
# path(
|
||||
# r"stability/add/<int:gymnast_id>/",
|
||||
# views.injury_create_or_update,
|
||||
# name="injury_create_for_gymnast",
|
||||
# ),
|
||||
# path(
|
||||
# r"stability/edit/<int:injury_id>/",
|
||||
# views.injury_create_or_update,
|
||||
# name="injury_update",
|
||||
# ),
|
||||
path(
|
||||
r"stability/<int:stability_id>/", views.stability_detail, name="stability_details"
|
||||
),
|
||||
#
|
||||
#
|
||||
# WELLBEING
|
||||
path(r"wellbeing/", views.wellbeing_listing, name="wellbeing_list"),
|
||||
path(
|
||||
r"wellbeing/gymnast/<int:gymnast_id>/",
|
||||
|
@ -116,7 +136,7 @@ urlpatterns = [
|
|||
),
|
||||
#
|
||||
#
|
||||
# Height/Weight
|
||||
# HEIGH/WEIGHT
|
||||
path(
|
||||
r"heightweight/gymnast/<int:gymnast_id>/",
|
||||
views.heightweight_listing,
|
||||
|
@ -139,7 +159,7 @@ urlpatterns = [
|
|||
),
|
||||
#
|
||||
#
|
||||
# Routine Done
|
||||
# ROUTINEDONE
|
||||
path(
|
||||
r"routinedone/add/",
|
||||
views.routinedone_create_or_update,
|
||||
|
|
|
@ -18,6 +18,7 @@ from .models import (
|
|||
Chrono,
|
||||
Injury,
|
||||
WellBeing,
|
||||
Stability,
|
||||
LearnedSkill,
|
||||
HeightWeight,
|
||||
SeasonInformation,
|
||||
|
@ -739,6 +740,41 @@ def season_information_listing(request, gymnast_id=None):
|
|||
season_information_list = SeasonInformation.objects.filter(gymnast=gymnast_id)
|
||||
else:
|
||||
season_information_list = SeasonInformation.objects.all()
|
||||
gymnast = None
|
||||
|
||||
context = {"season_information_list": season_information_list, "gymnast": gymnast}
|
||||
return render(request, "followup/seasoninformations/list.html", context)
|
||||
|
||||
|
||||
@login_required
|
||||
@require_http_methods(["GET"])
|
||||
def stability_listing(request, gymnast_id=None):
|
||||
"""Liste toutes les records de la table stability"""
|
||||
|
||||
if gymnast_id is not None:
|
||||
gymnast = Gymnast.objects.get(pk=gymnast_id)
|
||||
stabilities_list = Stability.objects.filter(gymnast=gymnast_id)
|
||||
else:
|
||||
stabilities_list = Stability.objects.all()
|
||||
gymnast = None
|
||||
|
||||
context = {"stabilities_list": stabilities_list, "gymnast": gymnast}
|
||||
return render(request, "followup/stabilities/list.html", context)
|
||||
|
||||
|
||||
@login_required
|
||||
@require_http_methods(["GET"])
|
||||
def stability_detail(request, stability_id):
|
||||
"""
|
||||
Récupère toutes les informations d'une stability.
|
||||
"""
|
||||
stability = get_object_or_404(Stability, pk=stability_id)
|
||||
stability_sl_bridge = stability.sl_bridge.all()
|
||||
stability_side_plank_leg_raise = stability.side_plank_leg_raise.all()
|
||||
|
||||
context = {
|
||||
"stability": stability,
|
||||
"stability_sl_bridge": stability_sl_bridge,
|
||||
"stability_side_plank_leg_raise": stability_side_plank_leg_raise
|
||||
}
|
||||
return render(request, "followup/stabilities/details.html", context)
|
||||
|
|
Loading…
Reference in New Issue