@extends('layouts.template') @section('title', 'Kuesioner Soal') @section('custom_css') @endsection @section('content') @php $listHal = $daftarHal ?? collect([$hal]); $posisiAktif = $listHal->search($hal); if ($posisiAktif === false) { $posisiAktif = 0; } $totalHalaman = $totalHal ?? $listHal->count(); $progressPercentage = $totalHalaman > 0 ? round((($posisiAktif + 1) / max($totalHalaman, 1)) * 100) : 100; $halSebelumnya = $posisiAktif > 0 ? $listHal[$posisiAktif - 1] : null; $halBerikut = ($posisiAktif < $listHal->count() - 1) ? $listHal[$posisiAktif + 1] : null; $isHalTerakhir = $halBerikut === null; @endphp

Kuesioner

{{ $soal->judul_soal ?? 'Daftar Soal' }}

← Daftar Judul Halaman {{ $hal }}
Progres Halaman {{ $progressPercentage }}%
@if ($hal === $halPertama)

Judul Soal

{{ $soal->judul_soal ?? '-' }}

Keterangan

{!! $soal->keterangan_soal !!}
@endif @if ($errors->any()) @endif
Daftar Pertanyaan
Halaman {{ $hal }} dari {{ $listHal->count() }}
@csrf @forelse ($soal->soalDetail as $detail) @php $detailConfig = json_decode($detail->soal, true) ?? []; $pertanyaan = $detailConfig['soal'] ?? 'Pertanyaan tidak tersedia'; $type = $detailConfig['type'] ?? 'option'; $options = $detailConfig['options'] ?? []; $oldAnswer = old('jawaban.' . $detail->id); $oldOtherAnswer = old('jawaban_lainnya.' . $detail->id); $showLainnya = $oldAnswer === 'Lainnya' || (!empty($oldOtherAnswer)); $detailHal = $detail->hal ?? $listHal->first(); $isVisible = $detailHal == $hal; @endphp
{{ $loop->iteration }}
{{ $pertanyaan }}
@if ($type === 'textarea') @elseif ($type === 'text') @else @if (!empty($options))
@foreach ($options as $optionIndex => $option) @php $optionId = 'jawaban-' . $detail->id . '-' . $optionIndex; $isLainnya = strtolower(trim($option)) === 'lainnya'; @endphp
@if ($isLainnya)
@endif @endforeach
@else @endif @endif @error('jawaban.' . $detail->id)
{{ $message }}
@enderror @error('jawaban_lainnya.' . $detail->id)
{{ $message }}
@enderror
@empty
Belum ada pertanyaan pada halaman ini.
@endforelse @error('lms_mutu_soal_id')

{{ $message }}

@enderror @error('jawaban')

{{ $message }}

@enderror
@endsection @section('custom_js') @endsection