@extends('layouts.cbt') @section('page-title', 'Hasil Ujian') @section('sidebar')@include('components.siswa-sidebar')@endsection @section('content')

{{ $attempt->exam->title }}

{{ $attempt->exam->subject->name }}

{{ $attempt->score }}

{{ $attempt->isPassed() ? 'SELAMAT! Anda Lulus' : 'Perlu Remedial' }}

KKM: {{ $attempt->exam->passing_score }} | Durasi: {{ $attempt->exam->duration_minutes }} menit

@if($attempt->exam->show_explanation)

Pembahasan

@foreach($attempt->answers as $answer)

{!! $answer->question->content !!}

@if($answer->question->type->value === 'essay')

Jawaban: {{ $answer->essay_answer }}

Nilai: {{ $answer->points_earned }}/{{ $answer->question->points }}

@elseif($answer->question->type->value === 'pg_kompleks') @php $selected = $answer->question->options->whereIn('id', $answer->selected_option_ids ?? []); $correct = $answer->question->options->where('is_correct', true); @endphp

Jawaban Anda: @if($selected->isNotEmpty()) {{ $selected->map(fn($o) => $o->label.'. '.$o->content)->join(' | ') }} @else - @endif {{ $answer->is_correct ? '(Benar)' : '(Salah)' }}

@if(!$answer->is_correct)

Kunci: {{ $correct->map(fn($o) => $o->label.'. '.$o->content)->join(' | ') }}

@endif @else

Jawaban Anda: {{ $answer->selectedOption?->label ?? '-' }}. {{ $answer->selectedOption?->content }} {{ $answer->is_correct ? '(Benar)' : '(Salah)' }}

@endif @if($answer->question->explanation)

{{ $answer->question->explanation }}

@endif
@endforeach
@endif Kembali ke Dashboard @endsection