@push('style')
@vite(['resources/css/landing.css', 'resources/css/level-test.css', 'resources/css/unit/unit_exercise.css'])
@endpush
@php
use App\Enums\QuestionLabelEnum;
function getLabelClass($label, $answer, $correct)
{
if ($label === $correct && $correct === $answer) {
return 'answered-correct'; // cau tra loi dung voi dap an va dung voi label
}
if ($label === $correct && $answer !== $correct) {
return 'answer-correct'; // cau tra loi dung khong dung voi dap an va nhung dung voi label
}
if ($label === $answer && $answer !== $correct) {
return 'answer-wrong'; // cau tra loi sai voi dap an va sai voi label
}
return '';
}
// get so checkbox de hien thi dua vao truong choices
// $answerLabel=["A","B","C",...]
function getAnswerLabels($choices): array
{
$choicesArray = $choices ? json_decode($choices, true) : ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H'];
return QuestionLabelEnum::getAnswerLabels(count($choicesArray));
}
@endphp