@foreach($aqList as $aq)
@php
$q = $aq->question;
$answer = $answers[$q->id] ?? null;
$selectedId = $answer?->selected_option_id;
$correctOpt = $q->options->firstWhere('is_correct', true);
$wasCorrect = $answer?->is_correct;
@endphp
Q{{ $aq->question_order }}
@if($wasCorrect)
Correct
@elseif($selectedId)
Wrong
@else
Not Answered
@endif
{!! $q->question_text !!}
@foreach($q->options as $option)
@php
$isSelected = $selectedId == $option->id;
$isCorrect = $option->is_correct;
$rowClass = $isCorrect ? 'bg-success bg-opacity-10 border-success'
: ($isSelected && !$isCorrect ? 'bg-danger bg-opacity-10 border-danger' : 'bg-light');
@endphp
{{ $option->option_label }}
{!! $option->option_text !!}
@if($isCorrect)
@elseif($isSelected)
@endif
@endforeach
@if($q->explanation)
Explanation:
{!! $q->explanation !!}
@endif
@endforeach