Files
eCert-MBIP/resources/views/admin/programs/questionnaire/preview.blade.php
2026-05-19 09:53:36 +08:00

152 lines
5.7 KiB
PHP

@extends('layouts.public')
@section('title', 'Pratonton Soalselidik — ' . $program->title)
@section('hero')
<h4 class="mb-1">{{ $program->title }}</h4>
<div class="opacity-75 small">
<i class="bi bi-clipboard2-check me-1"></i>Borang Penilaian Program
</div>
@endsection
@push('styles')
<style>
.preview-banner {
position: sticky;
top: 0;
z-index: 1000;
background: #fff3cd;
border-bottom: 2px solid #ffc107;
padding: .6rem 1rem;
text-align: center;
font-size: .85rem;
font-weight: 600;
color: #664d03;
}
.preview-banner i { margin-right: .4rem; }
fieldset { border: none; padding: 0; margin: 0; }
</style>
@endpush
@section('content')
<div class="preview-banner">
<i class="bi bi-eye"></i>PRATONTON ADMIN Borang ini tidak akan dihantar
<button type="button" class="btn btn-sm btn-outline-secondary ms-3 py-0" onclick="window.close()">
<i class="bi bi-x-lg me-1"></i>Tutup
</button>
</div>
<div class="checkin-card card p-4 mb-3 mt-3">
<div class="text-center mb-4">
<div class="rounded-circle bg-primary bg-opacity-10 d-inline-flex align-items-center justify-content-center mx-auto mb-3"
style="width:70px; height:70px;">
<i class="bi bi-clipboard2-check-fill text-primary" style="font-size:2rem;"></i>
</div>
<h5 class="fw-bold mb-1">{{ $pq->questionnaireSet->title }}</h5>
@if($pq->questionnaireSet->description)
<p class="text-muted small mb-1">{{ $pq->questionnaireSet->description }}</p>
@endif
<p class="text-muted small mb-0">
Sila jawab semua soalan sebelum memuat turun sijil anda, <strong>PESERTA CONTOH</strong>.
</p>
</div>
<fieldset disabled>
@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">
{{ $qNum }}. {{ $child->question_text }}
@if($child->is_required)<span class="text-danger">*</span>@endif
</label>
<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 }}" value="{{ $i }}">
<label class="form-check-label">
{{ $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>
@if($q->question_type === 'rating')
<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_{{ $q->id }}" value="{{ $i }}">
<label class="form-check-label">
{{ $i }}
@if($i === 1)<small class="text-muted">(Sangat Tidak Setuju)</small>
@elseif($i === 5)<small class="text-muted">(Sangat Setuju)</small>
@endif
</label>
</div>
@endfor
</div>
@elseif($q->question_type === 'single_choice')
@foreach($q->options_json ?? [] as $opt)
<div class="form-check">
<input class="form-check-input" type="radio" name="q_{{ $q->id }}" value="{{ $opt }}">
<label class="form-check-label">{{ $opt }}</label>
</div>
@endforeach
@elseif($q->question_type === 'multiple_choice')
@foreach($q->options_json ?? [] as $opt)
<div class="form-check">
<input class="form-check-input" type="checkbox" name="q_{{ $q->id }}[]" value="{{ $opt }}">
<label class="form-check-label">{{ $opt }}</label>
</div>
@endforeach
@elseif($q->question_type === 'short_text')
<input type="text" class="form-control" placeholder="Jawapan anda...">
@elseif($q->question_type === 'long_text')
<textarea class="form-control" rows="4" placeholder="Jawapan anda..."></textarea>
@endif
</div>
@endif
@endforeach
</fieldset>
<div class="alert alert-warning d-flex align-items-center gap-2 mb-0 mt-2">
<i class="bi bi-eye-fill flex-shrink-0"></i>
<span class="small">Ini adalah <strong>pratonton admin</strong>. Borang ini tidak boleh dihantar.</span>
</div>
</div>
@endsection