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

304 lines
18 KiB
HTML

{% extends "base.html" %}
{% load i18n %}
{% block content %}
{% trans "any" as any %}
<div class="card bg-light shadow">
<div class="card-header text-center">
<h4>{% trans "Participation of team" %} {{ participation.team.name }} ({{ participation.team.trigram }})</h4>
</div>
<div class="card-body">
<dl class="row">
<dt class="col-sm-2">{% trans "Team:" %}</dt>
<dd class="col-sm-10"><a href="{% url "participation:team_detail" pk=participation.team.pk %}">{{ participation.team }}</a></dd>
<dt class="col-sm-2">{% trans "Chosen problem:" %}</dt>
<dd class="col-sm-10">{{ participation.get_problem_display }}</dd>
</dl>
<div id="solution-container">
<dl class="row">
{% trans "No video sent" as novideo %}
<dt class="col-sm-2">{% trans "Proposed solution:" %}</dt>
<dd class="col-sm-10"><a href="{{ participation.solution.link|default:"#" }}"{% if participation.solution.link %} target="_blank"{% endif %}>
{{ participation.solution.link|default:novideo }}</a>
{% if current_phase.phase_number == 1 or participation.solution.link == "" %}
<button class="btn btn-primary" data-toggle="modal" data-target="#uploadSolutionModal">{% trans "Upload" %}</button>
{% endif %}
{% if participation.solution.link %}
<button class="btn btn-info" data-toggle="modal" data-target="#displaySolutionModal">{% trans "Display" %}</button>
{% endif %}
</dd>
</dl>
</div>
</div>
</div>
{% if user.registration.is_admin or current_phase.phase_number >= 2 %}
<hr>
<div class="row">
<div class="col-md-6">
<div class="card bg-light shadow">
<div class="card-header text-center">
<h4>{% trans "Sent solution" %}</h4>
</div>
<div class="card-body">
<dl class="row">
<dt class="col-xl-5 text-right">{% trans "Team that received your solution:" %}</dt>
<dd class="col-md-5">{{ participation.sent_participation.team|default:any }}</dd>
{% if user.registration.is_admin %}
<dd class="col-xs-2">
<button class="btn btn-primary" data-toggle="modal" data-target="#defineSentParticipationModal">{% trans "Change" %}</button>
</dd>
{% endif %}
</dl>
{% if current_phase.phase_number == 2 %}
<div class="alert alert-info">
{% blocktrans trimmed %}
The mentioned team received your video. They are now watching your video,
and formulating questions. You would be able to exchange with the other phase during
the next phase.
{% endblocktrans %}
</div>
{% elif current_phase.phase_number == 3 %}
<div class="alert alert-info">
{% blocktrans trimmed with user_id=user.pk %}
The other team sent you questions about your solution. Your are now able to answer them,
then to exchange freely with the other team. You can click on the Chat button, or to
connect to your dedicated Matrix account:
<code>@corres2math_{{ user_id }}:correspondances-maths.fr</code>.
You can use your own Matrix client, or use the dedicated Element client:
<a href="https://element.correspondances-maths.fr">element.correpondances-maths.fr</a>
{% endblocktrans %}
</div>
{% elif current_phase.phase_number == 4 %}
<dl class="row">
<dt class="col-xl-5 text-right">{% trans "Synthesis from the other team:" %}</dt>
<dd class="col-sm-7"><a href="{{ participation.received_participation.synthesis.link|default:"#" }}"{% if participation.received_participation.synthesis.link %} target="_blank"{% endif %}>
{{ participation.received_participation.synthesis.link|default:novideo }}</a>
{% if participation.received_participation.synthesis.link %}
<button class="btn btn-info" data-toggle="modal" data-target="#displayOtherSynthesisModal">{% trans "Display" %}</button>
{% endif %}
</dd>
</dl>
{% endif %}
</div>
</div>
</div>
<div class="col-md-6">
<div class="card bg-light shadow">
<div class="card-header text-center">
<h4>{% trans "Received solution" %}</h4>
</div>
<div class="card-body">
<dl class="row">
<dt class="col-xl-5 text-right">{% trans "Team that sent you their solution:" %}</dt>
<dd class="col-md-5">{{ participation.received_participation.team|default:any }}</dd>
{% if user.registration.is_admin %}
<dd class="col-xs-2">
<button class="btn btn-primary" data-toggle="modal" data-target="#defineReceivedParticipationModal">{% trans "Change" %}</button>
</dd>
{% endif %}
<dt class="col-xl-5 text-right">{% trans "Proposed solution:" %}</dt>
<dd class="col-sm-7"><a href="{{ participation.received_participation.solution.link|default:"#" }}"{% if participation.received_participation.solution.link %} target="_blank"{% endif %}>
{{ participation.received_participation.solution.link|default:novideo }}</a>
{% if participation.received_participation.solution.link %}
<button class="btn btn-info" data-toggle="modal" data-target="#displayOtherSolutionModal">{% trans "Display" %}</button>
{% endif %}
</dd>
{% if current_phase.phase_number == 2 %}
<div class="alert alert-info">
{% blocktrans trimmed %}
You received a solution about the same problem that you treated from another team.
You are now encouraged to see the video, then to ask from 3 to 6 questions about the video.
After that, you will be invited to exchange with the other team about the solution.
{% endblocktrans %}
</div>
{% for question in participation.questions.all %}
<dd class="col-md-9 text-truncate">{{ question.question }}</dd>
<dd class="col-md-3">
<button class="btn btn-primary" data-toggle="modal" data-target="#updateQuestion{{ forloop.counter }}Modal">{% trans "Change" %}</button>
</dd>
<hr>
{% endfor %}
{% if user.registration.participates %}
<button class="btn btn-success" data-toggle="modal" data-target="#addQuestionModal">
<i class="fas fa-plus-circle"></i> {% trans "Add a question" %}
</button>
{% endif %}
{% elif current_phase.phase_number == 3 %}
<div class="alert alert-info">
{% blocktrans trimmed with user_id=user.pk %}
You sent your questions to the other team about their solution. When they answer to
your questions, you will be able to exchange freely with the other team.
You can click on the Chat button, or to connect to your dedicated Matrix account:
<code>@corres2math_{{ user_id }}:correspondances-maths.fr</code>.
You can use your own Matrix client, or use the dedicated Element client:
<a href="https://element.correspondances-maths.fr">element.correpondances-maths.fr</a>
{% endblocktrans %}
</div>
{% elif current_phase.phase_number == 4 %}
<div id="solution-container">
<dl class="row">
{% trans "No video sent" as novideo %}
<dt class="col-sm-5 text-right">{% trans "Your synthesis of the exchange:" %}</dt>
<dd class="col-sm-7"><a href="{{ participation.synthesis.link|default:"#" }}"{% if participation.synthesis.link %} target="_blank"{% endif %}>
{{ participation.synthesis.link|default:novideo }}</a>
<button class="btn btn-primary" data-toggle="modal" data-target="#uploadSynthesisModal">{% trans "Upload" %}</button>
{% if participation.synthesis.link %}
<button class="btn btn-info" data-toggle="modal" data-target="#displaySynthesisModal">{% trans "Display" %}</button>
{% endif %}
</dd>
</dl>
</div>
{% endif %}
</dl>
</div>
</div>
</div>
</div>
{% endif %}
{% if user.registration.is_admin %}
{% trans "Define received video" as modal_title %}
{% trans "Update" as modal_button %}
{% url "participation:participation_receive_participation" pk=participation.pk as modal_action %}
{% include "base_modal.html" with modal_id="defineReceivedParticipation" %}
{% trans "Define team that receives your video" as modal_title %}
{% trans "Update" as modal_button %}
{% url "participation:participation_send_participation" pk=participation.pk as modal_action %}
{% include "base_modal.html" with modal_id="defineSentParticipation" %}
{% endif %}
{% trans "Upload video" as modal_title %}
{% trans "Upload" as modal_button %}
{% url "participation:upload_video" pk=participation.solution_id as modal_action %}
{% include "base_modal.html" with modal_id="uploadSolution" %}
{% trans "Display solution" as modal_title %}
{% trans "This video platform is not supported yet." as unsupported_platform %}
{% include "base_modal.html" with modal_id="displaySolution" modal_action="" modal_button="" modal_additional_class="modal-lg" modal_content=participation.solution.as_iframe|default:unsupported_platform %}
{% if user.registration.is_admin or current_phase.phase_number >= 2 %}
{% if participation.received_participation.solution.link %}
{% trans "Display solution" as modal_title %}
{% trans "This video platform is not supported yet." as unsupported_platform %}
{% include "base_modal.html" with modal_id="displayOtherSolution" modal_action="" modal_button="" modal_additional_class="modal-lg" modal_content=participation.received_participation.solution.as_iframe|default:unsupported_platform %}
{% endif %}
{% if current_phase.phase_number == 2 %}
{% trans "Add question" as modal_title %}
{% trans "Add" as modal_button %}
{% url "participation:add_question" pk=participation.pk as modal_action %}
{% include "base_modal.html" with modal_id="addQuestion" modal_button_type="success" %}
{% endif %}
{% for question in participation.questions.all %}
{% with number_str=forloop.counter|stringformat:"d"%}
{% with modal_id="updateQuestion"|add:number_str %}
{% trans "Delete" as delete %}
{% with extra_modal_button='<button class="btn btn-danger" type="button" data-dismiss="modal" data-toggle="modal" data-target="#deleteQuestion'|add:number_str|add:'Modal">'|add:delete|add:"</button>"|safe %}
{% trans "Update question" as modal_title %}
{% trans "Update" as modal_button %}
{% url "participation:update_question" pk=question.pk as modal_action %}
{% include "base_modal.html" %}
{% endwith %}
{% endwith %}
{% with modal_id="deleteQuestion"|add:number_str %}
{% trans "Delete question" as modal_title %}
{% trans "Delete" as modal_button %}
{% url "participation:delete_question" pk=question.pk as modal_action %}
{% include "base_modal.html" with modal_button_type="danger" %}
{% endwith %}
{% endwith %}
{% endfor %}
{% endif %}
{% if current_phase.phase_number >= 4 %}
{% if participation.received_participation.synthesis.link %}
{% trans "Display synthesis" as modal_title %}
{% trans "This video platform is not supported yet." as unsupported_platform %}
{% include "base_modal.html" with modal_id="displayOtherSynthesis" modal_action="" modal_button="" modal_additional_class="modal-lg" modal_content=participation.received_participation.synthesis.as_iframe|default:unsupported_platform %}
{% endif %}
{% trans "Upload video" as modal_title %}
{% trans "Upload" as modal_button %}
{% url "participation:upload_video" pk=participation.synthesis_id as modal_action %}
{% include "base_modal.html" with modal_id="uploadSynthesis" %}
{% if participation.synthesis.link %}
{% trans "Display synthesis" as modal_title %}
{% trans "This video platform is not supported yet." as unsupported_platform %}
{% include "base_modal.html" with modal_id="displaySynthesis" modal_action="" modal_button="" modal_additional_class="modal-lg" modal_content=participation.synthesis.as_iframe|default:unsupported_platform %}
{% endif %}
{% endif %}
{% endblock %}
{% block extrajavascript %}
<script>
$(document).ready(function() {
{% if user.registration.is_admin %}
$('button[data-target="#defineReceivedParticipationModal"]').click(function() {
let modalBody = $("#defineReceivedParticipationModal div.modal-body");
if (!modalBody.html().trim())
modalBody.load("{% url "participation:participation_receive_participation" pk=participation.pk %} #form-content");
});
$('button[data-target="#defineSentParticipationModal"]').click(function() {
let modalBody = $("#defineSentParticipationModal div.modal-body");
if (!modalBody.html().trim())
modalBody.load("{% url "participation:participation_send_participation" pk=participation.pk %} #form-content");
});
{% endif %}
{% if current_phase.phase_number == 2 %}
$('button[data-target="#addQuestionModal"]').click(function() {
let modalBody = $("#addQuestionModal div.modal-body");
if (!modalBody.html().trim())
modalBody.load("{% url "participation:add_question" pk=participation.pk %} #form-content");
});
{% endif %}
{% for question in participation.questions.all %}
$('button[data-target="#updateQuestion{{ forloop.counter }}Modal"]').click(function() {
let modalBody = $("#updateQuestion{{ forloop.counter }}Modal div.modal-body");
if (!modalBody.html().trim())
modalBody.load("{% url "participation:update_question" pk=question.pk %} #form-content");
});
{% if current_phase.phase_number == 2 %}
$('button[data-target="#deleteQuestion{{ forloop.counter }}Modal"]').click(function() {
let modalBody = $("#deleteQuestion{{ forloop.counter }}Modal div.modal-body");
if (!modalBody.html().trim())
modalBody.load("{% url "participation:delete_question" pk=question.pk %} #form-content");
});
{% endif %}
{% endfor %}
$('button[data-target="#uploadSolutionModal"]').click(function() {
let modalBody = $("#uploadSolutionModal div.modal-body");
if (!modalBody.html().trim())
modalBody.load("{% url "participation:upload_video" pk=participation.solution_id %} #form-content");
});
{% if current_phase.phase_number == 4 %}
$('button[data-target="#uploadSynthesisModal"]').click(function() {
let modalBody = $("#uploadSynthesisModal div.modal-body");
if (!modalBody.html().trim())
modalBody.load("{% url "participation:upload_video" pk=participation.synthesis_id %} #form-content");
});
{% endif %}
});
</script>
{% endblock %}