[Superuser] Perbaikan Halaman Akses Superuser

This commit is contained in:
Ariyutta
2026-11-12 12:22:06 +07:00
parent 2b20537fdb
commit eaad95e8f2
45 changed files with 1062 additions and 110 deletions
@@ -34,6 +34,9 @@ class MataKuliahController extends Controller
$programs = $this->overview->programs((int) $request->user()->getKey());
$prodi = $programs->keys()->all();
[$labelTahun, $labelJenis, $labelProdi, $labelKelompok] = $page['filters'];
// Bawaan: tahun periode aktif prodi akun (seperti Kurikulum Prodi); pilihan lain tetap bisa dipilih.
$years = $this->curriculum->years($prodi);
$defaultYear = $this->curriculum->defaultYear($prodi, $years);
return view('operator.satu.remote-list', [
'page' => $page,
@@ -42,7 +45,7 @@ class MataKuliahController extends Controller
'empty' => ['icon' => 'building-library', 'title' => 'Akun belum terhubung ke program studi', 'description' => 'Daftar mata kuliah tampil setelah akun Anda dipetakan ke program studi oleh Pusat Komputer.'],
'url' => route('operator.matakuliah.data'),
'filters' => [
['name' => 'tahun', 'label' => $labelTahun, 'options' => $this->curriculum->years($prodi)->all()],
['name' => 'tahun', 'label' => $labelTahun, 'options' => $years->all(), 'value' => $defaultYear],
['name' => 'tipe', 'label' => $labelJenis, 'options' => Curriculum::TYPES],
['name' => 'prodi', 'label' => $labelProdi, 'options' => $programs->all()],
['name' => 'kelompok', 'label' => $labelKelompok, 'options' => $this->curriculum->groups($prodi)->all()],
@@ -162,8 +165,14 @@ class MataKuliahController extends Controller
/** @param list<int> $prodi */
private function search(Request $request, array $prodi): LengthAwarePaginator
{
// Tahun: tidak dikirim = bawaan (tahun periode aktif); dikirim kosong = dikosongkan pengguna (semua tahun).
$tahun = preg_match('/^\d{4}$/', (string) $request->string('tahun')) ? (string) $request->string('tahun') : null;
if (! $request->has('tahun')) {
$tahun = $this->curriculum->defaultYear($prodi, $this->curriculum->years($prodi));
}
return $this->curriculum->courses($prodi, [
'tahun' => preg_match('/^\d{4}$/', (string) $request->string('tahun')) ? (string) $request->string('tahun') : null,
'tahun' => $tahun,
'tipe' => $request->filled('tipe') && isset(Curriculum::TYPES[$request->integer('tipe')]) ? $request->integer('tipe') : null,
'prodi' => $request->filled('prodi') && in_array($request->integer('prodi'), $prodi, true) ? $request->integer('prodi') : null,
'kelompok' => preg_match('/^[A-Za-z0-9 _-]{1,20}$/', (string) $request->string('kelompok')) ? (string) $request->string('kelompok') : null,