Commit awal: prototipe UI SIAKAD Untan

This commit is contained in:
Ariyutta
2026-10-24 11:45:32 +07:00
commit d9b9cb5c0f
477 changed files with 51958 additions and 0 deletions
@@ -0,0 +1,73 @@
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Prototype\ResourceController;
use App\Support\Prototype\Sample;
use Illuminate\Support\Collection;
use Illuminate\Validation\Rule;
class ProgramStudiController extends ResourceController
{
private const JENJANG = ['D3' => 'D3', 'S1' => 'S1', 'S2' => 'S2', 'S3' => 'S3'];
private const AKREDITASI = ['Unggul' => 'Unggul', 'Baik Sekali' => 'Baik Sekali', 'Baik' => 'Baik'];
protected function rows(): Collection
{
return Sample::prodi();
}
protected function routeBase(): string
{
return 'admin.program-studi';
}
protected function names(): array
{
return ['singular' => 'Program studi', 'plural' => 'Program studi', 'description' => 'Program studi per fakultas, lengkap dengan jenjang, akreditasi, dan ketua program studi.'];
}
protected function search(): array
{
return ['kode', 'nama', 'kaprodi'];
}
protected function filters(): array
{
return [
['name' => 'fakultas', 'label' => 'Fakultas', 'options' => Sample::fakultas()->pluck('nama', 'nama')->all()],
['name' => 'jenjang', 'label' => 'Jenjang', 'options' => self::JENJANG],
['name' => 'akreditasi', 'label' => 'Akreditasi', 'options' => self::AKREDITASI],
];
}
protected function columns(): array
{
return [
['label' => 'Kode', 'key' => 'kode'],
['label' => 'Program studi', 'key' => 'nama'],
['label' => 'Fakultas', 'key' => 'fakultas'],
['label' => 'Jenjang', 'key' => 'jenjang'],
['label' => 'Akreditasi', 'key' => 'akreditasi', 'badge' => fn (array $r): string => match ($r['akreditasi']) {
'Unggul' => 'success', 'Baik Sekali' => 'accent', default => 'gold',
}],
['label' => 'Kaprodi', 'key' => 'kaprodi'],
['label' => 'Mahasiswa', 'value' => fn (array $r): string => number_format($r['mahasiswa'], 0, ',', '.'), 'class' => 'num'],
];
}
protected function fields(?array $row): array
{
$fakultas = Sample::fakultas()->pluck('nama', 'nama')->all();
return [
['name' => 'fakultas', 'label' => 'Fakultas', 'type' => 'select', 'options' => $fakultas, 'rules' => ['required', Rule::in(array_keys($fakultas))], 'span' => 'full'],
['name' => 'kode', 'label' => 'Kode program studi', 'rules' => ['required', 'string', 'max:12']],
['name' => 'nama', 'label' => 'Nama program studi', 'rules' => ['required', 'string', 'max:150']],
['name' => 'jenjang', 'label' => 'Jenjang', 'type' => 'select', 'options' => self::JENJANG, 'rules' => ['required', Rule::in(array_keys(self::JENJANG))]],
['name' => 'akreditasi', 'label' => 'Akreditasi', 'type' => 'select', 'options' => self::AKREDITASI, 'rules' => ['required', Rule::in(array_keys(self::AKREDITASI))]],
['name' => 'kaprodi', 'label' => 'Ketua program studi', 'rules' => ['string', 'max:150'], 'optional' => true, 'span' => 'full'],
];
}
}