Files
siakad/app/Http/Controllers/Operator/TahunKurikulumController.php
T
2026-11-09 10:14:07 +07:00

58 lines
2.3 KiB
PHP

<?php
namespace App\Http\Controllers\Operator;
use App\Http\Controllers\Controller;
use App\Http\Controllers\Operator\Concerns\ServesLegacyList;
use App\Support\Legacy\Curriculum;
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. */
class TahunKurikulumController extends Controller
{
use ServesLegacyList;
private const string SLUG = 'ms_thnkurikulum';
public function __construct(private readonly Curriculum $curriculum) {}
public function __invoke(Request $request): View
{
$page = Catalog::page(self::SLUG);
return view('operator.satu.remote-list', [
'page' => $page,
'crumbs' => $this->crumbs(self::SLUG, $page),
'note' => 'Tahun kurikulum diturunkan dari periode berlaku setiap kurikulum (seluruh universitas). 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],
],
'perPage' => Curriculum::PER_PAGE,
'data' => $this->payload($this->curriculum->yearSummary('', Curriculum::PER_PAGE[0])),
]);
}
public function data(Request $request): 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)),
)));
}
}