[Operator] Perbaikan Halaman Pegawai dan Export Excel
This commit is contained in:
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exports;
|
||||
|
||||
use Maatwebsite\Excel\Concerns\FromArray;
|
||||
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
|
||||
use Maatwebsite\Excel\Concerns\WithCustomValueBinder;
|
||||
use Maatwebsite\Excel\Concerns\WithFreezePane;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
use Maatwebsite\Excel\Concerns\WithStrictNullComparison;
|
||||
use Maatwebsite\Excel\Concerns\WithStyles;
|
||||
use Maatwebsite\Excel\Concerns\WithTitle;
|
||||
use Maatwebsite\Excel\DefaultValueBinder;
|
||||
use Override;
|
||||
use PhpOffice\PhpSpreadsheet\Cell\Cell;
|
||||
use PhpOffice\PhpSpreadsheet\Cell\DataType;
|
||||
use PhpOffice\PhpSpreadsheet\Shared\StringHelper;
|
||||
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
|
||||
|
||||
/**
|
||||
* Hasil laporan operator (kolom + baris ReportResult) sebagai satu lembar Excel: baris kepala tebal dan dibekukan,
|
||||
* lebar kolom mengikuti isi. Teks ditulis apa adanya agar NIP/NIDN panjang dan nol di depan tidak diubah Excel.
|
||||
*/
|
||||
final class ReportExport extends DefaultValueBinder implements FromArray, ShouldAutoSize, WithCustomValueBinder, WithFreezePane, WithHeadings, WithStrictNullComparison, WithStyles, WithTitle
|
||||
{
|
||||
/** Batas Excel untuk nama lembar. */
|
||||
private const int TITLE_MAX = 31;
|
||||
|
||||
/**
|
||||
* @param list<array{key: string, label: string, num?: bool}> $columns
|
||||
* @param list<array<string, mixed>> $rows
|
||||
*/
|
||||
public function __construct(private readonly string $title, private readonly array $columns, private readonly array $rows) {}
|
||||
|
||||
public function headings(): array
|
||||
{
|
||||
return array_column($this->columns, 'label');
|
||||
}
|
||||
|
||||
/** Nilai tiap baris menurut urutan kolom; kosong dan nilai bukan skalar menjadi sel kosong (0 tetap ditulis). */
|
||||
public function array(): array
|
||||
{
|
||||
return array_map(fn (array $row): array => array_map(function (array $column) use ($row): mixed {
|
||||
$value = $row[$column['key']] ?? null;
|
||||
|
||||
return is_scalar($value) && $value !== '' ? $value : null;
|
||||
}, $this->columns), $this->rows);
|
||||
}
|
||||
|
||||
/** Nama lembar yang diterima Excel: tanpa [ ] : * ? / \ dan paling banyak 31 karakter. */
|
||||
public function title(): string
|
||||
{
|
||||
$title = trim(mb_substr(preg_replace('/[\[\]:*?\/\\\\]+/u', ' ', $this->title) ?? '', 0, self::TITLE_MAX), " '");
|
||||
|
||||
return $title === '' ? 'Data' : $title;
|
||||
}
|
||||
|
||||
public function freezePane(): string
|
||||
{
|
||||
return 'A2';
|
||||
}
|
||||
|
||||
public function styles(Worksheet $sheet): array
|
||||
{
|
||||
return [1 => ['font' => ['bold' => true]]];
|
||||
}
|
||||
|
||||
/** Teks tetap teks: tidak ditebak sebagai angka (NIP 18 digit, nol di depan) maupun rumus (awalan "="). */
|
||||
#[Override]
|
||||
public function bindValue(Cell $cell, mixed $value): bool
|
||||
{
|
||||
if (is_string($value)) {
|
||||
$cell->setValueExplicit(StringHelper::sanitizeUTF8($value), DataType::TYPE_STRING);
|
||||
// Tanpa segitiga peringatan "angka disimpan sebagai teks" di Excel
|
||||
$cell->getIgnoredErrors()->setNumberStoredAsText(is_numeric($value));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return parent::bindValue($cell, $value);
|
||||
}
|
||||
}
|
||||
@@ -57,11 +57,8 @@ class EmployeeListController extends Controller
|
||||
'columns' => [
|
||||
['key' => 'nip', 'label' => 'NIP'],
|
||||
['key' => 'nama', 'label' => 'Nama'],
|
||||
['key' => 'kelamin', 'label' => 'L/P'],
|
||||
['key' => 'nidn', 'label' => 'NIDN'],
|
||||
['key' => 'nuptk', 'label' => 'NUPTK'],
|
||||
['key' => 'telepon', 'label' => 'No. Telp.'],
|
||||
['key' => 'email', 'label' => 'Email'],
|
||||
['key' => 'status', 'label' => 'Status', 'badge' => true],
|
||||
],
|
||||
'perPage' => EmployeeDirectory::PER_PAGE,
|
||||
@@ -218,11 +215,8 @@ class EmployeeListController extends Controller
|
||||
'id' => $p['id'],
|
||||
'nip' => $dash($p['nip']),
|
||||
'nama' => $p['nama'],
|
||||
'kelamin' => $dash($p['kelamin']),
|
||||
'nidn' => $dash($p['nidn']),
|
||||
'nuptk' => '–',
|
||||
'telepon' => $dash($p['telepon']),
|
||||
'email' => $dash($p['email']),
|
||||
'status' => $p['status']['label'],
|
||||
'tone' => $p['status']['tone'] === 'neutral' ? null : $p['status']['tone'],
|
||||
])->all(),
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Http\Controllers\Operator;
|
||||
|
||||
use App\Exports\ReportExport;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Legacy\Account;
|
||||
use App\Support\Legacy\AcademicOverview;
|
||||
@@ -15,11 +16,14 @@ use Illuminate\Contracts\View\View;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Maatwebsite\Excel\Excel as ExcelWriter;
|
||||
use Maatwebsite\Excel\Facades\Excel;
|
||||
use Symfony\Component\HttpFoundation\BinaryFileResponse;
|
||||
use Symfony\Component\HttpFoundation\StreamedResponse;
|
||||
|
||||
/**
|
||||
* Menu Laporan operator untuk akun DB lama: formulir parameter yang menjalankan laporan otomatis lewat JSON
|
||||
* (tabel berhalaman), unduh CSV, dan halaman cetak. Hanya baca. Sumber laporan (ReportSource) hanya mengenal
|
||||
* (tabel berhalaman), unduh CSV (atau Excel lewat maatwebsite/excel bila definisi laporan memuat 'export' => 'xlsx'), dan halaman cetak. Hanya baca. Sumber laporan (ReportSource) hanya mengenal
|
||||
* limit, jadi halaman N diambil dengan limit N × per halaman lalu dipotong (dibatasi CAP baris pertama).
|
||||
*/
|
||||
class LaporanController extends Controller
|
||||
@@ -34,6 +38,8 @@ class LaporanController extends Controller
|
||||
|
||||
private const int DOWNLOAD = 50000;
|
||||
|
||||
private const string XLSX_MIME = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';
|
||||
|
||||
public function __construct(private readonly AcademicOverview $overview) {}
|
||||
|
||||
public function __invoke(Request $request, string $slug): View
|
||||
@@ -52,6 +58,7 @@ class LaporanController extends Controller
|
||||
'slug' => $slug,
|
||||
'definition' => $definition,
|
||||
'values' => $values,
|
||||
'downloadLabel' => self::downloadLabel($definition),
|
||||
'config' => [
|
||||
'url' => route('operator.laporan.data', $slug),
|
||||
'downloadUrl' => route('operator.laporan.unduh', $slug),
|
||||
@@ -74,18 +81,7 @@ class LaporanController extends Controller
|
||||
}
|
||||
|
||||
$list = (bool) ($definition['list'] ?? true);
|
||||
$raw = $request->input('q');
|
||||
$q = is_string($raw) ? mb_substr(trim($raw), 0, 100) : '';
|
||||
$filterQ = null;
|
||||
if ($list && $q !== '') {
|
||||
if ($definition['search'] ?? false) {
|
||||
// Sumber mengenal kata cari: diteruskan sebagai parameter q.
|
||||
$values['q'] = $q;
|
||||
} elseif (! self::hasParam($definition, 'q')) {
|
||||
// Sumber tidak mengenal kata cari: hasil disaring di sini atas semua kolom (sampai batas CAP baris).
|
||||
$filterQ = $q;
|
||||
}
|
||||
}
|
||||
$filterQ = $this->searchTerm($request, $definition, $values);
|
||||
$per = in_array($request->integer('per'), self::PER_PAGE, true) ? $request->integer('per') : self::PER_PAGE[1];
|
||||
|
||||
try {
|
||||
@@ -95,6 +91,52 @@ class LaporanController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Kata cari dari kotak cari daftar. Sumber yang mengenal kata cari menerimanya sebagai parameter q ($values diisi);
|
||||
* selain itu kata cari dikembalikan untuk saringan generik atas semua kolom hasil. Null bila tidak ada yang perlu
|
||||
* disaring di sini (tanpa kata cari, bukan daftar, atau laporan punya parameter q sendiri).
|
||||
*
|
||||
* @param array<string, mixed> $definition
|
||||
* @param array<string, mixed> $values
|
||||
*/
|
||||
private function searchTerm(Request $request, array $definition, array &$values): ?string
|
||||
{
|
||||
$raw = $request->input('q');
|
||||
$q = is_string($raw) ? mb_substr(trim($raw), 0, 100) : '';
|
||||
if ($q === '' || ! ($definition['list'] ?? true)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if ($definition['search'] ?? false) {
|
||||
$values['q'] = $q;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
return self::hasParam($definition, 'q') ? null : $q;
|
||||
}
|
||||
|
||||
/**
|
||||
* Baris yang salah satu kolomnya memuat kata cari (tanpa membedakan huruf besar/kecil).
|
||||
*
|
||||
* @param list<array<string, mixed>> $rows
|
||||
* @return list<array<string, mixed>>
|
||||
*/
|
||||
private static function matching(array $rows, string $q): array
|
||||
{
|
||||
$needle = mb_strtolower($q);
|
||||
|
||||
return array_values(array_filter($rows, function (array $row) use ($needle): bool {
|
||||
foreach ($row as $value) {
|
||||
if (is_scalar($value) && str_contains(mb_strtolower((string) $value), $needle)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}));
|
||||
}
|
||||
|
||||
/** Laporan punya parameter bernama {name}? */
|
||||
private static function hasParam(array $definition, string $name): bool
|
||||
{
|
||||
@@ -115,16 +157,7 @@ class LaporanController extends Controller
|
||||
if ($filterQ !== null) {
|
||||
// Kata cari generik: ambil sampai batas CAP lalu saring baris yang salah satu kolomnya memuat kata itu.
|
||||
$result = $source->run($slug, $values, $context, self::CAP + 1);
|
||||
$needle = mb_strtolower($filterQ);
|
||||
$rows = array_values(array_filter($result->rows, function (array $row) use ($needle): bool {
|
||||
foreach ($row as $value) {
|
||||
if (is_scalar($value) && str_contains(mb_strtolower((string) $value), $needle)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}));
|
||||
$rows = self::matching($result->rows, $filterQ);
|
||||
$result = new ReportResult($result->columns, $rows, count($rows), $result->summary, $result->note);
|
||||
} else {
|
||||
// +1 agar terlihat bila masih ada baris sesudah halaman ini saat sumber tidak mengisi total
|
||||
@@ -216,34 +249,56 @@ class LaporanController extends Controller
|
||||
// Kotak cari: ke sumber bila mengenal q, selain itu saringan generik atas kolom hasil; disembunyikan hanya bila laporan
|
||||
// punya parameter lain bernama q.
|
||||
'searchable' => (bool) ($definition['search'] ?? false) || ! self::hasParam($definition, 'q'),
|
||||
'barLinks' => [['label' => 'Unduh (CSV)', 'href' => route('operator.laporan.unduh', $slug), 'icon' => 'arrow-down-tray', 'withFilters' => true]],
|
||||
'barLinks' => [['label' => self::downloadLabel($definition), 'href' => route('operator.laporan.unduh', $slug), 'icon' => 'arrow-down-tray', 'withFilters' => true]],
|
||||
'data' => $data,
|
||||
]);
|
||||
}
|
||||
|
||||
public function download(Request $request, string $slug): StreamedResponse|RedirectResponse
|
||||
/** Format unduhan laporan: 'xlsx' bila definisinya meminta ('export' => 'xlsx'), selain itu CSV. */
|
||||
private static function exportFormat(array $definition): string
|
||||
{
|
||||
[$source, $context, , $definition] = $this->prepare($request, $slug);
|
||||
return ($definition['export'] ?? 'csv') === 'xlsx' ? 'xlsx' : 'csv';
|
||||
}
|
||||
|
||||
/** Label tombol unduh menurut format. */
|
||||
private static function downloadLabel(array $definition): string
|
||||
{
|
||||
return self::exportFormat($definition) === 'xlsx' ? 'Unduh (Excel)' : 'Unduh (CSV)';
|
||||
}
|
||||
|
||||
public function download(Request $request, string $slug): StreamedResponse|BinaryFileResponse|RedirectResponse
|
||||
{
|
||||
[$source, $context, $page, $definition] = $this->prepare($request, $slug);
|
||||
[$values, $errors] = $this->parse($request, $definition['params'], true);
|
||||
if ($errors !== []) {
|
||||
return redirect()->route('operator.halaman', [$slug] + $this->queryString($request));
|
||||
}
|
||||
|
||||
// Kata cari di kotak cari ikut berlaku, agar unduhan sama dengan yang tampil di tabel.
|
||||
$filterQ = $this->searchTerm($request, $definition, $values);
|
||||
|
||||
try {
|
||||
$result = $source->run($slug, $values, $context, self::DOWNLOAD);
|
||||
} catch (PortalException $e) {
|
||||
return redirect()->route('operator.halaman', [$slug] + $this->queryString($request));
|
||||
}
|
||||
|
||||
return response()->streamDownload(function () use ($result): void {
|
||||
$rows = $filterQ === null ? $result->rows : self::matching($result->rows, $filterQ);
|
||||
$name = $slug.'-'.now()->format('Ymd-His');
|
||||
|
||||
if (self::exportFormat($definition) === 'xlsx') {
|
||||
return Excel::download(new ReportExport($page['title'], $result->columns, $rows), $name.'.xlsx', ExcelWriter::XLSX, ['Content-Type' => self::XLSX_MIME]);
|
||||
}
|
||||
|
||||
return response()->streamDownload(function () use ($result, $rows): void {
|
||||
$out = fopen('php://output', 'w');
|
||||
fwrite($out, "\xEF\xBB\xBF"); // BOM agar Excel membaca UTF-8
|
||||
fputcsv($out, array_column($result->columns, 'label'), ',', '"', '\\');
|
||||
foreach ($result->rows as $row) {
|
||||
foreach ($rows as $row) {
|
||||
fputcsv($out, array_map(fn (array $c): mixed => $row[$c['key']] ?? '', $result->columns), ',', '"', '\\');
|
||||
}
|
||||
fclose($out);
|
||||
}, $slug.'-'.now()->format('Ymd-His').'.csv', ['Content-Type' => 'text/csv; charset=UTF-8']);
|
||||
}, $name.'.csv', ['Content-Type' => 'text/csv; charset=UTF-8']);
|
||||
}
|
||||
|
||||
public function print(Request $request, string $slug): View|RedirectResponse
|
||||
@@ -264,6 +319,7 @@ class LaporanController extends Controller
|
||||
'title' => $page['title'],
|
||||
'result' => $result,
|
||||
'kop' => (bool) ($values['kop'] ?? true),
|
||||
'downloadLabel' => self::downloadLabel($definition),
|
||||
'parameters' => $this->describe($definition['params'], $values),
|
||||
'operator' => $request->user()->username,
|
||||
]);
|
||||
|
||||
@@ -57,16 +57,22 @@ final class ReferenceCrud implements ReferenceWriter
|
||||
}
|
||||
|
||||
return $field;
|
||||
}, $spec['fields']),
|
||||
}, self::shown($spec['fields'])),
|
||||
];
|
||||
}
|
||||
|
||||
/** Isian yang tampil di formulir: tanpa isian yang nilainya sudah pasti (fixed). */
|
||||
private static function shown(array $fields): array
|
||||
{
|
||||
return array_values(array_filter($fields, fn (array $f): bool => ! array_key_exists('fixed', $f)));
|
||||
}
|
||||
|
||||
public function rules(string $slug): array
|
||||
{
|
||||
$rules = [];
|
||||
$attributes = [];
|
||||
|
||||
foreach ($this->spec($slug)['fields'] as $f) {
|
||||
foreach (self::shown($this->spec($slug)['fields']) as $f) {
|
||||
$rule = [($f['required'] ?? false) ? 'required' : 'nullable'];
|
||||
$rule[] = match ($f['type']) {
|
||||
'number' => 'numeric',
|
||||
@@ -99,7 +105,7 @@ final class ReferenceCrud implements ReferenceWriter
|
||||
|
||||
foreach ($this->db()->table($spec['table'])->whereIn($spec['pk'], array_map('intval', $ids))->get($columns) as $row) {
|
||||
$values = [];
|
||||
foreach ($spec['fields'] as $f) {
|
||||
foreach (self::shown($spec['fields']) as $f) {
|
||||
$value = $row->{$f['column']} ?? null;
|
||||
$value = isset($f['fromDb']) && $value !== null ? ($f['fromDb'])($value) : $value;
|
||||
$value = $f['type'] === 'select' && $value !== null ? (string) $value : $value;
|
||||
@@ -199,6 +205,16 @@ final class ReferenceCrud implements ReferenceWriter
|
||||
$byName = [];
|
||||
|
||||
foreach ($spec['fields'] as $f) {
|
||||
// Isian tersembunyi (unit akun): diisi otomatis saat tambah; saat ubah kolomnya tidak disentuh.
|
||||
if (array_key_exists('fixed', $f)) {
|
||||
$byName[$f['name']] = $current === null ? $f['fixed'] : ($current->{$f['column']} ?? null);
|
||||
if ($current === null) {
|
||||
$values[$f['column']] = $f['fixed'];
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
$value = $this->clean($f, $input[$f['name']] ?? null, $current);
|
||||
$byName[$f['name']] = $value;
|
||||
$values[$f['column']] = (isset($f['toDb']) ? ($f['toDb'])($value) : $value) ?? ($f['nullAs'] ?? null);
|
||||
@@ -469,6 +485,10 @@ final class ReferenceCrud implements ReferenceWriter
|
||||
if (isset(self::EXAMPLES[$slug][$f['name']]) && ! isset($f['placeholder'])) {
|
||||
$spec['fields'][$i]['placeholder'] = 'Contoh: '.self::EXAMPLES[$slug][$f['name']];
|
||||
}
|
||||
// Akun yang dibatasi ke satu fakultas: unit pemilik sudah pasti, jadi isiannya disembunyikan dan diisi otomatis.
|
||||
if (($f['ownUnit'] ?? false) && $this->scope !== null && count($options = $this->options($f)) === 1) {
|
||||
$spec['fields'][$i]['fixed'] = array_key_first($options);
|
||||
}
|
||||
}
|
||||
|
||||
return $spec;
|
||||
@@ -484,7 +504,7 @@ final class ReferenceCrud implements ReferenceWriter
|
||||
'table' => 't_gedung', 'pk' => 'idgedung', 'title' => 'gedung', 'audit' => self::AUDIT,
|
||||
'fields' => [
|
||||
self::text('nama', 'namagedung', 'Nama gedung', 50),
|
||||
self::choice('unit', 'idbagian', 'Lokasi kampus (unit pemilik)', fn (): array => $this->units(), ['hint' => 'Boleh dikosongkan.']),
|
||||
self::choice('unit', 'idbagian', 'Lokasi kampus (unit pemilik)', fn (): array => $this->units(), ['hint' => 'Boleh dikosongkan.', 'ownUnit' => true]),
|
||||
],
|
||||
'delete' => [['t_ruang', 'idgedung']],
|
||||
],
|
||||
@@ -496,7 +516,7 @@ final class ReferenceCrud implements ReferenceWriter
|
||||
self::number('lantai', 'lantai', 'Lantai', ['required' => true, 'default' => 1, 'max' => 99]),
|
||||
self::number('kapasitas', 'kapasitaskuliah', 'Kapasitas kuliah', ['required' => true, 'default' => 0]),
|
||||
self::number('kapasitas_ujian', 'kapasitasujian', 'Kapasitas ujian', ['default' => 0, 'nullAs' => 0, 'hint' => 'Boleh dikosongkan.']),
|
||||
self::choice('unit', 'idbagian', 'Unit pemilik ruang', fn (): array => $this->units(), ['hint' => 'Kosong = mengikuti unit gedung.']),
|
||||
self::choice('unit', 'idbagian', 'Unit pemilik ruang', fn (): array => $this->units(), ['hint' => 'Kosong = mengikuti unit gedung.', 'ownUnit' => true]),
|
||||
],
|
||||
'delete' => [['t_jadwalruangkuliah', 'idruang'], ['t_jadwalruangujian', 'idruang']],
|
||||
],
|
||||
|
||||
@@ -92,12 +92,15 @@ final class ReferenceData
|
||||
public function definition(string $slug): array
|
||||
{
|
||||
$spec = $this->spec($slug);
|
||||
$filters = array_map(fn (array $f): array => ['name' => $f['name'], 'label' => $f['label'], 'options' => ($f['options'])(), 'unit' => $f['unit'] ?? false], $spec['filters'] ?? []);
|
||||
// Akun yang dibatasi unit: filter unit dengan paling banyak satu pilihan tidak berguna (unitnya sudah pasti), jadi disembunyikan.
|
||||
$filters = array_filter($filters, fn (array $f): bool => ! ($this->scope !== null && $f['unit'] && count($f['options']) <= 1));
|
||||
|
||||
return [
|
||||
'note' => $spec['note'],
|
||||
'columns' => $spec['columns'],
|
||||
'detailColumns' => $spec['detailColumns'] ?? $spec['columns'],
|
||||
'filters' => array_map(fn (array $f): array => ['name' => $f['name'], 'label' => $f['label'], 'options' => ($f['options'])()], $spec['filters'] ?? []),
|
||||
'filters' => array_values(array_map(fn (array $f): array => ['name' => $f['name'], 'label' => $f['label'], 'options' => $f['options']], $filters)),
|
||||
];
|
||||
}
|
||||
|
||||
@@ -165,13 +168,13 @@ final class ReferenceData
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array{note: string, columns: list<array<string, mixed>>, filters?: list<array{name: string, label: string, options: callable}>, query: callable, search?: list<string>, row?: callable}
|
||||
* @return array{note: string, columns: list<array<string, mixed>>, filters?: list<array{name: string, label: string, options: callable, unit?: bool}>, query: callable, search?: list<string>, row?: callable}
|
||||
*/
|
||||
private function spec(string $slug): array
|
||||
{
|
||||
$db = $this->db();
|
||||
$col = fn (string $key, string $label, bool $num = false): array => ['key' => $key, 'label' => $label, 'num' => $num];
|
||||
$unitFilter = fn (string $name, string $label): array => ['name' => $name, 'label' => $label, 'options' => fn (): array => $this->faculties()];
|
||||
$unitFilter = fn (string $name, string $label): array => ['name' => $name, 'label' => $label, 'unit' => true, 'options' => fn (): array => $this->faculties()];
|
||||
$activeStatus = fn (?bool $active): string => $active ? 'Aktif' : 'Tidak aktif';
|
||||
|
||||
return match ($slug) {
|
||||
@@ -247,7 +250,7 @@ final class ReferenceData
|
||||
'ms_ruang' => [
|
||||
'note' => 'Ruang asli dari t_ruang beserta gedung dan unit pemiliknya (ruang atau gedungnya). Status aktif tidak tercatat.',
|
||||
'columns' => [$col('kode', 'Kode'), $col('nama', 'Nama Ruang'), $col('unit', 'Unit'), $col('lokasi', 'Lokasi'), $col('kap', 'Kap.', true), $col('aktif', 'Aktif')],
|
||||
'filters' => [['name' => 'unit', 'label' => 'Unit', 'options' => fn (): array => $this->roomUnits()]],
|
||||
'filters' => [['name' => 'unit', 'label' => 'Unit', 'unit' => true, 'options' => fn (): array => $this->roomUnits()]],
|
||||
'query' => fn (array $f): Builder => $db->table('t_ruang as r')
|
||||
->leftJoin('t_gedung as g', 'g.idgedung', '=', 'r.idgedung')
|
||||
->leftJoin('t_bagian as rb', 'rb.idbagian', '=', 'r.idbagian')
|
||||
@@ -299,7 +302,7 @@ final class ReferenceData
|
||||
'list_gedung' => [
|
||||
'note' => 'Gedung asli dari t_gedung; lokasi = unit pemilik gedung, jumlah lantai dan ruang dihitung dari t_ruang. Telepon tidak tercatat.',
|
||||
'columns' => [$col('kode', 'Kode'), $col('nama', 'Nama'), $col('lokasi', 'Lokasi Kampus'), $col('telepon', 'Telepon'), $col('lantai', 'Jml. Lantai', true), $col('ruang', 'Jml. Ruang', true)],
|
||||
'filters' => [['name' => 'lokasi', 'label' => 'Lokasi Kampus', 'options' => fn (): array => $this->buildingUnits()]],
|
||||
'filters' => [['name' => 'lokasi', 'label' => 'Lokasi Kampus', 'unit' => true, 'options' => fn (): array => $this->buildingUnits()]],
|
||||
'query' => fn (array $f): Builder => $db->table('t_gedung as g')
|
||||
->leftJoin('t_bagian as b', 'b.idbagian', '=', 'g.idbagian')
|
||||
->leftJoinSub($db->table('t_ruang')->selectRaw('idgedung, count(*) as jml_ruang, max(lantai) as jml_lantai')->whereNotNull('idgedung')->groupBy('idgedung'), 'r', 'r.idgedung', '=', 'g.idgedung')
|
||||
|
||||
@@ -101,8 +101,8 @@ final class DosenReports implements ReportSource
|
||||
$aktif,
|
||||
$this->check('homebase', 'Tampilkan Home Base?', default: true),
|
||||
]],
|
||||
// 'search' => sumber mengenal kata cari (q) dari kotak cari daftar: NIP, NIDN, nama.
|
||||
'repp_daftarpeg' => ['note' => 'Dosen dengan home base di prodi Anda dan pegawai yang memegang jabatan aktif di prodi atau fakultas Anda.', 'search' => true, 'params' => [
|
||||
// 'search' => sumber mengenal kata cari (q) dari kotak cari daftar: NIP, NIDN, nama. 'export' => unduhan berupa Excel, bukan CSV.
|
||||
'repp_daftarpeg' => ['note' => 'Dosen dengan home base di prodi Anda dan pegawai yang memegang jabatan aktif di prodi atau fakultas Anda.', 'search' => true, 'export' => 'xlsx', 'params' => [
|
||||
$this->select('homebase', 'Home Base', $context->prodiNames),
|
||||
$jenisPegawai,
|
||||
$this->select('kelamin', 'Jenis Kelamin', [1 => 'Laki-laki', 2 => 'Perempuan']),
|
||||
|
||||
@@ -14,9 +14,11 @@ interface ReportSource
|
||||
/**
|
||||
* Definisi parameter formulir laporan. Parameter "kop" (Gunakan KOP) ditambahkan otomatis oleh pengendali.
|
||||
* Nama parameter tidak boleh "tampil" atau "kop". Nilai select dicocokkan ke kunci 'options' oleh pengendali.
|
||||
* 'export' => 'xlsx' membuat unduhan laporan berupa Excel; tanpa itu CSV.
|
||||
*
|
||||
* @return array{
|
||||
* note?: string,
|
||||
* export?: 'csv'|'xlsx',
|
||||
* params: list<array{
|
||||
* name: string, label: string, type: 'select'|'text'|'number'|'date'|'check',
|
||||
* options?: array<int|string, string>, required?: bool, default?: mixed, hint?: string, placeholder?: string
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# slug|Judul|Subjudul|Filter;...|Kolom;... (# = kotak centang)|Tombol (T tambah, H hapus, A aksi, C cetak)
|
||||
list_pegawai|Pegawai|Daftar Pegawai|Kuota Pembimbing Akademik;Status Aktif;Status|#;NIP;Nama;L/P;NIDN;NUPTK;No. Telp.;Email;Status;Aksi|AC
|
||||
list_pegawai|Pegawai|Daftar Pegawai|Status Pembimbing;Status Aktif;Status|#;NIP;Nama;NIDN;No. Telp.;Status;Aksi|AC
|
||||
list_mahasiswa|Mahasiswa|Daftar Mahasiswa|Program Studi;Angkatan;Status Mahasiswa;Sistem Kuliah;Jalur Pendaftaran|#;NIM;Nama;Jenjang;Program Studi;Masuk;Status;Smt;SKS;IPK;Aksi|THAC
|
||||
list_konsultasi|Konsultasi Pembimbing|Daftar Konsultasi Pembimbing|Periode Akademik|#;NIM;Nama Mahasiswa;NIP;Nama Pembimbing;Topik;Post Terakhir;KRS Disetujui;Status;Aksi|H
|
||||
ms_kegiatan|Kegiatan Akademik|||Kode;Nama Kegiatan Akademik;Background;Aksi|T
|
||||
|
||||
Reference in New Issue
Block a user