Manajemen Kurikulum > Mata Kuliah (slug list_matakuliah) untuk akun DB lama: t_matakuliah prodi akun, hanya baca. */ class MataKuliahController extends Controller { use ServesLegacyList; private const string SLUG = 'list_matakuliah'; public function __construct( private readonly AcademicOverview $overview, private readonly Curriculum $curriculum, ) {} public function __invoke(Request $request): View { $page = Catalog::page(self::SLUG); $programs = $this->overview->programs((int) $request->user()->getKey()); $prodi = $programs->keys()->all(); [$labelTahun, $labelJenis, $labelProdi, $labelKelompok] = $page['filters']; return view('operator.satu.remote-list', [ 'page' => $page, 'crumbs' => $this->crumbs(self::SLUG, $page), 'note' => 'Mata kuliah asli kurikulum program studi yang Anda kelola. Status pengisian RPS/CPL/CPMK tidak tercatat di sumber data; tombol tambah, ubah, dan hapus belum mengubah data.', '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' => 'tipe', 'label' => $labelJenis, 'options' => Curriculum::TYPES], ['name' => 'prodi', 'label' => $labelProdi, 'options' => $programs->all()], ['name' => 'kelompok', 'label' => $labelKelompok, 'options' => $this->curriculum->groups($prodi)->all()], ], 'columns' => [ ['key' => 'kurikulum', 'label' => 'Kurikulum'], ['key' => 'kode', 'label' => 'Kode MK'], ['key' => 'nama', 'label' => 'Nama Mata Kuliah'], ['key' => 'sks', 'label' => 'SKS', 'num' => true], ['key' => 'jenis', 'label' => 'Jenis MK'], ['key' => 'prodi', 'label' => 'Prodi Pengampu'], ['key' => 'status', 'label' => 'Status Pengisian'], ], 'perPage' => Curriculum::PER_PAGE, 'data' => $prodi === [] ? null : $this->payload($this->search($request, $prodi)), ]); } public function data(Request $request): JsonResponse { $this->legacyOnly($request); $prodi = $this->overview->programs((int) $request->user()->getKey())->keys()->all(); abort_if($prodi === [], 404); return response()->json($this->payload($this->search($request, $prodi))); } /** @param list $prodi */ private function search(Request $request, array $prodi): LengthAwarePaginator { return $this->curriculum->courses($prodi, [ 'tahun' => preg_match('/^\d{4}$/', (string) $request->string('tahun')) ? (string) $request->string('tahun') : null, '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, 'q' => $this->query($request), ], $this->perPage($request, Curriculum::PER_PAGE)); } }