diff --git a/app/Http/Controllers/Guru/LaporanController.php b/app/Http/Controllers/Guru/LaporanController.php new file mode 100644 index 0000000..35d3f38 --- /dev/null +++ b/app/Http/Controllers/Guru/LaporanController.php @@ -0,0 +1,24 @@ + 'Laporan Minat Baca Siswa', + 'laporan' => $laporan, + 'siswaTeraktif' => $siswaTeraktif, + 'aktivitasMingguan' => $aktivitasMingguan, + ]); + } +} diff --git a/app/Services/DummyDataService.php b/app/Services/DummyDataService.php index 9c10d95..3721fc5 100644 --- a/app/Services/DummyDataService.php +++ b/app/Services/DummyDataService.php @@ -4,6 +4,9 @@ class DummyDataService { + /** + * Data dummy untuk daftar siswa dan pengguna. + */ public static function getAllSiswa(): array { return [ @@ -56,11 +59,64 @@ public static function getAllSiswa(): array 'email' => 'rina.marlina@smkn1perpus.sch.id', 'nomor_hp' => '081223344556', 'password' => 'password', - 'role' => 'penjaga perpus', + 'role' => 'guru', ], ]; } + /** + * Data dummy untuk grafik aktivitas membaca mingguan di laporan guru. + */ + public static function getAktivitasMingguan(): array + { + return [ + 'labels' => ['Senin', 'Selasa', 'Rabu', 'Kamis', 'Jumat', 'Sabtu', 'Minggu'], + 'data' => [15, 22, 18, 25, 20, 30, 28], + ]; + } + + /** + * Data dummy untuk menampilkan 10 siswa paling aktif di laporan guru. + */ + public static function getSiswaTeraktif(): array + { + return [ + ['nama' => 'Silvi Rahmawati', 'total_buku' => 45, 'kelas' => 'XII RPL'], + ['nama' => 'Siti Nurhaliza', 'total_buku' => 33, 'kelas' => 'XII RPL A'], + ['nama' => 'Andi Pratama', 'total_buku' => 30, 'kelas' => 'XII RPL B'], + ['nama' => 'John Wick', 'total_buku' => 28, 'kelas' => 'XI TKJ'], + ['nama' => 'Dewi Lestari', 'total_buku' => 25, 'kelas' => 'XII AKL'], + ['nama' => 'Eko Prasetyo', 'total_buku' => 22, 'kelas' => 'XI MM'], + ['nama' => 'Rina Marlina', 'total_buku' => 20, 'kelas' => 'XII TKJ A'], + ['nama' => 'Budi Santoso', 'total_buku' => 18, 'kelas' => 'X OTKP'], + ['nama' => 'Putri Amelia', 'total_buku' => 16, 'kelas' => 'XI RPL C'], + ['nama' => 'Ahmad Haziq', 'total_buku' => 12, 'kelas' => 'X TKJ B'], + ]; + } + + /** + * Data dummy untuk halaman Laporan Minat Baca khusus Guru. + */ + public static function getLaporanMinatBaca(): array + { + return [ + 'buku_terpopuler' => [ + ['judul' => 'Modul Ajar IPAS', 'penulis' => 'Tim Kemdikbud Ristek', 'total_pembaca' => 125, 'cover' => 'images/covers/ipas.jpg'], + ['judul' => 'Ayah', 'penulis' => 'Andrea Hirata', 'total_pembaca' => 98, 'cover' => 'images/covers/ayah.png'], + ['judul' => 'Si Anak Pintar', 'penulis' => 'Tere Liye', 'total_pembaca' => 92, 'cover' => 'images/covers/sianakpintar.jpg'], + ], + 'kategori_populer' => [ + ['nama' => 'Sains', 'total_pembaca' => 230, 'trend' => 'naik', 'icon' => 'bi-arrow-up-right'], + ['nama' => 'Fiksi', 'total_pembaca' => 190, 'trend' => 'stabil', 'icon' => 'bi-arrow-right'], + ['nama' => 'Pendidikan', 'total_pembaca' => 150, 'trend' => 'turun', 'icon' => 'bi-arrow-down-right'], + ['nama' => 'Novel', 'total_pembaca' => 110, 'trend' => 'naik', 'icon' => 'bi-arrow-up-right'], + ], + 'insight' => 'Siswa menunjukkan minat baca tertinggi pada kategori Sains dan Fiksi. Buku-buku karangan Tere Liye dan Andrea Hirata masih menjadi favorit.', + ]; + } + + + public static function getAdminDashboardStats(): array { $allBooks = self::getAllBooks(); diff --git a/resources/views/guru/laporan/index.blade.php b/resources/views/guru/laporan/index.blade.php new file mode 100644 index 0000000..11374e5 --- /dev/null +++ b/resources/views/guru/laporan/index.blade.php @@ -0,0 +1,184 @@ + + @section('page-title', $pageTitle) + + + {{-- ========================= --}} + {{-- KOLOM KIRI (KONTEN UTAMA) --}} + {{-- ========================= --}} + + + + {{-- GRAFIK AKTIVITAS MEMBACA --}} + + + + Grafik Aktivitas Membaca (7 Hari Terakhir) + + + + + + + + + {{-- BUKU TERPOPULER --}} + + + + + Buku Terpopuler + + + + + @foreach ($laporan['buku_terpopuler'] as $buku) + + + + {{ $buku['judul'] }} + + + {{ $buku['total_pembaca'] }} + + + @if (!$loop->last) + + @endif + @endforeach + + + + + + + {{-- KATEGORI PALING DIMINATI --}} + + + + + Kategori Paling Diminati + + + + + @foreach ($laporan['kategori_populer'] as $kategori) + + + + {{ $kategori['nama'] }} + + + {{ $kategori['total_pembaca'] }} + + + @if (!$loop->last) + + @endif + @endforeach + + + + + + + + + + {{-- ========================= --}} + {{-- KOLOM KANAN (SISWA AKTIF) --}} + {{-- ========================= --}} + + + + + Siswa Paling Aktif + + + + @foreach ($siswaTeraktif as $siswa) + + + + {{ $siswa['nama'] }} + {{ $siswa['kelas'] }} + + + {{ $siswa['total_buku'] }} + + + @if (!$loop->last) + + @endif + @endforeach + + + + + + {{-- ========================= --}} + {{-- SCRIPT CHART.JS --}} + {{-- ========================= --}} + @push('scripts') + + + @endpush + diff --git a/resources/views/layouts/sidebar.blade.php b/resources/views/layouts/sidebar.blade.php index 4ef2040..49426dc 100644 --- a/resources/views/layouts/sidebar.blade.php +++ b/resources/views/layouts/sidebar.blade.php @@ -1,73 +1,94 @@ \ No newline at end of file + diff --git a/routes/web.php b/routes/web.php index f144a6b..43531ad 100644 --- a/routes/web.php +++ b/routes/web.php @@ -11,6 +11,7 @@ use App\Http\Controllers\Admin\BookController as AdminBookController; use App\Http\Controllers\Admin\PengumumanController; use App\Http\Controllers\Admin\UserController as AdminUserController; +use App\Http\Controllers\Guru\LaporanController; Route::get('/', function () { return view('welcome'); @@ -64,4 +65,9 @@ Route::get('/pengguna/{id}/edit', [AdminUserController::class, 'edit'])->name('pengguna.edit'); }); +// GRUP RUTE KHUSUS UNTUK GURU +Route::middleware(['role:guru'])->prefix('guru')->name('guru.')->group(function () { + Route::get('/laporan-minat-baca', [LaporanController::class, 'index'])->name('laporan.index'); +}); + require __DIR__ . '/auth.php';