This commit is contained in:
Saufi
2026-05-19 09:53:36 +08:00
parent f39eca4b1c
commit b0eec13d5b
22 changed files with 1166 additions and 238 deletions

View File

@@ -26,13 +26,54 @@
<form method="POST" action="{{ route('public.questionnaire.submit', [$qrCode->token, $participant->uuid]) }}">
@csrf
@php $qNum = 0; @endphp
@foreach($questions as $q)
@if($q->question_type === 'tajuk')
{{-- ── Section header ─────────────────────────────── --}}
<div class="d-flex align-items-center gap-2 mt-4 mb-3 pb-1 border-bottom">
<span class="fw-bold text-primary">{{ $q->question_text }}</span>
</div>
@foreach($q->children as $child)
@php $qNum++ @endphp
<div class="mb-4">
<label class="form-label fw-medium">
{{ $loop->iteration }}. {{ $q->question_text }}
@if($q->is_required)
<span class="text-danger">*</span>
@endif
{{ $qNum }}. {{ $child->question_text }}
@if($child->is_required)<span class="text-danger">*</span>@endif
</label>
@error('q_' . $child->id)
<div class="text-danger small mb-1"><i class="bi bi-exclamation-circle me-1"></i>{{ $message }}</div>
@enderror
<div class="d-flex gap-3 flex-wrap">
@for($i = 1; $i <= 5; $i++)
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio"
name="q_{{ $child->id }}" id="q{{ $child->id }}_{{ $i }}"
value="{{ $i }}" {{ old('q_'.$child->id) == $i ? 'checked' : '' }}>
<label class="form-check-label" for="q{{ $child->id }}_{{ $i }}">
{{ $i }}
@php $label = $q->rating_labels[$i] ?? $q->rating_labels[strval($i)] ?? ''; @endphp
@if($label)
<small class="text-muted d-block" style="font-size:.7rem;">({{ $label }})</small>
@endif
</label>
</div>
@endfor
</div>
</div>
@endforeach
@else
{{-- ── Standalone question ─────────────────────────── --}}
@php $qNum++ @endphp
<div class="mb-4">
<label class="form-label fw-medium">
{{ $qNum }}. {{ $q->question_text }}
@if($q->is_required)<span class="text-danger">*</span>@endif
</label>
@error('q_' . $q->id)
@@ -40,7 +81,7 @@
@enderror
@if($q->question_type === 'rating')
<div class="d-flex gap-2 flex-wrap">
<div class="d-flex gap-3 flex-wrap">
@for($i = 1; $i <= 5; $i++)
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio"
@@ -48,8 +89,8 @@
value="{{ $i }}" {{ old('q_'.$q->id) == $i ? 'checked' : '' }}>
<label class="form-check-label" for="q{{ $q->id }}_{{ $i }}">
{{ $i }}
@if($i === 1) <small class="text-muted">(Sangat Tidak Setuju)</small>
@elseif($i === 5) <small class="text-muted">(Sangat Setuju)</small>
@if($i === 1)<small class="text-muted">(Sangat Tidak Setuju)</small>
@elseif($i === 5)<small class="text-muted">(Sangat Setuju)</small>
@endif
</label>
</div>
@@ -80,8 +121,7 @@
@elseif($q->question_type === 'short_text')
<input type="text" name="q_{{ $q->id }}"
class="form-control @error('q_'.$q->id) is-invalid @enderror"
value="{{ old('q_'.$q->id) }}"
placeholder="Jawapan anda...">
value="{{ old('q_'.$q->id) }}" placeholder="Jawapan anda...">
@elseif($q->question_type === 'long_text')
<textarea name="q_{{ $q->id }}" rows="4"
@@ -89,6 +129,8 @@
placeholder="Jawapan anda...">{{ old('q_'.$q->id) }}</textarea>
@endif
</div>
@endif
@endforeach
<button type="submit" class="btn btn-primary w-100 btn-checkin">