fix: urutan filter data siswa: Jurusan → Tingkat → Kelas

- Dropdown diurutkan: Jurusan, Tingkat Kelas, Kelas
- Jurusan di-sort by department_name (alfabetis)
- Hapus kode jurusan dari option (cukup nama)
This commit is contained in:
Bro
2026-07-24 18:56:50 +07:00
parent 798c8c3baf
commit 9be9b4d939
2 changed files with 12 additions and 11 deletions
@@ -50,6 +50,7 @@ class StudentReportController extends Controller
->whereNotNull('department_code') ->whereNotNull('department_code')
->where('department_code', '!=', '') ->where('department_code', '!=', '')
->get() ->get()
->sortBy('department_name')
->pluck('department_name', 'department_code'); ->pluck('department_name', 'department_code');
return view('students.index', compact('students', 'classLevels', 'classNames', 'departments')); return view('students.index', compact('students', 'classLevels', 'classNames', 'departments'));
+11 -11
View File
@@ -33,8 +33,18 @@
class="w-full pl-9 pr-4 py-2.5 border border-gray-200 rounded-xl text-sm bg-gray-50/50 focus:bg-white focus:outline-none focus:ring-2 focus:ring-blue-500/20 focus:border-blue-500 transition"> class="w-full pl-9 pr-4 py-2.5 border border-gray-200 rounded-xl text-sm bg-gray-50/50 focus:bg-white focus:outline-none focus:ring-2 focus:ring-blue-500/20 focus:border-blue-500 transition">
</div> </div>
{{-- Dropdowns --}} {{-- Dropdowns: Jurusan → Tingkat Kelas → Kelas --}}
<div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-3"> <div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-3">
<div>
<label class="block text-[11px] font-semibold text-gray-400 uppercase tracking-wider mb-1.5">Jurusan</label>
<select name="department"
class="w-full px-4 py-2.5 border border-gray-200 rounded-xl text-sm bg-gray-50/50 focus:bg-white focus:outline-none focus:ring-2 focus:ring-blue-500/20 focus:border-blue-500 transition">
<option value="">Semua Jurusan</option>
@foreach($departments as $code => $name)
<option value="{{ $code }}" @selected(request('department') == $code)>{{ $name }}</option>
@endforeach
</select>
</div>
<div> <div>
<label class="block text-[11px] font-semibold text-gray-400 uppercase tracking-wider mb-1.5">Tingkat Kelas</label> <label class="block text-[11px] font-semibold text-gray-400 uppercase tracking-wider mb-1.5">Tingkat Kelas</label>
<select name="class_level" <select name="class_level"
@@ -55,16 +65,6 @@
@endforeach @endforeach
</select> </select>
</div> </div>
<div>
<label class="block text-[11px] font-semibold text-gray-400 uppercase tracking-wider mb-1.5">Jurusan</label>
<select name="department"
class="w-full px-4 py-2.5 border border-gray-200 rounded-xl text-sm bg-gray-50/50 focus:bg-white focus:outline-none focus:ring-2 focus:ring-blue-500/20 focus:border-blue-500 transition">
<option value="">Semua Jurusan</option>
@foreach($departments as $code => $name)
<option value="{{ $code }}" @selected(request('department') == $code)>{{ $name }} ({{ $code }})</option>
@endforeach
</select>
</div>
<div class="flex items-end gap-2"> <div class="flex items-end gap-2">
<button type="submit" <button type="submit"
class="flex-1 px-4 py-2.5 text-sm font-medium text-white bg-blue-600 rounded-xl hover:bg-blue-700 transition shadow-sm inline-flex items-center justify-center gap-1.5"> class="flex-1 px-4 py-2.5 text-sm font-medium text-white bg-blue-600 rounded-xl hover:bg-blue-700 transition shadow-sm inline-flex items-center justify-center gap-1.5">