Files
Marijn 18a6090366 Answer on candidate (#72)
* Add Penalty Seconds on tests

* Refactors and start of candidate answer relation

* Add breadcrumbs and UI consistency updates across backoffice templates

* Add breadcrumbs and UI consistency updates across backoffice templates

* Add Dutch translations for email verification and security messages

* Rector

* Refactor for code consistency and type safety assertions across repositories and entities

* Refactor candidate-related logic to optimize queries, improve template separation, and add "Answer Mapping" functionality.

* Cleanup

* Update Symfony

* Add coderabbit config

* Fixes from coderabbit
2026-03-22 22:40:25 +01:00

67 lines
2.7 KiB
Twig

<div class="d-flex justify-content-between align-items-center mb-3">
<div>
{% set questions = quiz.questions %}
{% set currentIndex = null %}
{% for index, q in questions %}
{% if q.id.toString == question.id.toString %}
{% set currentIndex = index %}
{% endif %}
{% endfor %}
{% if currentIndex > 0 %}
{% set prevQuestion = questions[currentIndex - 1] %}
<a href="{{ path('tvdt_backoffice_quiz_candidates_question', {seasonCode: season.seasonCode, quiz: quiz.id, question: prevQuestion.id}) }}"
class="btn btn-secondary">
{{ 'Previous'|trans }}
</a>
{% endif %}
</div>
<h4 class="mb-0">{{ currentIndex + 1 }}. {{ question }}</h4>
<div>
{% if currentIndex is not null and currentIndex < (questions|length - 1) %}
{% set nextQuestion = questions[currentIndex + 1] %}
<a href="{{ path('tvdt_backoffice_quiz_candidates_question', {seasonCode: season.seasonCode, quiz: quiz.id, question: nextQuestion.id}) }}"
class="btn btn-secondary">
{{ 'Next'|trans }}
</a>
{% endif %}
</div>
</div>
<form method="post">
<input type="hidden" name="_token" value="{{ csrf_token('candidate_answer') }}">
<table class="table table-hover table-striped mb-3">
<thead>
<tr>
<th scope="col">{{ 'Candidate'|trans }}</th>
{% for answer in question.answers %}
<th scope="col">{{ answer }}</th>
{% endfor %}
</tr>
</thead>
<tbody>
{% for candidate in candidates %}
<tr>
<th scope="row">{{ candidate.name }}</th>
{% for answer in question.answers %}
<td>
<input type="checkbox"
id="candidate_{{ candidate.id }}_answer_{{ answer.id }}"
name="candidate_answer[{{ candidate.id }}][]"
value="{{ answer.id }}"
class="form-check-input"
{{ answer.candidates.contains(candidate) ? 'checked' : '' }}>
<label for="candidate_{{ candidate.id }}_answer_{{ answer.id }}" class="visually-hidden">
{{ candidate.name }} - {{ answer }}
</label>
</td>
{% endfor %}
</tr>
{% endfor %}
</tbody>
</table>
<button type="submit" class="btn btn-primary">{{ 'Save'|trans }}</button>
</form>