mirror of
https://github.com/MarijnDoeve/TijdVoorDeTest.git
synced 2026-03-06 12:44:20 +01:00
167 lines
8.3 KiB
Twig
167 lines
8.3 KiB
Twig
{% extends 'backoffice/base.html.twig' %}
|
|
|
|
{% block title %}{{ parent() }}{{ quiz.season.name }}{% endblock %}
|
|
|
|
{% block body %}
|
|
<h2 class="py-2">{{ 'Quiz'|trans }}: {{ quiz.season.name }} - {{ quiz.name }}</h2>
|
|
<div class="py-2 btn-group" data-controller="bo--quiz">
|
|
<a class="btn btn-primary {% if quiz is same as(season.activeQuiz) %}disabled{% endif %}"
|
|
href="{{ path('tvdt_backoffice_enable', {seasonCode: season.seasonCode, quiz: quiz.id}) }}">{{ 'Make active'|trans }}</a>
|
|
{% if quiz is same as (season.activeQuiz) %}
|
|
<a class="btn btn-secondary"
|
|
href="{{ path('tvdt_backoffice_enable', {seasonCode: season.seasonCode, quiz: 'null'}) }}">{{ 'Deactivate Quiz'|trans }}</a>
|
|
{% endif %}
|
|
<button class="btn btn-danger" data-action="click->bo--quiz#clearQuiz">
|
|
{{ 'Clear quiz...'|trans }}
|
|
</button>
|
|
<button class="btn btn-danger" data-action="click->bo--quiz#deleteQuiz">
|
|
{{ 'Delete Quiz...'|trans }}
|
|
</button>
|
|
</div>
|
|
|
|
<div id="questions">
|
|
<h4 class="py-2">{{ 'Questions'|trans }}</h4>
|
|
<div class="accordion">
|
|
{%~ for question in quiz.questions ~%}
|
|
<div class="accordion-item">
|
|
<h2 class="accordion-header">
|
|
<button class="accordion-button collapsed"
|
|
type="button"
|
|
data-bs-toggle="collapse"
|
|
data-bs-target="#question-{{ loop.index0 }}"
|
|
aria-controls="question-{{ loop.index0 }}">
|
|
{% set questionErrors = question.getErrors %}
|
|
{%~ if questionErrors -%}
|
|
<span data-bs-toggle="tooltip"
|
|
title="{{ questionErrors }}"
|
|
class="badge text-bg-danger rounded-pill me-2">!</span>
|
|
{% endif %}
|
|
{{~ loop.index -}}. {{ question.question -}}
|
|
</button>
|
|
</h2>
|
|
<div id="question-{{ loop.index0 }}"
|
|
class="accordion-collapse collapse">
|
|
<div class="accordion-body">
|
|
<ul>
|
|
{%~ for answer in question.answers %}
|
|
<li{% if answer.isRightAnswer %} class="text-decoration-underline"{% endif %}>{{ answer.text -}}</li>
|
|
{%~ else %}
|
|
{{ 'There are no answers for this question'|trans -}}
|
|
{%~ endfor %}
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{% else %}
|
|
{{ 'EMPTY'|trans }}
|
|
{% endfor %}
|
|
</div>
|
|
</div>
|
|
<div class="scores">
|
|
<h4 class="py-2">{{ 'Score'|trans }}</h4>
|
|
<div class="btn-toolbar" role="toolbar">
|
|
<div class="btn-group btn-group-lg me-2">
|
|
{# <a class="btn btn-primary">{{ 'Start Elimination'|trans }}</a> #}
|
|
<a href="{{ path('tvdt_prepare_elimination', {seasonCode: season.seasonCode, quiz: quiz.id}) }}"
|
|
class="btn btn-secondary">{{ 'Prepare Custom Elimination'|trans }}</a>
|
|
{%~ if not quiz.eliminations.empty %}
|
|
<button class="btn btn-secondary dropdown-toggle"
|
|
data-bs-toggle="dropdown">{{ 'Load Prepared Elimination'|trans }}</button>
|
|
<ul class="dropdown-menu">
|
|
{%~ for elimination in quiz.eliminations %}
|
|
<li><a class="dropdown-item"
|
|
href="{{ path('tvdt_prepare_elimination_view', {elimination: elimination.id}) }}">{{ elimination.created|format_datetime() }}</a>
|
|
</li>
|
|
{%~ endfor %}
|
|
</ul>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
<p>{{ 'Number of dropouts:'|trans }} {{ quiz.dropouts }} </p>
|
|
<table class="table table-hover">
|
|
<thead>
|
|
<tr>
|
|
<th scope="col">{{ 'Candidate'|trans }}</th>
|
|
<th style="width: 15%" scope="col">{{ 'Correct Answers'|trans }}</th>
|
|
<th style="width: 20%" scope="col">{{ 'Corrections'|trans }}</th>
|
|
<th style="width: 10%" scope="col">{{ 'Score'|trans }}</th>
|
|
<th style="width: 20%" scope="col">{{ 'Time'|trans }}</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{%~ for candidate in result ~%}
|
|
<tr class="table-{% if loop.revindex > quiz.dropouts %}success{% else %}danger{% endif %}">
|
|
<td>{{ candidate.name }}</td>
|
|
<td>{{ candidate.correct|default('0') }}</td>
|
|
<td>
|
|
<form method="post"
|
|
action="{{ path('tvdt_backoffice_modify_correction', {quiz: quiz.id, candidate: candidate.id}) }}">
|
|
<div class="row">
|
|
<div class="col-8">
|
|
<input class="form-control form-control-sm" type="number"
|
|
value="{{ candidate.corrections }}" step="0.5"
|
|
name="corrections">
|
|
</div>
|
|
<div class="col-2">
|
|
<button class="btn btn-sm btn-primary" type="submit">{{ 'Save'|trans }}</button>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</td>
|
|
<td>{{ candidate.score|default('x') }}</td>
|
|
<td>{{ candidate.time }}</td>
|
|
</tr>
|
|
{% else %}
|
|
<tr>
|
|
<td colspan="5">{{ 'No results'|trans }}</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
{# Modal Clear #}
|
|
<div class="modal fade" id="clearQuizModal" data-bs-backdrop="static"
|
|
tabindex="-1"
|
|
aria-labelledby="staticBackdropLabel" aria-hidden="true">
|
|
<div class="modal-dialog">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<h1 class="modal-title fs-5" id="staticBackdropLabel">{{ 'Please Confirm'|trans }}</h1>
|
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
|
</div>
|
|
<div class="modal-body">
|
|
{{ 'Are you sure you want to clear all the results? This will also delete al the eliminations.'|trans }}
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">{{ 'No'|trans }}</button>
|
|
<a href="{{ path('tvdt_backoffice_quiz_clear', {quiz: quiz.id}) }}"
|
|
class="btn btn-danger">{{ 'Yes'|trans }}</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
{# Modal Delete #}
|
|
<div class="modal fade" id="deleteQuizModal" data-bs-backdrop="static"
|
|
tabindex="-1"
|
|
aria-labelledby="staticBackdropLabel" aria-hidden="true">
|
|
<div class="modal-dialog">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<h1 class="modal-title fs-5" id="staticBackdropLabel">{{ 'Please Confirm'|trans }}</h1>
|
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
|
</div>
|
|
<div class="modal-body">
|
|
{{ 'Are you sure you want to delete this quiz?'|trans }}
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">{{ 'No'|trans }}</button>
|
|
<a href="{{ path('tvdt_backoffice_quiz_delete', {quiz: quiz.id}) }}"
|
|
class="btn btn-danger">{{ 'Yes'|trans }}</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{% endblock %}
|