@extends('layouts.admin') @section('title', $set->title) @section('header', $set->title) @section('breadcrumb') @endsection @section('header-actions')
Edit @if($set->status === 'draft')
@csrf
@elseif($set->status === 'published')
@csrf
@endif
@endsection @push('styles') @endpush @section('content')
{{-- Left: Questions --}}
@if($set->status === 'draft')
Set ini masih dalam status Draf. Terbitkan setelah siap untuk dilampirkan ke program.
@elseif($set->status === 'archived')
Set ini telah diarkibkan dan tidak boleh dilampirkan ke program baru.
@endif {{-- Question List --}}
Senarai Soalan {{ $totalCount }}
Seret untuk susun semula
@if($totalCount === 0)
Belum ada soalan. Tambah soalan menggunakan borang di sebelah kanan.
@else
    @foreach($topLevel as $q) @if($q->question_type === 'tajuk') {{-- ── TAJUK BLOCK ── --}}
  • {{-- Tajuk header row --}}
    Tajuk
    {{ $q->question_text }}
    @if($q->rating_labels)
    @php $labels = array_filter($q->rating_labels); @endphp @if(!empty($labels)) {{ implode(' · ', $labels) }} @endif
    @endif
    @csrf @method('DELETE')
    {{-- Rating labels pills --}} @if($q->rating_labels && array_filter($q->rating_labels))
    @foreach(array_filter($q->rating_labels) as $val => $lbl) {{ $val }}: {{ $lbl }} @endforeach
    @endif {{-- Children list --}}
      @foreach($q->children as $child)
    • {{ $loop->iteration }} Rating 1–5 @if($child->is_required) Wajib @endif
      {{ $child->question_text }}
      @csrf @method('DELETE')
    • @endforeach @if($q->children->isEmpty())
    • Tiada soalan dalam bahagian ini
    • @endif
  • @else {{-- ── STANDALONE QUESTION ── --}}
  • {{ $loop->iteration }} {{ match($q->question_type) { 'rating' => 'Rating 1–5', 'single_choice' => 'Pilihan Tunggal', 'multiple_choice' => 'Pilihan Berganda', 'short_text' => 'Teks Pendek', 'long_text' => 'Teks Panjang', default => $q->question_type, } }} @if($q->is_required) Wajib @endif
    {{ $q->question_text }}
    @if($q->options_json)
    @foreach($q->options_json as $opt) {{ $opt }} @endforeach
    @endif
    @csrf @method('DELETE')
  • @endif @endforeach
@endif
{{-- Used In Programs --}} @if($usedInPrograms->count())
Digunakan Dalam Program
    @foreach($usedInPrograms as $program)
  • {{ $program->title }} @if($program->pivot->is_confirmed ?? false) Disahkan @else Belum Disahkan @endif
  • @endforeach
@endif
{{-- Right: Add / Edit Question Form --}}
Tambah Soalan
@csrf {{-- Question text --}}
@error('question_text')
{{ $message }}
@enderror
{{-- Question type --}}
{{-- Required (hidden for tajuk) --}}
{{-- Parent selector (rating only) --}}
@error('parent_id')
{{ $message }}
@enderror
{{-- Rating labels (tajuk only) --}}
@for ($i = 1; $i <= 5; $i++)
{{ $i }}
@endfor
Kosongkan jika tiada label untuk nilai tersebut.
{{-- Options (choice types) --}}
@error('options')
{{ $message }}
@enderror
@endsection @push('scripts') @endpush