@extends('layouts.v_template') @section('script') @endsection @section('content')

Detail

Rekapan Jawaban

Berikut adalah alur diagnosis dan keputusan yang telah User pilih selama proses evaluasi.

@php $rekap = []; foreach ($quiz as $index => $item) { /* |-------------------------------------------------------------------------- | WARNA STATUS |-------------------------------------------------------------------------- */ $color = '#6b7280'; if ($item->choice->status == 'Tepat') { $color = '#16a34a'; } elseif ($item->choice->status == 'Cukup Tepat') { $color = '#2563eb'; } elseif ($item->choice->status == 'Kurang Tepat') { $color = '#f59e0b'; } elseif ($item->choice->status == 'Tidak Tepat') { $color = '#ef4444'; } elseif ($item->choice->status == 'Tindakan Salah') { $color = '#dc2626'; } elseif ($item->choice->status == 'Tindakan Fatal') { $color = '#7f1d1d'; } /* |-------------------------------------------------------------------------- | TITLE STEP |-------------------------------------------------------------------------- */ $title = 'Langkah Diagnosis'; if ($index == 0) { $title = 'Diagnosis Awal'; } elseif ($index > 0 && $index < count($quiz) - 1) { $title = 'Pemeriksaan Lanjutan'; } elseif ($index == count($quiz) - 1) { $title = 'Kesimpulan'; } $rekap[] = [ 'step' => $index + 1, 'title' => $title, 'choice' => $item->choice->text, 'status' => $item->choice->status, 'color' => $color ]; } @endphp @foreach($rekap as $item)
@if(!$loop->last)
@endif
{{ $item['step'] }}
{{ $item['title'] }}
{{ $item['status'] }}
{{ $item['choice'] }}
@endforeach
@php /* |-------------------------------------------------------------------------- | JAWABAN USER |-------------------------------------------------------------------------- */ $userAnswer = $alternatif->jawaban; /* |-------------------------------------------------------------------------- | CARI JAWABAN DENGAN SKOR TERTINGGI |-------------------------------------------------------------------------- */ $scores = [ 'A' => $alternatif_question->score_a, 'B' => $alternatif_question->score_b, 'C' => $alternatif_question->score_c, 'D' => $alternatif_question->score_d, ]; $correctAnswer = array_search( max($scores), $scores ); /* |-------------------------------------------------------------------------- | OPTIONS |-------------------------------------------------------------------------- */ $options = [ 'A' => $alternatif_question->pertanyaan_a, 'B' => $alternatif_question->pertanyaan_b, 'C' => $alternatif_question->pertanyaan_c, 'D' => $alternatif_question->pertanyaan_d ]; @endphp

Evaluasi Alternatif Jawaban

Sistem membandingkan jawaban Anda dengan diagnosis yang paling sesuai berdasarkan data kasus.

@foreach($options as $key => $text) @php $class = ''; /* |-------------------------------------------------------------------------- | JAWABAN BENAR |-------------------------------------------------------------------------- */ if ($key == $correctAnswer) { $class = 'option-correct'; } /* |-------------------------------------------------------------------------- | PILIHAN USER SALAH |-------------------------------------------------------------------------- */ if ( $key == $userAnswer && $userAnswer != $correctAnswer ) { $class = 'option-user'; } @endphp
{{ $key }}. {{ $text }}
@if($key == $correctAnswer) {{ $alternatif_question->feedback_benar }} @elseif($key == $userAnswer && $userAnswer != $correctAnswer) {{ $alternatif_question->feedback_salah }} @else Pilihan ini bukan diagnosis utama berdasarkan data yang ditemukan. @endif
@if($key == $correctAnswer)
✔ Jawaban Benar
@endif @if( $key == $userAnswer && $userAnswer != $correctAnswer )
Pilihan Anda
@endif
@endforeach
@php /* |-------------------------------------------------------------------------- | USER ORDER |-------------------------------------------------------------------------- | | dari db: | 4,2,1,5,6,3 | */ $userIds = explode( ',', $puzzle->jawaban ); /* |-------------------------------------------------------------------------- | CORRECT ORDER |-------------------------------------------------------------------------- | | dari db: | 1,2,3,4,5,6 | */ $correctOrder = [ $puzzle_question->opsi1, $puzzle_question->opsi2, $puzzle_question->opsi3, $puzzle_question->opsi4, $puzzle_question->opsi5, $puzzle_question->opsi6, ]; /* |-------------------------------------------------------------------------- | SEMUA OPSI |-------------------------------------------------------------------------- */ $allOptions = [ '1' => $puzzle_question->opsi1, '2' => $puzzle_question->opsi2, '3' => $puzzle_question->opsi3, '4' => $puzzle_question->opsi4, '5' => $puzzle_question->opsi5, '6' => $puzzle_question->opsi6, ]; /* |-------------------------------------------------------------------------- | USER ORDER TEXT |-------------------------------------------------------------------------- */ $userOrder = []; foreach ($userIds as $id) { $userOrder[] = $allOptions[$id] ?? '-'; } @endphp
Evaluasi Urutan Puzzle
Sistem membandingkan urutan yang Anda susun dengan prosedur diagnosis yang benar.

Urutan Jawaban Anda

@foreach($userOrder as $index => $step) @php $isCorrect = isset($correctOrder[$index]) && $correctOrder[$index] == $step; @endphp
{{ $index + 1 }}
{{ $step }}
@endforeach

Urutan Yang Benar

@foreach($correctOrder as $index => $step)
{{ $index + 1 }}
{{ $step }}
@endforeach
{{-- FEEDBACK --}}
@endsection @section('script') @endsection