Commit awal: prototipe UI SIAKAD Untan
This commit is contained in:
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Dosen;
|
||||
|
||||
use App\Http\Controllers\Prototype\ResourceController;
|
||||
use App\Support\Prototype\DosenData;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\Support\Collection;
|
||||
|
||||
class SkripsiController extends ResourceController
|
||||
{
|
||||
private const TAHAP = ['Penulisan proposal', 'Seminar proposal', 'Pengumpulan data', 'Penulisan bab 4', 'Penulisan bab 5', 'Seminar hasil', 'Sidang akhir'];
|
||||
|
||||
protected function rows(): Collection
|
||||
{
|
||||
return DosenData::catatanSkripsi();
|
||||
}
|
||||
|
||||
protected function routeBase(): string
|
||||
{
|
||||
return 'dosen.skripsi';
|
||||
}
|
||||
|
||||
protected function names(): array
|
||||
{
|
||||
return ['singular' => 'Catatan bimbingan', 'plural' => 'Bimbingan skripsi', 'description' => 'Pantau kemajuan skripsi dan catat setiap sesi bimbingan.'];
|
||||
}
|
||||
|
||||
protected function abilities(): array
|
||||
{
|
||||
return ['create' => true, 'show' => false, 'edit' => false, 'delete' => false];
|
||||
}
|
||||
|
||||
protected function columns(): array
|
||||
{
|
||||
return [
|
||||
['label' => 'Tanggal', 'value' => fn (array $r): string => DosenData::tanggal($r['tanggal'])],
|
||||
['label' => 'Mahasiswa', 'key' => 'nama'],
|
||||
['label' => 'Topik', 'key' => 'topik'],
|
||||
['label' => 'Tahap', 'key' => 'tahap', 'badge' => fn (array $r): string => 'accent'],
|
||||
];
|
||||
}
|
||||
|
||||
protected function fields(?array $row): array
|
||||
{
|
||||
$mahasiswa = DosenData::skripsi()->mapWithKeys(fn (array $m): array => [$m['nim'] => "{$m['nama']} ({$m['nim']})"])->all();
|
||||
$tahap = array_combine(self::TAHAP, self::TAHAP);
|
||||
|
||||
return [
|
||||
['name' => 'nim', 'label' => 'Mahasiswa', 'type' => 'select', 'options' => $mahasiswa, 'rules' => ['required', 'in:'.implode(',', array_keys($mahasiswa))], 'section' => 'Sesi bimbingan'],
|
||||
['name' => 'tanggal', 'label' => 'Tanggal bimbingan', 'type' => 'date', 'rules' => ['required', 'date', 'before_or_equal:today'], 'default' => today()->toDateString(), 'section' => 'Sesi bimbingan'],
|
||||
['name' => 'tahap', 'label' => 'Tahap skripsi', 'type' => 'select', 'options' => $tahap, 'rules' => ['required', 'in:'.implode(',', self::TAHAP)], 'section' => 'Sesi bimbingan'],
|
||||
['name' => 'topik', 'label' => 'Topik pembahasan', 'type' => 'text', 'rules' => ['required', 'string', 'max:120'], 'section' => 'Sesi bimbingan'],
|
||||
['name' => 'catatan', 'label' => 'Catatan dan arahan', 'type' => 'textarea', 'rules' => ['required', 'string', 'min:10', 'max:1000'], 'hint' => 'Tuliskan arahan dan tindak lanjut untuk mahasiswa.', 'section' => 'Catatan'],
|
||||
];
|
||||
}
|
||||
|
||||
public function index(\Illuminate\Http\Request $request): View
|
||||
{
|
||||
$mahasiswa = DosenData::skripsi();
|
||||
|
||||
return view('dosen.skripsi.index', [
|
||||
'mahasiswa' => $mahasiswa,
|
||||
'catatan' => DosenData::catatanSkripsi(),
|
||||
'rataProgres' => (int) round($mahasiswa->avg('progres')),
|
||||
'totalSesi' => (int) $mahasiswa->sum('jumlah'),
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user