[Operator] Penambahan Tambah Jadwal Kelas dan Dosen Pengajar

This commit is contained in:
Ariyutta
2026-11-14 05:43:16 +07:00
parent 15be51ebd6
commit 1d38086488
18 changed files with 873 additions and 22 deletions
@@ -8,6 +8,10 @@ use App\Support\Legacy\AcademicOverview;
use App\Support\Legacy\ClassSchedule;
use App\Support\Legacy\ClassWriter;
use App\Support\Legacy\Curriculum;
use App\Support\Legacy\EmployeeDirectory;
use App\Support\Legacy\LecturerWriter;
use App\Support\Legacy\MeetingWriter;
use App\Support\Legacy\MenuAccess;
use App\Support\Legacy\PortalException;
use App\Support\Prototype\Satu\Catalog;
use Illuminate\Contracts\View\View;
@@ -36,6 +40,7 @@ class KelasController extends Controller
private readonly ClassSchedule $schedule,
private readonly Curriculum $curriculum,
private readonly ClassWriter $writer,
private readonly LecturerWriter $lecturers,
) {}
public function __invoke(Request $request): View
@@ -183,17 +188,27 @@ class KelasController extends Controller
return response()->json($this->payload($this->search($request, $prodi, $periods, $default)));
}
public function show(Request $request, int $id): View
/** MenuAccess disuntik per pemanggilan (bukan konstruktor): cache haknya per instance, sedangkan controller dipakai ulang antar permintaan (uji, Octane). */
public function show(Request $request, MenuAccess $access, EmployeeDirectory $employees, MeetingWriter $meetings, int $id): View
{
$this->legacyOnly($request);
$prodi = $this->overview->programs((int) $request->user()->getKey())->keys()->all();
$iduser = (int) $request->user()->getKey();
$prodi = $this->overview->programs($iduser)->keys()->all();
$detail = $this->schedule->detail($prodi, $id) ?? abort(404);
$page = Catalog::page(self::SLUG);
// Penetapan pengajar dan jadwal mengikuti kode menu lama Input Jadwal / Entry Jadwal & Peminat (MenuAccess::ACTIONS), bukan hak Kelas Kuliah.
$open = $detail['kelas']['kunci'] === 'Tidak Dikunci';
$canAssign = $open && $access->allows($request->user(), 'list_kelas/pengajar');
$canSchedule = $open && $access->allows($request->user(), 'list_kelas/jadwal');
return view('operator.satu.kelas-detail', [
'page' => $page,
'crumbs' => ['Beranda' => route(auth()->user()->role->dashboardRoute())] + array_fill_keys(Catalog::trail(self::SLUG), null) + [$page['title'] => route('operator.halaman', self::SLUG), 'Detail' => null],
'back' => route('operator.halaman', self::SLUG),
'canAssign' => $canAssign,
'dosenOptions' => $canAssign ? $this->lecturers->options()->except(array_column($detail['pengajar'], 'id')) : collect(),
'canSchedule' => $canSchedule,
'roomOptions' => $canSchedule ? $meetings->roomOptions(array_values(array_unique([...$employees->faculties($iduser), ...$prodi]))) : collect(),
] + $detail);
}