mirror of
https://github.com/MarijnDoeve/TijdVoorDeTest.git
synced 2026-07-05 23:20:18 +02:00
281462fab8
* Added Gedmo stuff, fix translations * Add CSRF token validation across backoffice forms - Added CSRF validations to candidate correction, penalty, answer saving, and elimination forms. - Updated corresponding Twig templates to include CSRF token inputs. - Adjusted column count in `tab_result` template to maintain layout consistency. * Add unique index constraint for `quiz_candidate` with soft delete support - Updated migration to include a unique index on `quiz_candidate` table that excludes soft-deleted records. - Adjusted `QuizCandidate` entity to reflect the new unique constraint with `deleted_at` condition. * Add CSRF token validation for quiz-related actions - Added CSRF validation to `enableQuiz`, `clearQuiz`, `deleteQuiz`, `toggleCandidate`, and `prepareElimination` actions. - Updated Twig templates to replace links with POST forms to include CSRF tokens. - Set HTTP method restrictions for related endpoints to `POST`. * Fix unique index condition for `quiz_candidate` with soft deletes - Updated condition in unique index definition of `quiz_candidate` to add parentheses for clarity. - Adjusted related migration to reflect the revised condition. * Remove if for post an use methods in Route instead * Refactor CSRF token validation in backoffice controllers - Applied `#[IsCsrfTokenValid]` attribute for CSRF checks to simplify and standardize validation. - Removed manual `isCsrfTokenValid` calls and associated exception throwing. - Updated method signatures across affected endpoints to remove unnecessary `Request` dependency. - Ensured consistency in route HTTP method restrictions where applicable. * Add rector and phpstan * Add validation for answering incorrect quiz question - Added logic to prevent candidates from answering questions out of sequence in `QuizController`. - Updated Dutch translations to include the new error message. * Things
53 lines
2.4 KiB
Twig
53 lines
2.4 KiB
Twig
<h4 class="mb-3">{{ 'Candidates'|trans }}</h4>
|
|
<table class="table table-hover mb-3">
|
|
<thead>
|
|
<tr>
|
|
<th scope="col">{{ 'Name'|trans }}</th>
|
|
<th scope="col">{{ 'Quiz Status'|trans }}</th>
|
|
<th scope="col">{{ 'Candidate Status'|trans }}</th>
|
|
<th scope="col">{{ 'Actions'|trans }}</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for data in candidateData %}
|
|
{% set candidate = data.candidate %}
|
|
{% set quizCandidate = data.quizCandidate %}
|
|
{% set givenAnswersCount = data.givenAnswersCount %}
|
|
|
|
<tr>
|
|
<td>{{ candidate.name }}</td>
|
|
<td>
|
|
{% if quizCandidate and quizCandidate.started %}
|
|
{% if givenAnswersCount >= quiz.questions|length %}
|
|
<span class="badge text-bg-success">{{ 'Completed'|trans }}</span>
|
|
{% else %}
|
|
<span class="badge text-bg-warning">{{ 'In Progress'|trans }} ({{ givenAnswersCount }}/{{ quiz.questions|length }})</span>
|
|
{% endif %}
|
|
{% else %}
|
|
<span class="badge text-bg-secondary">{{ 'Not Started'|trans }}</span>
|
|
{% endif %}
|
|
</td>
|
|
<td>
|
|
{% if quizCandidate == null or quizCandidate.active %}
|
|
<span class="badge text-bg-success">{{ 'Active'|trans }}</span>
|
|
{% else %}
|
|
<span class="badge text-bg-secondary">{{ 'Inactive'|trans }}</span>
|
|
{% endif %}
|
|
</td>
|
|
<td>
|
|
<form action="{{ path('tvdt_backoffice_toggle_candidate', {quiz: quiz.id, candidate: candidate.id}) }}" method="POST">
|
|
<input type="hidden" name="_token" value="{{ csrf_token('toggle_candidate') }}">
|
|
<button type="submit" class="btn btn-sm btn-outline-secondary">
|
|
{% if quizCandidate == null or quizCandidate.active %}
|
|
{{ 'Deactivate'|trans }}
|
|
{% else %}
|
|
{{ 'Activate'|trans }}
|
|
{% endif %}
|
|
</button>
|
|
</form>
|
|
</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|