plateforme-corres2math/apps/participation/templates/participation/team_detail.html

120 lines
5.0 KiB
HTML

{% extends "base.html" %}
{% load i18n %}
{% load crispy_forms_filters %}
{% block content %}
<div class="card bg-light shadow">
<div class="card-header text-center">
<h4>{{ team.name }}</h4>
</div>
<div class="card-body">
<dl class="row">
<dt class="col-sm-6 text-right">{% trans "Name:" %}</dt>
<dd class="col-sm-6">{{ team.name }}</dd>
<dt class="col-sm-6 text-right">{% trans "Trigram:" %}</dt>
<dd class="col-sm-6">{{ team.trigram }}</dd>
<dt class="col-sm-6 text-right">{% trans "Access code:" %}</dt>
<dd class="col-sm-6">{{ team.access_code }}</dd>
<dt class="col-sm-6 text-right">{% trans "Coachs:" %}</dt>
<dd class="col-sm-6">
{% for coach in team.coachs.all %}
<a href="{% url "registration:user_detail" pk=coach.user.pk %}">{{ coach }}</a>{% if not forloop.last %},{% endif %}
{% empty %}
{% trans "any" %}
{% endfor %}
</dd>
<dt class="col-sm-6 text-right">{% trans "Participants:" %}</dt>
<dd class="col-sm-6">
{% for student in team.students.all %}
<a href="{% url "registration:user_detail" pk=student.user.pk %}">{{ student }}</a>{% if not forloop.last %},{% endif %}
{% empty %}
{% trans "any" %}
{% endfor %}
</dd>
<dt class="col-sm-6 text-right">{% trans "Chosen problem:" %}</dt>
{% trans "any" as any %}
<dd class="col-sm-6">{{ team.participation.get_problem_display|default:any }}</dd>
<dt class="col-sm-6 text-right">{% trans "Grant Animath to publish our video:" %}</dt>
<dd class="col-sm-6">{{ team.grant_animath_access_videos|yesno }}</dd>
<dt class="col-sm-6 text-right">{% trans "Authorizations:" %}</dt>
<dd class="col-sm-6">
{% for student in team.students.all %}
{% if student.photo_authorization %}
<a href="{{ student.photo_authorization.url }}" data-turbolinks="false">{{ student }}</a>{% if not forloop.last %},{% endif %}
{% else %}
{{ student }} ({% trans "Not uploaded yet" %}){% if not forloop.last %},{% endif %}
{% endif %}
{% endfor %}
</dd>
</dl>
</div>
<div class="card-footer text-center">
<button class="btn btn-primary" data-toggle="modal" data-target="#updateTeamModal">{% trans "Update" %}</button>
</div>
</div>
<hr>
{% if team.participation.valid %}
<div class="text-center">
<a class="btn btn-info" href="{% url "participation:participation_detail" pk=team.participation.pk %}">
<i class="fas fa-video"></i> {% trans "Access to team participation" %} <i class="fas fa-video"></i>
</a>
</div>
{% elif team.participation.valid is None %} {# Team did not ask for validation #}
{% if user.registration.participates %}
{% if can_validate %}
<div class="alert alert-info">
{% trans "Your team has at least 3 members and all photo authorizations were given: the team can be validated." %}
<div class="text-center">
<button class="btn btn-success">{% trans "Submit my team to validation" %}</button>
</div>
</div>
{% else %}
<div class="alert alert-warning">
{% trans "Your team must be composed of 3 members and each member must upload its photo authorization." %}
</div>
{% endif %}
{% else %}
<div class="alert alert-warning">
{% trans "This team didn't ask for validation yet." %}
</div>
{% endif %}
{% else %} {# Team is waiting for validation #}
{% if user.registration.participates %}
<div class="alert alert-warning">
{% trans "Your validation is pending." %}
</div>
{% else %}
Team asked for validation.
{# TODO Add validation form: validate or invalidate, with a message #}
{% endif %}
{% endif %}
{% trans "Update team" as modal_title %}
{% trans "Update" as modal_button %}
{% url "participation:update_team" pk=team.pk as modal_action %}
{% include "base_modal.html" with modal_id="updateTeam" %}
{% endblock %}
{% block extrajavascript %}
<script>
$(document).ready(function() {
$('button[data-target="#updateTeamModal"]').click(function() {
let modalBody = $("#updateTeamModal div.modal-body");
if (!modalBody.html().trim())
modalBody.load("{% url "participation:update_team" pk=team.pk %} #form-content");
});
});
</script>
{% endblock %}