Files
lms-v2/resources/views/pages/admin/exams/questions/import.blade.php
T

49 lines
3.4 KiB
PHP

@extends('layouts.app')
@section('content')
<div class="max-w-3xl mx-auto px-4 py-8">
<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">Import Bank Soal</h2>
</div>
<div class="bg-white rounded-2xl shadow-sm border border-slate-200 overflow-hidden p-6 sm:p-8">
<div class="mb-8 p-4 bg-blue-50 border border-blue-100 rounded-xl text-sm text-blue-800 flex items-start gap-4">
<svg class="w-6 h-6 text-blue-500 mt-0.5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path></svg>
<div>
<p class="font-bold mb-1">Panduan Import</p>
<p>Gunakan format Excel standar untuk mengimpor soal. Pastikan kolom Departemen ID, Posisi ID, dan Subject ID diisi menggunakan ID numerik (bukan nama/teks). Tipe soal ditulis sebagai <code>single</code>, <code>multiple</code>, <code>true_false</code>, atau <code>descriptive</code>.</p>
<a href="#" class="inline-block mt-3 px-4 py-2 bg-white text-blue-600 font-bold border border-blue-200 rounded-lg hover:bg-blue-100 transition-colors shadow-sm text-xs">Unduh Template Excel</a>
</div>
</div>
<form action="{{ url('admin/exams/questions/import') }}" method="POST" enctype="multipart/form-data" class="space-y-6">
@csrf
<div class="border-2 border-dashed border-slate-300 rounded-2xl p-10 text-center hover:bg-slate-50 transition-colors relative">
<input type="file" name="file" required accept=".xlsx,.xls,.csv" class="absolute inset-0 w-full h-full opacity-0 cursor-pointer" id="file_upload">
<svg class="w-12 h-12 text-slate-400 mx-auto mb-3" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 13h6m-3-3v6m5 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"></path></svg>
<p class="text-sm font-bold text-slate-700">Klik untuk memilih file excel</p>
<p class="text-xs text-slate-500 mt-1" id="file_name">atau seret dan lepas (Drag & Drop) di sini (.xlsx, .csv)</p>
</div>
<div class="flex justify-end pt-4">
<button type="submit" class="px-6 py-2.5 text-sm font-bold text-white bg-slate-800 hover:bg-slate-900 rounded-xl shadow-md transition-colors w-full md:w-auto">
Mulai Proses Import
</button>
</div>
</form>
</div>
</div>
<script>
// Script sederhana untuk menampilkan nama file yang dipilih
document.getElementById('file_upload').addEventListener('change', function(e) {
if(e.target.files.length > 0) {
document.getElementById('file_name').innerHTML = '<span class="text-blue-600 font-bold">' + e.target.files[0].name + '</span> siap diunggah.';
}
});
</script>
@endsection