89 lines
4.1 KiB
PHP
89 lines
4.1 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Operator;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use App\Http\Controllers\Operator\Concerns\ServesLegacyList;
|
|
use App\Support\Legacy\AcademicOverview;
|
|
use App\Support\Legacy\Curriculum;
|
|
use App\Support\Legacy\UnitScope;
|
|
use App\Support\Prototype\Satu\Catalog;
|
|
use Illuminate\Contracts\View\View;
|
|
use Illuminate\Http\JsonResponse;
|
|
use Illuminate\Http\Request;
|
|
|
|
/** Perkuliahan > Manajemen Kurikulum > Tahun Kurikulum (slug ms_thnkurikulum) untuk akun DB lama: ringkasan per tahun periode berlaku; seluruh universitas untuk akun pusat, prodi akun untuk staf fakultas/prodi. */
|
|
class TahunKurikulumController extends Controller
|
|
{
|
|
use ServesLegacyList;
|
|
|
|
private const string SLUG = 'ms_thnkurikulum';
|
|
|
|
public function __construct(private readonly Curriculum $curriculum, private readonly AcademicOverview $overview) {}
|
|
|
|
public function __invoke(Request $request, UnitScope $scope): View
|
|
{
|
|
$page = Catalog::page(self::SLUG);
|
|
$prodi = $this->prodi($request, $scope);
|
|
|
|
return view('operator.satu.remote-list', [
|
|
'page' => $page,
|
|
'crumbs' => $this->crumbs(self::SLUG, $page),
|
|
'note' => 'Tahun kurikulum diturunkan dari periode berlaku setiap kurikulum ('.($prodi === null ? 'seluruh universitas' : 'program studi yang Anda kelola').'). Tanggal awal/akhir tidak tercatat di sumber data.',
|
|
'strict' => true, // ringkasan turunan dari t_kurikulum, tidak ada tabel sendiri untuk ditulis
|
|
'empty' => ['icon' => 'calendar', 'title' => 'Belum ada kurikulum', 'description' => 'Tahun kurikulum tampil setelah ada kurikulum dengan periode berlaku.'],
|
|
'url' => route('operator.thnkurikulum.data'),
|
|
'filters' => [],
|
|
'columns' => [
|
|
['key' => 'tahun', 'label' => 'Tahun'],
|
|
['key' => 'awal', 'label' => 'Tanggal Awal'],
|
|
['key' => 'akhir', 'label' => 'Tanggal Akhir'],
|
|
['key' => 'berlaku', 'label' => 'Mulai Berlaku'],
|
|
['key' => 'keterangan', 'label' => 'Keterangan'],
|
|
['key' => 'prodi', 'label' => 'Program Studi', 'num' => true],
|
|
],
|
|
// Modal Lihat: panel judul (tahun, mulai berlaku, jumlah) lalu tiap program studi satu tabel kurikulumnya.
|
|
'detailColumns' => [
|
|
['key' => 'tahun', 'label' => 'Tahun'],
|
|
['key' => 'berlaku', 'label' => 'Mulai Berlaku'],
|
|
['key' => 'keterangan', 'label' => 'Keterangan'],
|
|
['key' => 'prodi', 'label' => 'Program Studi'],
|
|
['key' => 'rincian', 'label' => 'Kurikulum per Program Studi', 'detail' => 'rincian', 'grouped' => true, 'nameFirst' => true, 'table' => [
|
|
['key' => 'nama', 'label' => 'Kurikulum'],
|
|
['key' => 'program', 'label' => 'Sistem Kuliah'],
|
|
['key' => 'periode', 'label' => 'Periode Berlaku'],
|
|
['key' => 'status', 'label' => 'Status'],
|
|
]],
|
|
],
|
|
'perPage' => Curriculum::PER_PAGE,
|
|
'data' => $this->payload($this->curriculum->yearSummary('', Curriculum::PER_PAGE[0], 1, $prodi)),
|
|
]);
|
|
}
|
|
|
|
public function data(Request $request, UnitScope $scope): JsonResponse
|
|
{
|
|
$this->legacyOnly($request);
|
|
|
|
return response()->json($this->payload($this->curriculum->yearSummary(
|
|
$this->query($request),
|
|
$this->perPage($request, Curriculum::PER_PAGE),
|
|
max(1, $request->integer('page', 1)),
|
|
$this->prodi($request, $scope),
|
|
)));
|
|
}
|
|
|
|
/**
|
|
* Batas program studi akun: menu lama Browse Kurikulum bertanda bybagian, jadi staf fakultas/prodi hanya melihat
|
|
* kurikulum prodi yang dipegangnya (sama dengan halaman Kurikulum Prodi: AcademicOverview::programs); akun pusat
|
|
* (null) melihat seluruh universitas.
|
|
*
|
|
* @return list<int>|null
|
|
*/
|
|
private function prodi(Request $request, UnitScope $scope): ?array
|
|
{
|
|
$iduser = (int) $request->user()->getKey();
|
|
|
|
return $scope->units($iduser) === null ? null : $this->overview->programs($iduser)->keys()->all();
|
|
}
|
|
}
|