{{ $question->question_text }}
@php
$optionCounts = array_fill_keys($question->options_array, 0);
foreach($responses as $response) {
$answers = is_array($response->answers) ? $response->answers : json_decode($response->answers, true);
$ans = $answers[$question->id] ?? null;
if($ans !== null && isset($optionCounts[$ans])) {
$optionCounts[$ans]++;
}
}
$totalResponses = $responses->count();
@endphp
| Pilihan |
Jumlah |
Persentase |
@foreach($question->options_array as $option)
| {{ $option }} |
{{ $optionCounts[$option] }} |
@if($totalResponses > 0)
{{ number_format(($optionCounts[$option] / $totalResponses) * 100, 1) }}%
@else
0%
@endif
|
@endforeach
@endif
@endforeach
@if($questions->where('question_type', 'radio')->count() === 0)
Tidak ada pertanyaan radio pada survey ini.
@endif
Tidak ada pertanyaan checkbox atau text pada survey ini.
@endif