49 lines
1.8 KiB
PHP
49 lines
1.8 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Operator;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use App\Http\Controllers\Operator\Concerns\ServesLegacyList;
|
|
use App\Support\Legacy\ClassSchedule;
|
|
use App\Support\Prototype\Satu\Catalog;
|
|
use Illuminate\Contracts\View\View;
|
|
use Illuminate\Http\JsonResponse;
|
|
use Illuminate\Http\Request;
|
|
|
|
/** Perkuliahan > Data Kelas > Tahun Ajaran (slug ms_tahunajaran) untuk akun DB lama: tahun ajaran dari t_periodekuliah. */
|
|
class TahunAjaranController extends Controller
|
|
{
|
|
use ServesLegacyList;
|
|
|
|
private const string SLUG = 'ms_tahunajaran';
|
|
|
|
public function __construct(private readonly ClassSchedule $schedule) {}
|
|
|
|
public function __invoke(): View
|
|
{
|
|
$page = Catalog::page(self::SLUG);
|
|
|
|
return view('operator.satu.remote-list', [
|
|
'page' => $page,
|
|
'crumbs' => $this->crumbs(self::SLUG, $page),
|
|
'note' => 'Tahun ajaran asli dari periode kuliah SIAKAD.',
|
|
'empty' => ['icon' => 'calendar', 'title' => 'Belum ada tahun ajaran', 'description' => 'Tahun ajaran tampil setelah ada periode kuliah.'],
|
|
'url' => route('operator.tahun-ajaran.data'),
|
|
'filters' => [],
|
|
'columns' => [
|
|
['key' => 'tahun', 'label' => 'Tahun'],
|
|
['key' => 'nama', 'label' => 'Nama Tahun'],
|
|
],
|
|
'perPage' => ClassSchedule::PER_PAGE,
|
|
'data' => $this->payload($this->schedule->academicYears('', ClassSchedule::PER_PAGE[0])),
|
|
]);
|
|
}
|
|
|
|
public function data(Request $request): JsonResponse
|
|
{
|
|
$this->legacyOnly($request);
|
|
|
|
return response()->json($this->payload($this->schedule->academicYears($this->query($request), $this->perPage($request, ClassSchedule::PER_PAGE), max(1, $request->integer('page', 1)))));
|
|
}
|
|
}
|