[Operator] Kelengkapan Halaman Dosen
This commit is contained in:
@@ -92,7 +92,7 @@ final class DosenReports implements ReportSource
|
||||
$this->text('pegawai', 'Pegawai', 'NIP, NIDN, atau nama'),
|
||||
$this->check('totalsks', 'Tampilkan Total SKS?', default: true),
|
||||
]],
|
||||
'repp_daftardosen' => ['note' => 'Dosen dengan home base di prodi yang Anda kelola. Golongan ruang tidak punya tabel acuan, jadi yang tampil pangkat.', 'params' => [
|
||||
'repp_daftardosen' => ['note' => 'Dosen dengan home base di prodi yang Anda kelola. Golongan ruang tidak punya tabel acuan, jadi yang tampil pangkat.', 'export' => 'xlsx', 'params' => [
|
||||
$jenisPegawai,
|
||||
$this->select('pangkat', 'Golongan/Pangkat', $this->lookup('t_pangkatdosen', 'idpangkatdosen', 'pangkatdosen')),
|
||||
$this->select('pendidikan', 'Pendidikan Terakhir', $this->lookup('t_tingkat_pendidikan', 'idtingkat', 'tingkatpendidikan')),
|
||||
@@ -109,15 +109,14 @@ final class DosenReports implements ReportSource
|
||||
$aktif,
|
||||
]],
|
||||
// 'detail' => kolom modal Lihat (aksi per baris): identitas, bar kelengkapan, lalu kelompok kolom belum/sudah diisi.
|
||||
'repp_kelengkapanbiodosen' => ['note' => 'Memeriksa kolom biodata t_pegawai: '.implode(', ', self::BIO_FIELDS).'.', 'detail' => [
|
||||
'repp_kelengkapanbiodosen' => ['note' => 'Memeriksa kolom biodata t_pegawai: '.implode(', ', self::BIO_FIELDS).'.', 'export' => 'xlsx', 'detail' => [
|
||||
['key' => 'nip', 'label' => 'NIP'], ['key' => 'nama', 'label' => 'Nama'], ['key' => 'homebase', 'label' => 'Home Base'],
|
||||
['key' => 'persen', 'label' => 'Kelengkapan', 'meter' => true],
|
||||
['key' => 'rincian', 'label' => 'Kolom biodata', 'detail' => 'rincian', 'grouped' => true],
|
||||
], 'params' => [
|
||||
$unit, $aktif, $jenisPegawai,
|
||||
$this->check('kurang', 'Hanya yang belum lengkap?'),
|
||||
]],
|
||||
'repp_rasiodosenins' => ['note' => 'Jumlah dosen mengikuti data saat ini (home base dan status aktif tidak berhistori).', 'params' => [
|
||||
'repp_rasiodosenins' => ['note' => 'Jumlah dosen mengikuti data saat ini (home base dan status aktif tidak berhistori).', 'export' => 'xlsx', 'params' => [
|
||||
$periode(false), $unit,
|
||||
]],
|
||||
'repp_distribusidosenwali' => ['note' => 'Pembimbing akademik (t_mahasiswa.idpa) tidak berhistori, jadi yang dihitung mahasiswa berstatus aktif saat ini.', 'params' => [
|
||||
@@ -529,7 +528,7 @@ final class DosenReports implements ReportSource
|
||||
|
||||
private function biodataCompleteness(array $params, ReportContext $context, int $limit): ReportResult
|
||||
{
|
||||
// Kelengkapan tampil sebagai bar (meter); "Belum Diisi" hanya untuk CSV (hidden), rinciannya di modal Lihat (rincian).
|
||||
// Kelengkapan tampil sebagai bar (meter); "Belum Diisi" hanya untuk unduhan Excel (hidden), rinciannya di modal Lihat (rincian).
|
||||
$columns = [$this->col('nip', 'NIP'), $this->col('nama', 'Nama'), $this->col('homebase', 'Home Base'), $this->col('terisi', 'Terisi', true),
|
||||
$this->col('dari', 'Dari', true), ['key' => 'persen', 'label' => 'Kelengkapan', 'num' => true, 'meter' => true], $this->col('kurang', 'Belum Diisi') + ['hidden' => true]];
|
||||
$prodi = $this->scope($params, $context);
|
||||
@@ -571,10 +570,9 @@ final class DosenReports implements ReportSource
|
||||
});
|
||||
|
||||
$complete = $people->where('kurang', null)->count();
|
||||
$listed = ($params['kurang'] ?? false) ? $people->filter(fn (array $r): bool => $r['kurang'] !== null)->values() : $people->values();
|
||||
$summary = ["Jumlah: {$people->count()} dosen", "Lengkap: {$complete} dosen (".round($complete * 100 / max(1, $people->count()), 1).'%)'];
|
||||
|
||||
return new ReportResult($columns, $listed->take($limit)->all(), $listed->count(), $summary);
|
||||
return new ReportResult($columns, $people->values()->take($limit)->all(), $people->count(), $summary);
|
||||
}
|
||||
|
||||
// ---- Rasio, dosen wali, bimbingan, perwalian -----------------------------------------------------------
|
||||
@@ -630,7 +628,10 @@ final class DosenReports implements ReportSource
|
||||
return $row;
|
||||
})->sortBy('prodi')->values();
|
||||
|
||||
$totals = [];
|
||||
if ($rows->count() > 1) {
|
||||
// Baris terakhir = penjumlahan semua prodi (diberi arsir di tabel dan Excel)
|
||||
$totals = [$rows->count()];
|
||||
$sum = fn (string $key): int => (int) $rows->sum($key);
|
||||
$rows->push(['prodi' => 'Jumlah', 'dosen' => $sum('dosen'), 'tetap' => $sum('tetap'), 'tidaktetap' => $sum('tidaktetap'), 'mahasiswa' => $sum('mahasiswa'),
|
||||
'rasio' => $sum('dosen') > 0 ? round($sum('mahasiswa') / $sum('dosen'), 1) : null] + ($periode !== null ? ['mengajar' => $sum('mengajar')] : []));
|
||||
@@ -638,7 +639,7 @@ final class DosenReports implements ReportSource
|
||||
|
||||
$summary = [$periode === null ? 'Mahasiswa aktif: status mahasiswa saat ini' : 'Periode: '.$this->periodLabel($periode).' (mahasiswa berstatus aktif pada periode itu)'];
|
||||
|
||||
return new ReportResult($columns, $rows->all(), null, $summary, 'Dosen yang dihitung: home base di prodi dan berstatus aktif. Rasio = mahasiswa aktif dibagi jumlah dosen.');
|
||||
return new ReportResult($columns, $rows->all(), null, $summary, 'Dosen yang dihitung: home base di prodi dan berstatus aktif. Rasio = mahasiswa aktif dibagi jumlah dosen.', $totals);
|
||||
}
|
||||
|
||||
private function advisorDistribution(array $params, ReportContext $context, int $limit): ReportResult
|
||||
|
||||
@@ -645,9 +645,10 @@ final class MahasiswaReports implements ReportSource
|
||||
|
||||
[$columns, $rows] = $this->pivot($found, $this->academicStatuses(), 'prodi', 'Program Studi');
|
||||
|
||||
// Baris terakhir pivot = "Jumlah" (baris penjumlahan)
|
||||
return new ReportResult($columns, array_slice($rows, 0, $limit), count($rows), [
|
||||
$this->prodiSummary($prodi, $c), 'Periode: '.LegacyFormat::periodLabel($period->thakad, $period->semester, $period->perkuliahan),
|
||||
]);
|
||||
], totals: $rows === [] ? [] : [count($rows) - 1]);
|
||||
}
|
||||
|
||||
private function cohortStatusRecap(array $p, ReportContext $c, int $limit): ReportResult
|
||||
@@ -673,7 +674,7 @@ final class MahasiswaReports implements ReportSource
|
||||
|
||||
return new ReportResult($columns, array_slice($rows, 0, $limit), count($rows), [
|
||||
$this->prodiSummary($prodi, $c), 'Angkatan: '.$from.' sampai '.$to,
|
||||
], 'Status mahasiswa saat ini per angkatan (bukan status pada satu periode tertentu).');
|
||||
], 'Status mahasiswa saat ini per angkatan (bukan status pada satu periode tertentu).', $rows === [] ? [] : [count($rows) - 1]);
|
||||
}
|
||||
|
||||
// Definisi --------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -5,11 +5,15 @@ namespace App\Support\Legacy\Reports;
|
||||
/** Hasil satu laporan: kolom, baris (nilai skalar), keterangan di atas tabel, dan jumlah baris sebenarnya. */
|
||||
final readonly class ReportResult
|
||||
{
|
||||
/** Penanda baris penjumlahan pada baris hasil markedRows(); bukan kolom, jadi tidak ikut diunduh atau dicari. */
|
||||
public const string TOTAL_KEY = '_total';
|
||||
|
||||
/**
|
||||
* @param list<array{key: string, label: string, num?: bool}> $columns
|
||||
* @param list<array<string, scalar|null>> $rows kunci = 'key' kolom
|
||||
* @param int|null $total jumlah baris sebenarnya (bila lebih banyak dari $rows)
|
||||
* @param list<string> $summary baris keterangan (mis. "Periode: 2020/2021 Ganjil", "Jumlah: 120 mahasiswa")
|
||||
* @param list<int> $totals indeks $rows yang merupakan baris penjumlahan (mis. "Jumlah" di akhir): diberi arsir di tabel, cetak, dan Excel
|
||||
*/
|
||||
public function __construct(
|
||||
public array $columns,
|
||||
@@ -17,8 +21,26 @@ final readonly class ReportResult
|
||||
public ?int $total = null,
|
||||
public array $summary = [],
|
||||
public ?string $note = null,
|
||||
public array $totals = [],
|
||||
) {}
|
||||
|
||||
/**
|
||||
* Baris hasil dengan penanda TOTAL_KEY pada baris penjumlahan, supaya penandanya ikut saat baris dipotong per halaman atau disaring.
|
||||
*
|
||||
* @return list<array<string, mixed>>
|
||||
*/
|
||||
public function markedRows(): array
|
||||
{
|
||||
$rows = $this->rows;
|
||||
foreach ($this->totals as $index) {
|
||||
if (isset($rows[$index])) {
|
||||
$rows[$index][self::TOTAL_KEY] = true;
|
||||
}
|
||||
}
|
||||
|
||||
return $rows;
|
||||
}
|
||||
|
||||
public function count(): int
|
||||
{
|
||||
return $this->total ?? count($this->rows);
|
||||
|
||||
Reference in New Issue
Block a user