[Superuser] Perbaikan Halaman Akses Superuser
This commit is contained in:
@@ -41,6 +41,27 @@ final class Curriculum
|
||||
->pluck('tahun')->mapWithKeys(fn (string $y): array => [$y => $y]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tahun kurikulum bawaan: tahun periode aktif prodi akun (t_periodekuliahaktif terbaru) bila ada kurikulum di tahun
|
||||
* itu, kalau tidak tahun kurikulum terbaru; null bila belum ada kurikulum.
|
||||
*
|
||||
* @param list<int> $prodi
|
||||
* @param Collection<string, string> $years hasil years()
|
||||
*/
|
||||
public function defaultYear(array $prodi, Collection $years): ?string
|
||||
{
|
||||
if ($years->isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$active = $prodi === [] ? null : $this->db()->table('t_periodekuliahaktif as a')
|
||||
->join('t_periodekuliah as p', 'p.idperiode', '=', 'a.idperiode')
|
||||
->whereIn('a.idprogdi', $prodi)->orderByDesc('a.idperiode')->value('p.thakad');
|
||||
$year = $active === null ? null : substr(trim((string) $active), 0, 4);
|
||||
|
||||
return $year !== null && $years->has($year) ? $year : (string) $years->keys()->first();
|
||||
}
|
||||
|
||||
/**
|
||||
* Kurikulum prodi akun untuk pilihan filter, terbaru dulu.
|
||||
*
|
||||
@@ -289,8 +310,10 @@ final class Curriculum
|
||||
$members = $this->db()->table('t_matakuliah')
|
||||
->whereIn('idpeminatan', collect($groups->items())->pluck('idkonsentrasi')->all())
|
||||
->orderBy('semester')->orderBy('kodemk')
|
||||
->get(['idmatakuliah', 'idpeminatan', 'kodemk', 'namamk'])
|
||||
->get(['idmatakuliah', 'idpeminatan', 'kodemk', 'namamk', 'sks', 'semester'])
|
||||
->groupBy('idpeminatan');
|
||||
// Rincian anggota untuk modal Lihat: "KODE - Nama (n SKS, semester m)"; semester 0 = belum ditentukan.
|
||||
$detail = fn (object $m): string => trim($m->kodemk).' - '.trim($m->namamk).' ('.(int) $m->sks.' SKS'.((int) $m->semester > 0 ? ', semester '.(int) $m->semester : '').')';
|
||||
|
||||
return $groups->through(fn (object $g): array => [
|
||||
'id' => (int) $g->idkonsentrasi,
|
||||
@@ -302,6 +325,7 @@ final class Curriculum
|
||||
'kurikulum' => trim(self::year($g->thakad).' – '.trim((string) $g->namakurikulum), ' –'),
|
||||
'mk' => ($members[(int) $g->idkonsentrasi] ?? collect())->map(fn (object $m): string => trim($m->kodemk).' - '.trim($m->namamk))->implode(', ') ?: '–',
|
||||
'jumlah' => ($members[(int) $g->idkonsentrasi] ?? collect())->count(),
|
||||
'anggota' => ($members[(int) $g->idkonsentrasi] ?? collect())->map($detail)->values()->all(),
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user