diff --git a/app/Http/Controllers/Admin/BookController.php b/app/Http/Controllers/Admin/BookController.php index 685e06f..e4a11d3 100644 --- a/app/Http/Controllers/Admin/BookController.php +++ b/app/Http/Controllers/Admin/BookController.php @@ -36,4 +36,15 @@ public function create() 'pageTitle' => 'Tambah Buku Baru' ]); } + + public function edit($id) +{ + $buku = DummyDataService::getKatalogBuku()->firstWhere('id', (int)$id); + abort_if(!$buku, 404); + + return view('admin.buku.edit', [ + 'pageTitle' => 'Edit Buku: ' . $buku['judul'], + 'buku' => $buku + ]); +} } \ No newline at end of file diff --git a/app/Http/Controllers/Admin/PengumumanController.php b/app/Http/Controllers/Admin/PengumumanController.php index 8ceca56..e5e4ac9 100644 --- a/app/Http/Controllers/Admin/PengumumanController.php +++ b/app/Http/Controllers/Admin/PengumumanController.php @@ -8,6 +8,9 @@ class PengumumanController extends Controller { + /** + * Menampilkan daftar semua pengumuman. + */ public function index() { $semuaPengumuman = DummyDataService::getPengumuman(); @@ -16,4 +19,30 @@ public function index() 'semuaPengumuman' => $semuaPengumuman, ]); } + + /** + * Menampilkan form untuk membuat pengumuman baru. + */ + public function create() + { + return view('admin.pengumuman.create', [ + 'pageTitle' => 'Buat Pengumuman Baru', + ]); + } + + /** + * Menampilkan form untuk mengedit pengumuman yang ada. + */ + public function edit($id) + { + $pengumuman = collect(DummyDataService::getPengumuman())->firstWhere('id', (int)$id); + + // Hentikan jika pengumuman tidak ditemukan + abort_if(!$pengumuman, 404); + + return view('admin.pengumuman.edit', [ + 'pageTitle' => 'Edit Pengumuman', + 'pengumuman' => $pengumuman, + ]); + } } \ No newline at end of file diff --git a/app/Http/Controllers/Admin/UserController.php b/app/Http/Controllers/Admin/UserController.php index 944eb9c..8643ef7 100644 --- a/app/Http/Controllers/Admin/UserController.php +++ b/app/Http/Controllers/Admin/UserController.php @@ -1,7 +1,10 @@ $semuaSiswa ]); } + + /** + * Menampilkan form untuk membuat pengguna baru. + */ + public function create() + { + return view('admin.pengguna.create', [ + 'pageTitle' => 'Tambah Pengguna Baru', + ]); + } + + /** + * Menampilkan form untuk mengedit pengguna yang ada. + */ + public function edit($id) + { + $pengguna = collect(DummyDataService::getAllSiswa())->firstWhere('id', (int)$id); + abort_if(!$pengguna, 404); + + return view('admin.pengguna.edit', [ + 'pageTitle' => 'Edit Pengguna', + 'pengguna' => $pengguna, + ]); + } } \ No newline at end of file diff --git a/app/Services/DummyDataService.php b/app/Services/DummyDataService.php index ffce8c1..9c10d95 100644 --- a/app/Services/DummyDataService.php +++ b/app/Services/DummyDataService.php @@ -128,13 +128,13 @@ public static function getDashboardStats(): array public static function getPengumuman(): array { $pengumuman = [ - ['type' => 'warning', 'icon' => 'bi-exclamation-triangle-fill', 'title' => 'Perpustakaan Tutup', 'content' => 'Perpustakaan akan tutup pada tanggal 25 Desember untuk perayaan Natal.'], - ['type' => 'info', 'icon' => 'bi-info-circle-fill', 'title' => 'Buku Baru Tersedia', 'content' => 'Edisi baru telah ditambahkan ke koleksi perpustakaan digital.'], + ['id' => 1, 'type' => 'warning', 'icon' => 'bi-exclamation-triangle-fill', 'title' => 'Perpustakaan Tutup', 'content' => 'Perpustakaan akan tutup pada tanggal 25 Desember untuk perayaan Natal.'], + ['id' => 2, 'type' => 'info', 'icon' => 'bi-info-circle-fill', 'title' => 'Buku Baru Tersedia', 'content' => 'Edisi baru telah ditambahkan ke koleksi perpustakaan digital.'], ]; - // Buat 30 data dummy tambahan - for ($i = 1; $i <= 30; $i++) { - $pengumuman[] = ['type' => 'secondary', 'icon' => 'bi-megaphone-fill', 'title' => "Pengumuman Biasa #{$i}", 'content' => "Ini adalah isi dari pengumuman rutin nomor {$i}."]; + // Buat 30 data dummy tambahan dengan 'id' + for ($i = 3; $i <= 32; $i++) { + $pengumuman[] = ['id' => $i, 'type' => 'secondary', 'icon' => 'bi-megaphone-fill', 'title' => "Pengumuman Biasa #{$i}", 'content' => "Ini adalah isi dari pengumuman rutin nomor {$i}."]; } return $pengumuman; diff --git a/resources/views/admin/buku/edit.blade.php b/resources/views/admin/buku/edit.blade.php new file mode 100644 index 0000000..b670872 --- /dev/null +++ b/resources/views/admin/buku/edit.blade.php @@ -0,0 +1,71 @@ + + @section('page-title', $pageTitle) + +
+
+ + + +
Formulir Edit Buku
+
+
+
+ {{-- Form ini tidak akan berfungsi karena tidak ada backend --}} +
+
+
+ + +
+
+ + +
+
+
+ + +
+
+ + +
+
+
+ + @php + $tipe_akses = is_array($buku['tipe_akses']) ? $buku['tipe_akses'] : [$buku['tipe_akses']]; + @endphp +
+ + +
+
+ + +
+
+
+
+
+ + + Cover saat ini +
+
+ + + @if(isset($buku['file_pdf'])) + File saat ini: {{ $buku['file_pdf'] }} + @endif +
+
+
+
+
+ +
+
+
+
+
\ No newline at end of file diff --git a/resources/views/admin/buku/index.blade.php b/resources/views/admin/buku/index.blade.php index 1b1e78a..f1e6682 100644 --- a/resources/views/admin/buku/index.blade.php +++ b/resources/views/admin/buku/index.blade.php @@ -42,6 +42,7 @@ + Edit Buku + @@ -129,42 +135,45 @@ @endpush diff --git a/resources/views/admin/pengguna/create.blade.php b/resources/views/admin/pengguna/create.blade.php new file mode 100644 index 0000000..ff1d8ce --- /dev/null +++ b/resources/views/admin/pengguna/create.blade.php @@ -0,0 +1,47 @@ + + @section('page-title', $pageTitle) +
+
+ +
Formulir Tambah Pengguna
+
+
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+
+ + +
+
+ + +
+
+
+
+ +
+
+
+
+
\ No newline at end of file diff --git a/resources/views/admin/pengguna/edit.blade.php b/resources/views/admin/pengguna/edit.blade.php new file mode 100644 index 0000000..d4cd7ab --- /dev/null +++ b/resources/views/admin/pengguna/edit.blade.php @@ -0,0 +1,47 @@ + + @section('page-title', $pageTitle) +
+
+ +
Formulir Edit Pengguna
+
+
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+
+ + +
+
+ + +
+
+
+
+ +
+
+
+
+
\ No newline at end of file diff --git a/resources/views/admin/pengguna/index.blade.php b/resources/views/admin/pengguna/index.blade.php index 49e13d0..9ff289e 100644 --- a/resources/views/admin/pengguna/index.blade.php +++ b/resources/views/admin/pengguna/index.blade.php @@ -1,12 +1,24 @@ @section('page-title', $pageTitle) +
-
Daftar Semua Pengguna
+
+
Daftar Semua Pengguna
+ + Tambah Pengguna + +
- + + + + + + + @forelse($semuaSiswa as $siswa) @@ -14,15 +26,91 @@ - - + + @empty - + + + @endforelse
NoNama LengkapEmailRoleAksi
NoNama LengkapEmailRoleAksi
{{ $loop->iteration }} {{ $siswa['nama_lengkap'] }} {{ $siswa['email'] }}{{ Str::title($siswa['role']) }} + @if($siswa['role'] == 'penjaga perpus') + {{ Str::title($siswa['role']) }} + @else + {{ Str::title($siswa['role']) }} + @endif + + +
Tidak ada data pengguna.
Tidak ada data pengguna.
+ + + + @push('scripts') + + @endpush
\ No newline at end of file diff --git a/resources/views/admin/pengumuman/create.blade.php b/resources/views/admin/pengumuman/create.blade.php new file mode 100644 index 0000000..045a1a8 --- /dev/null +++ b/resources/views/admin/pengumuman/create.blade.php @@ -0,0 +1,40 @@ + + @section('page-title', $pageTitle) + +
+
+ + + +
Formulir Pengumuman Baru
+
+
+
+ {{-- Form ini tidak akan berfungsi karena tidak ada backend --}} +
+ + +
+
+ + +
+
+ + +
+
+
+ +
+
+
+
+
\ No newline at end of file diff --git a/resources/views/admin/pengumuman/edit.blade.php b/resources/views/admin/pengumuman/edit.blade.php new file mode 100644 index 0000000..2d7fb87 --- /dev/null +++ b/resources/views/admin/pengumuman/edit.blade.php @@ -0,0 +1,40 @@ + + @section('page-title', $pageTitle) + +
+
+ + + +
Formulir Edit Pengumuman
+
+
+
+ {{-- Form ini tidak akan berfungsi karena tidak ada backend --}} +
+ + +
+
+ + +
+
+ + +
+
+
+ +
+
+
+
+
\ No newline at end of file diff --git a/resources/views/admin/pengumuman/index.blade.php b/resources/views/admin/pengumuman/index.blade.php index 7df3a68..569a168 100644 --- a/resources/views/admin/pengumuman/index.blade.php +++ b/resources/views/admin/pengumuman/index.blade.php @@ -1,42 +1,55 @@ @section('page-title', $pageTitle) +
Kelola Pengumuman
- + + Buat Pengumuman +
- +
- - - - - + + + + + - @foreach ($semuaPengumuman as $item) - - - - - - - - @endforeach + @forelse ($semuaPengumuman as $item) + + + + + + + + @empty + + + + @endforelse
NoTipeJudulIsiAksiNoTipeJudulIsiAksi
{{ $loop->iteration }}{{ Str::title($item['type']) }} - {{ $item['title'] }}{{ $item['content'] }} - - -
{{ $loop->iteration }} + {{ Str::title($item['type']) }} + {{ $item['title'] }} + {{ $item['content'] }} + + + + + +
+

Belum ada pengumuman yang dibuat.

+
-
+ \ No newline at end of file diff --git a/routes/web.php b/routes/web.php index ea79ca8..f144a6b 100644 --- a/routes/web.php +++ b/routes/web.php @@ -54,9 +54,14 @@ Route::middleware(['session.auth', 'role:penjaga perpus'])->prefix('admin')->name('admin.')->group(function () { Route::get('/dashboard', [AdminDashboardController::class, 'index'])->name('dashboard'); Route::get('/buku', [AdminBookController::class, 'index'])->name('buku.index'); + Route::get('/buku/{id}/edit', [AdminBookController::class, 'edit'])->name('buku.edit'); Route::get('/buku/tambah', [AdminBookController::class, 'create'])->name('buku.create'); Route::get('/pengguna', [AdminUserController::class, 'index'])->name('pengguna.index'); Route::get('/pengumuman', [PengumumanController::class, 'index'])->name('pengumuman.index'); + Route::get('/pengumuman/tambah', [PengumumanController::class, 'create'])->name('pengumuman.create'); + Route::get('/pengumuman/{id}/edit', [PengumumanController::class, 'edit'])->name('pengumuman.edit'); + Route::get('/pengguna/tambah', [AdminUserController::class, 'create'])->name('pengguna.create'); + Route::get('/pengguna/{id}/edit', [AdminUserController::class, 'edit'])->name('pengguna.edit'); }); -require __DIR__ . '/auth.php'; \ No newline at end of file +require __DIR__ . '/auth.php';