2026-05-30 22:15:16 +07:00
|
|
|
@extends('layouts.app')
|
|
|
|
|
|
|
|
|
|
@section('content')
|
|
|
|
|
<link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet" />
|
|
|
|
|
<script src="https://code.jquery.com/jquery-3.7.1.min.js"></script>
|
|
|
|
|
<script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>
|
|
|
|
|
|
|
|
|
|
<style>
|
|
|
|
|
.select2-container .select2-selection--single { height: 42px; border-radius: 0.75rem; border-color: #e2e8f0; background-color: #f8fafc; }
|
|
|
|
|
.select2-container--default .select2-selection--single .select2-selection__rendered { line-height: 42px; font-size: 0.875rem; color: #334155; padding-left: 1rem; }
|
|
|
|
|
.select2-container--default .select2-selection--single .select2-selection__arrow { height: 40px; right: 10px; }
|
|
|
|
|
</style>
|
|
|
|
|
|
2026-06-04 08:36:18 +07:00
|
|
|
<div class="max-w-5xl mx-auto px-4 py-8" x-data="{ questionType: '{{ old('question_type', '') }}' }" @update-type.window="questionType = $event.detail">
|
2026-05-30 22:15:16 +07:00
|
|
|
<div class="mb-6 flex items-center space-x-3">
|
|
|
|
|
<a href="{{ route('admin.exams.questions') }}" class="text-slate-400 hover:text-blue-600 transition-colors">
|
|
|
|
|
<svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 19l-7-7m0 0l7-7m-7 7h18"></path></svg>
|
|
|
|
|
</a>
|
|
|
|
|
<h2 class="text-2xl font-bold text-slate-800 tracking-tight">Tambah Soal Baru</h2>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="bg-white rounded-2xl shadow-sm border border-slate-200 overflow-hidden">
|
2026-06-04 08:36:18 +07:00
|
|
|
<form action="{{ url('admin/exams/questions') }}" method="POST" class="p-6 sm:p-8 space-y-6">
|
2026-05-30 22:15:16 +07:00
|
|
|
@csrf
|
|
|
|
|
|
|
|
|
|
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
|
|
|
|
|
<div>
|
2026-06-04 08:36:18 +07:00
|
|
|
<label class="block text-sm font-bold text-slate-700 mb-2">Subject / Materi Pembelajaran <span class="text-red-500">*</span></label>
|
|
|
|
|
<select name="subject_id" class="select2 w-full text-sm" required>
|
|
|
|
|
<option value="">-- Pilih Judul Materi --</option>
|
|
|
|
|
@foreach($subjects as $subj)
|
|
|
|
|
<option value="{{ $subj->id }}" {{ old('subject_id') == $subj->id ? 'selected' : '' }}>{{ $subj->name }}</option>
|
|
|
|
|
@endforeach
|
|
|
|
|
</select>
|
|
|
|
|
</div>
|
|
|
|
|
<div>
|
|
|
|
|
<label class="block text-sm font-bold text-slate-700 mb-2">Departemen Khusus</label>
|
2026-05-30 22:15:16 +07:00
|
|
|
<select name="department_id" class="select2 w-full text-sm">
|
2026-06-04 08:36:18 +07:00
|
|
|
<option value="">-- Berlaku Semua Departemen --</option>
|
2026-05-30 22:15:16 +07:00
|
|
|
@foreach($departments as $dept)
|
|
|
|
|
<option value="{{ $dept->id }}" {{ old('department_id') == $dept->id ? 'selected' : '' }}>{{ $dept->name }}</option>
|
|
|
|
|
@endforeach
|
|
|
|
|
</select>
|
|
|
|
|
</div>
|
|
|
|
|
<div>
|
2026-06-04 08:36:18 +07:00
|
|
|
<label class="block text-sm font-bold text-slate-700 mb-2">Posisi / Jabatan Khusus</label>
|
2026-05-30 22:15:16 +07:00
|
|
|
<select name="position_id" class="select2 w-full text-sm">
|
2026-06-04 08:36:18 +07:00
|
|
|
<option value="">-- Berlaku Semua Jabatan --</option>
|
2026-05-30 22:15:16 +07:00
|
|
|
@foreach($positions as $pos)
|
|
|
|
|
<option value="{{ $pos->id }}" {{ old('position_id') == $pos->id ? 'selected' : '' }}>{{ $pos->name }}</option>
|
|
|
|
|
@endforeach
|
|
|
|
|
</select>
|
|
|
|
|
</div>
|
|
|
|
|
|
2026-06-04 08:36:18 +07:00
|
|
|
<div>
|
|
|
|
|
<label class="block text-sm font-bold text-slate-700 mb-2">Tipe Bentuk Soal <span class="text-red-500">*</span></label>
|
|
|
|
|
<select name="question_type" class="select2 w-full text-sm" required id="question_type_select">
|
|
|
|
|
<option value="">-- Pilih Tipe --</option>
|
|
|
|
|
<option value="single" {{ old('question_type') == 'single' ? 'selected' : '' }}>Single Choice (1 Kunci Jawaban)</option>
|
|
|
|
|
<option value="multiple" {{ old('question_type') == 'multiple' ? 'selected' : '' }}>Multiple Choice (Multi Jawaban)</option>
|
|
|
|
|
<option value="true_false" {{ old('question_type') == 'true_false' ? 'selected' : '' }}>True / False (Benar / Salah)</option>
|
|
|
|
|
<option value="descriptive" {{ old('question_type') == 'descriptive' ? 'selected' : '' }}>Descriptive (Esai / Uraian)</option>
|
2026-05-30 22:15:16 +07:00
|
|
|
</select>
|
|
|
|
|
</div>
|
|
|
|
|
<div>
|
2026-06-04 08:36:18 +07:00
|
|
|
<label class="block text-sm font-bold text-slate-700 mb-2">Tingkat Kesulitan Soal <span class="text-red-500">*</span></label>
|
|
|
|
|
<select name="question_level" class="select2 w-full text-sm" required>
|
|
|
|
|
<option value="mudah" {{ old('question_level') == 'mudah' ? 'selected' : '' }}>Mudah</option>
|
|
|
|
|
<option value="sedang" {{ old('question_level') == 'sedang' ? 'selected' : '' }}>Sedang</option>
|
|
|
|
|
<option value="sulit" {{ old('question_level') == 'sulit' ? 'selected' : '' }}>Sulit</option>
|
2026-05-30 22:15:16 +07:00
|
|
|
</select>
|
|
|
|
|
</div>
|
2026-06-04 08:36:18 +07:00
|
|
|
<div class="grid grid-cols-2 gap-3">
|
|
|
|
|
<div>
|
|
|
|
|
<label class="block text-sm font-bold text-slate-700 mb-2">Passing Grade</label>
|
|
|
|
|
<input type="number" name="passing_grade" value="{{ old('passing_grade', 0) }}" class="w-full px-3 py-2 bg-slate-50 border border-slate-200 rounded-xl text-sm focus:border-blue-500">
|
|
|
|
|
</div>
|
|
|
|
|
<div>
|
|
|
|
|
<label class="block text-sm font-bold text-slate-700 mb-2">Durasi (Detik)</label>
|
|
|
|
|
<input type="number" name="duration" value="{{ old('duration', 0) }}" class="w-full px-3 py-2 bg-slate-50 border border-slate-200 rounded-xl text-sm focus:border-blue-500">
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2026-05-30 22:15:16 +07:00
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="border-t border-slate-100 pt-6">
|
2026-06-04 08:36:18 +07:00
|
|
|
<label class="block text-sm font-bold text-slate-700 mb-2">Isi Teks Pertanyaan <span class="text-red-500">*</span></label>
|
|
|
|
|
<textarea name="question_text" rows="4" required class="w-full px-4 py-3 bg-slate-50 border border-slate-200 rounded-xl focus:bg-white focus:ring-2 focus:ring-blue-500/20 text-sm" placeholder="Masukkan konten pertanyaan...">{{ old('question_text') }}</textarea>
|
2026-05-30 22:15:16 +07:00
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="border-t border-slate-100 pt-6" x-show="questionType !== ''" x-transition>
|
2026-06-04 08:36:18 +07:00
|
|
|
<h3 class="text-sm font-bold text-slate-800 uppercase tracking-wider mb-4 border-l-4 border-blue-500 pl-3">Kerangka Pilihan & Kunci Jawaban</h3>
|
2026-05-30 22:15:16 +07:00
|
|
|
|
2026-06-04 08:36:18 +07:00
|
|
|
<div x-show="questionType === 'single'" class="space-y-3">
|
|
|
|
|
@foreach(['A' => 'option_a', 'B' => 'option_b', 'C' => 'option_b', 'D' => 'option_d', 'E' => 'option_e'] as $key => $column)
|
2026-05-30 22:15:16 +07:00
|
|
|
<div class="flex items-center gap-3">
|
2026-06-04 08:36:18 +07:00
|
|
|
<input type="radio" name="correct_answer" value="{{ $key }}" class="w-5 h-5 text-blue-600 border-slate-300">
|
|
|
|
|
<input type="text" name="{{ $column }}" placeholder="Isi Pilihan {{ $key }}" class="flex-1 px-4 py-2 bg-white border border-slate-200 rounded-lg text-sm">
|
2026-05-30 22:15:16 +07:00
|
|
|
</div>
|
|
|
|
|
@endforeach
|
|
|
|
|
</div>
|
|
|
|
|
|
2026-06-04 08:36:18 +07:00
|
|
|
<div x-show="questionType === 'multiple'" class="space-y-3">
|
|
|
|
|
@foreach(['A' => 'option_a', 'B' => 'option_b', 'C' => 'option_c', 'D' => 'option_d', 'E' => 'option_e'] as $key => $column)
|
2026-05-30 22:15:16 +07:00
|
|
|
<div class="flex items-center gap-3">
|
2026-06-04 08:36:18 +07:00
|
|
|
<input type="checkbox" name="correct_answer[]" value="{{ $key }}" class="w-5 h-5 text-blue-600 border-slate-300 rounded">
|
|
|
|
|
<input type="text" name="{{ $column }}" placeholder="Isi Pilihan {{ $key }}" class="flex-1 px-4 py-2 bg-white border border-slate-200 rounded-lg text-sm">
|
2026-05-30 22:15:16 +07:00
|
|
|
</div>
|
|
|
|
|
@endforeach
|
|
|
|
|
</div>
|
|
|
|
|
|
2026-06-04 08:36:18 +07:00
|
|
|
<div x-show="questionType === 'true_false'" class="flex gap-6">
|
2026-05-30 22:15:16 +07:00
|
|
|
<label class="flex items-center gap-2 p-4 border border-slate-200 rounded-xl cursor-pointer hover:bg-slate-50 w-48">
|
2026-06-04 08:36:18 +07:00
|
|
|
<input type="radio" name="correct_answer" value="True" class="w-5 h-5 text-emerald-600 border-slate-300">
|
2026-05-30 22:15:16 +07:00
|
|
|
<span class="font-bold text-slate-700">True (Benar)</span>
|
|
|
|
|
</label>
|
|
|
|
|
<label class="flex items-center gap-2 p-4 border border-slate-200 rounded-xl cursor-pointer hover:bg-slate-50 w-48">
|
2026-06-04 08:36:18 +07:00
|
|
|
<input type="radio" name="correct_answer" value="False" class="w-5 h-5 text-red-600 border-slate-300">
|
2026-05-30 22:15:16 +07:00
|
|
|
<span class="font-bold text-slate-700">False (Salah)</span>
|
|
|
|
|
</label>
|
|
|
|
|
</div>
|
|
|
|
|
|
2026-06-04 08:36:18 +07:00
|
|
|
<div x-show="questionType === 'descriptive'">
|
|
|
|
|
<p class="text-xs text-slate-400 mb-2">Tuliskan panduan atau esensi jawaban yang dinilai benar:</p>
|
|
|
|
|
<textarea name="option_a" rows="3" class="w-full px-4 py-3 bg-slate-50 border border-slate-200 rounded-xl text-sm focus:border-blue-500" placeholder="Catatan/Kunci Esai untuk Korektor..."></textarea>
|
2026-05-30 22:15:16 +07:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="pt-6 flex justify-end space-x-3 border-t border-slate-100 mt-8">
|
2026-06-04 08:36:18 +07:00
|
|
|
<a href="{{ route('admin.exams.questions') }}" class="px-5 py-2.5 text-sm font-semibold text-slate-600 hover:bg-slate-100 rounded-xl">Batal</a>
|
|
|
|
|
<button type="submit" class="px-5 py-2.5 text-sm font-semibold text-white bg-blue-600 hover:bg-blue-700 rounded-xl shadow-md">Simpan Soal</button>
|
2026-05-30 22:15:16 +07:00
|
|
|
</div>
|
|
|
|
|
</form>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
$(document).ready(function() {
|
|
|
|
|
$('.select2').select2({ width: '100%' });
|
2026-06-04 08:36:18 +07:00
|
|
|
$('#question_type_select').on('change', function() {
|
|
|
|
|
window.dispatchEvent(new CustomEvent('update-type', { detail: $(this).val() }));
|
2026-05-30 22:15:16 +07:00
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
</script>
|
|
|
|
|
@endsection
|