diff --git a/app/Http/Controllers/Admin/AdminPeminjamanController.php b/app/Http/Controllers/Admin/AdminPeminjamanController.php new file mode 100644 index 0000000..1918310 --- /dev/null +++ b/app/Http/Controllers/Admin/AdminPeminjamanController.php @@ -0,0 +1,57 @@ +pluck('peminjam')->unique(); + + + return view('admin.peminjaman.index', [ + 'pageTitle' => 'Manajemen Peminjaman', + 'peminjamanAktif' => $peminjamanAktif, + 'daftarPeminjam' => $daftarPeminjam, + ]); + } + + /** + * Menampilkan formulir untuk membuat peminjaman manual. + */ + public function create() + { + $allUsers = collect(DummyDataService::getAllSiswa()); + + // Kelompokkan berdasarkan 'role' + $groupedUsers = $allUsers + ->whereIn('role', ['siswa', 'guru']) + ->groupBy('role'); + + // Filter hanya buku offline + $daftarBuku = DummyDataService::getAllBooks() + ->where('status', 'Tersedia') + ->filter(function ($buku) { + if (is_array($buku['tipe_akses'])) { + return in_array('offline', $buku['tipe_akses']); + } + return $buku['tipe_akses'] === 'offline'; + }); + + return view('admin.peminjaman.create', [ + 'pageTitle' => 'Buat Peminjaman Manual', + 'groupedUsers' => $groupedUsers, + 'daftarBuku' => $daftarBuku, + ]); + } +} diff --git a/app/Http/Requests/Auth/LoginRequest.php b/app/Http/Requests/Auth/LoginRequest.php index 4a9d1bb..3f85176 100644 --- a/app/Http/Requests/Auth/LoginRequest.php +++ b/app/Http/Requests/Auth/LoginRequest.php @@ -37,9 +37,9 @@ public function rules(): array ]; } - // Jika tidak (untuk 'guru' dan 'penjaga perpus'), validasi 'email' dan 'password'. + // Jika tidak (untuk 'guru' dan 'penjaga perpus') return [ - 'email' => ['required', 'string', 'email'], + 'nip' => ['required', 'string'], 'password' => ['required', 'string'], ]; } @@ -62,15 +62,15 @@ public function authenticate(): void $userArray = null; // Tentukan field mana yang akan menerima pesan error jika gagal (nisn atau email). - $errorField = $this->filled('nisn') ? 'nisn' : 'email'; + $errorField = $this->filled('nisn') ? 'nisn' : 'nip'; // Langkah 2: Cari data pengguna berdasarkan input yang diberikan. if ($this->filled('nisn')) { // Jika form diisi dengan 'nisn', cari pengguna berdasarkan 'nisn'. $userArray = collect($allUsers)->firstWhere('nisn', $this->input('nisn')); } else { - // Jika tidak, cari pengguna berdasarkan 'email'. - $userArray = collect($allUsers)->firstWhere('email', $this->input('email')); + // Jika tidak, cari pengguna berdasarkan 'nip'. + $userArray = collect($allUsers)->firstWhere('nip', $this->input('nip')); } // Langkah 3: Lakukan Pengecekan Kredensial dan Role. @@ -144,7 +144,7 @@ public function ensureIsNotRateLimited(): void public function throttleKey(): string { // Gunakan 'nisn' jika ada, jika tidak, gunakan 'email' sebagai identitas. - $loginIdentifier = $this->input('nisn') ?: $this->input('email'); + $loginIdentifier = $this->input('nisn') ?: $this->input('nip'); return Str::transliterate(Str::lower($loginIdentifier) . '|' . $this->ip()); } } \ No newline at end of file diff --git a/app/Services/DummyDataService.php b/app/Services/DummyDataService.php index 76342b5..a326a07 100644 --- a/app/Services/DummyDataService.php +++ b/app/Services/DummyDataService.php @@ -2,6 +2,8 @@ namespace App\Services; +use Carbon\Carbon; + class DummyDataService { /** @@ -24,6 +26,7 @@ public static function getAllSiswa(): array [ 'id' => 2, 'nama_lengkap' => 'Budi Santoso', + 'nip' => '197812312005011', 'email' => 'budi.santoso@smkn1perpus.sch.id', 'password' => 'password', 'role' => 'penjaga perpus', @@ -54,6 +57,7 @@ public static function getAllSiswa(): array [ 'id' => 5, 'nama_lengkap' => 'Rina Marlina', + 'nip' => '198506152010012', 'email' => 'rina.marlina@smkn1perpus.sch.id', 'password' => 'password', 'role' => 'guru', @@ -72,6 +76,164 @@ public static function getAktivitasMingguan(): array ]; } + /** + * Data dummy untuk tabel peminjaman aktif di dashboard admin. + */ + public static function getAdminPeminjamanAktif(): \Illuminate\Support\Collection + { + return collect([ + [ + 'id_peminjaman' => 'PIN-202510-001', + 'peminjam' => 'Silvi Rahmawati', + 'nomor_hp' => '08123456789', + 'tanggal_pinjam' => Carbon::now()->subDays(12), + 'tenggat_kembali' => Carbon::now()->subDays(5), // Terlambat 5 hari + 'denda_per_hari' => 1000, + 'books' => [ + ['id' => 5, 'judul' => 'Si Anak Pintar'], + ['id' => 8, 'judul' => 'Ayah'], + ] + ], + [ + 'id_peminjaman' => 'PIN-202510-002', + 'peminjam' => 'Andi Pratama', + 'nomor_hp' => '081556677889', + 'tanggal_pinjam' => Carbon::now()->subDays(4), + 'tenggat_kembali' => Carbon::now()->addDays(3), // Sisa 3 hari + 'denda_per_hari' => 1000, + 'books' => [ + ['id' => 7, 'judul' => 'The Last Spell Breather'], + ] + ], + [ + 'id_peminjaman' => 'PIN-202510-003', + 'peminjam' => 'Siti Nurhaliza', + 'nomor_hp' => '081998877665', + 'tanggal_pinjam' => Carbon::now()->subDays(7), + 'tenggat_kembali' => Carbon::now(), // Hari ini + 'denda_per_hari' => 1000, + 'books' => [ + ['id' => 1, 'judul' => 'Modul Ajar IPAS'], + ] + ], + [ + 'id_peminjaman' => 'PIN-202510-004', + 'peminjam' => 'Dewi Lestari', + 'nomor_hp' => '082134567891', + 'tanggal_pinjam' => Carbon::now()->subDays(15), + 'tenggat_kembali' => Carbon::now()->subDays(8), // Terlambat 8 hari + 'denda_per_hari' => 1000, + 'books' => [ + ['id' => 2, 'judul' => 'Modul Ajar Pendidikan Pancasila'], + ['id' => 6, 'judul' => 'Matematika Dasar'], + ] + ], + [ + 'id_peminjaman' => 'PIN-202510-005', + 'peminjam' => 'Eko Prasetyo', + 'nomor_hp' => '085612345678', + 'tanggal_pinjam' => Carbon::now()->subDays(2), + 'tenggat_kembali' => Carbon::now()->addDays(5), // Sisa 5 hari + 'denda_per_hari' => 1000, + 'books' => [ + ['id' => 9, 'judul' => 'Senja, Hujan, & Cerita yang Telah Usai'], + ] + ], + [ + 'id_peminjaman' => 'PIN-202510-006', + 'peminjam' => 'Rina Marlina', + 'nomor_hp' => '081987654321', + 'tanggal_pinjam' => Carbon::now()->subDays(10), + 'tenggat_kembali' => Carbon::now()->subDays(3), // Terlambat 3 hari + 'denda_per_hari' => 1000, + 'books' => [ + ['id' => 4, 'judul' => 'Modul Pembelajaran Seni Budaya'], + ] + ], + [ + 'id_peminjaman' => 'PIN-202510-007', + 'peminjam' => 'Budi Santoso', + 'nomor_hp' => '082298765432', + 'tanggal_pinjam' => Carbon::now()->subDays(6), + 'tenggat_kembali' => Carbon::now()->addDays(1), // Sisa 1 hari + 'denda_per_hari' => 1000, + 'books' => [ + ['id' => 3, 'judul' => 'Modul Belajar Sosiologi'], + ['id' => 10, 'judul' => 'Hijrah itu Cinta'], + ] + ], + [ + 'id_peminjaman' => 'PIN-202510-008', + 'peminjam' => 'Putri Amelia', + 'nomor_hp' => '085743219876', + 'tanggal_pinjam' => Carbon::now()->subDays(18), + 'tenggat_kembali' => Carbon::now()->subDays(11), // Terlambat 11 hari + 'denda_per_hari' => 1000, + 'books' => [ + ['id' => 1, 'judul' => 'Modul Ajar IPAS'], + ] + ], + [ + 'id_peminjaman' => 'PIN-202510-009', + 'peminjam' => 'Ahmad Haziq', + 'nomor_hp' => '081345678902', + 'tanggal_pinjam' => Carbon::now()->subDays(3), + 'tenggat_kembali' => Carbon::now()->addDays(4), // Sisa 4 hari + 'denda_per_hari' => 1000, + 'books' => [ + ['id' => 7, 'judul' => 'The Last Spell Breather'], + ['id' => 8, 'judul' => 'Ayah'], + ] + ], + [ + 'id_peminjaman' => 'PIN-202510-010', + 'peminjam' => 'John Wick', + 'nomor_hp' => '082187654309', + 'tanggal_pinjam' => Carbon::now()->subDays(8), + 'tenggat_kembali' => Carbon::now()->subDays(1), // Terlambat 1 hari + 'denda_per_hari' => 1000, + 'books' => [ + ['id' => 5, 'judul' => 'Si Anak Pintar'], + ] + ], + [ + 'id_peminjaman' => 'PIN-202510-011', + 'peminjam' => 'Silvi Rahmawati', + 'nomor_hp' => '08123456789', + 'tanggal_pinjam' => Carbon::now()->subDays(5), + 'tenggat_kembali' => Carbon::now()->addDays(2), // Sisa 2 hari + 'denda_per_hari' => 1000, + 'books' => [ + ['id' => 2, 'judul' => 'Modul Ajar Pendidikan Pancasila'], + ['id' => 4, 'judul' => 'Modul Pembelajaran Seni Budaya'], + ] + ], + [ + 'id_peminjaman' => 'PIN-202510-012', + 'peminjam' => 'Andi Pratama', + 'nomor_hp' => '081556677889', + 'tanggal_pinjam' => Carbon::now()->subDays(20), + 'tenggat_kembali' => Carbon::now()->subDays(13), // Terlambat 13 hari + 'denda_per_hari' => 1000, + 'books' => [ + ['id' => 6, 'judul' => 'Matematika Dasar'], + ] + ], + [ + 'id_peminjaman' => 'PIN-202510-013', + 'peminjam' => 'Siti Nurhaliza', + 'nomor_hp' => '081998877665', + 'tanggal_pinjam' => Carbon::now()->subDays(1), + 'tenggat_kembali' => Carbon::now()->addDays(6), // Sisa 6 hari + 'denda_per_hari' => 1000, + 'books' => [ + ['id' => 9, 'judul' => 'Senja, Hujan, & Cerita yang Telah Usai'], + ['id' => 10, 'judul' => 'Hijrah itu Cinta'], + ] + ], + ]); + } + /** *Data Dummy untuk fitur Rekomendasi Pembelajaran. */ @@ -586,7 +748,7 @@ public static function getRiwayatOffline(): array 'deskripsi' => 'Buku ini berisi ajakan kepada anak-anak untuk semangat pergi ke sekolah dan menuntut ilmu.', 'kategori' => 'Pendidikan', 'tahun' => 2022, - 'keterangan' => 'Buku dikembalikan dalam kondisi baik.' + 'keterangan' => 'Buku dikembalikan dalam kondisi baik. Terdapat denda keterlambatan 2 hari: Rp 2.000,-' ] ] ], diff --git a/public/images/logo/icon.svg b/public/images/logo/icon.svg index 9da2a62..530d69d 100644 --- a/public/images/logo/icon.svg +++ b/public/images/logo/icon.svg @@ -1,5 +1 @@ - - - - - + \ No newline at end of file diff --git a/public/images/logo/name.svg b/public/images/logo/name.svg index a66afcc..f4b6a2f 100644 --- a/public/images/logo/name.svg +++ b/public/images/logo/name.svg @@ -1,4 +1 @@ - - - - + \ No newline at end of file diff --git a/resources/scss/_custom.scss b/resources/scss/_custom.scss index 511c785..68b90d2 100644 --- a/resources/scss/_custom.scss +++ b/resources/scss/_custom.scss @@ -114,9 +114,9 @@ body { background-color: map-get($grays, "light"); } -// Sidebar fixed di kiri dengan support minimize dan responsive +// Sidebar .sidebar { - width: 250px; + width: 270px; position: fixed; top: 0; bottom: 0; @@ -151,7 +151,7 @@ body { } .main-wrapper { - margin-left: 240px; + margin-left: 260px; } .sidebar.minimized { @@ -172,10 +172,9 @@ body { } } -// Mobile: sidebar tersembunyi, muncul dengan toggle @media (max-width: 991.98px) { .sidebar { - left: -250px; + left: -270px; } .sidebar.active { @@ -186,21 +185,35 @@ body { // Styling navigasi sidebar .sidebar .nav-link { font-weight: 500; - color: #555; margin: 0.3rem 0; border-radius: 0.5rem; display: flex; align-items: center; } -.sidebar .nav-link.active { - background: rgba(67, 94, 190, 0.1); - color: #5a5fba; - font-weight: 600; -} +.sidebar.bg-primary { + .nav-link { + color: rgba(255, 255, 255, 0.85); + i { color: rgba(255, 255, 255, 0.85); } -.sidebar .nav-link:hover:not(.active) { - background: #f8f9fa; + &.py-1 { + color: rgba(255, 255, 255, 0.7); + } + } + + .nav-link:hover:not(.active), + .nav-link.py-1:hover { + background: rgba(255, 255, 255, 0.05); + color: #fff; + i { color: #fff; } + } + + .nav-link.active { + background: rgba(255, 255, 255, 0.1); + color: #fff; + font-weight: 600; + i { color: #fff; } + } } .sidebar.minimized .nav-link .ms-auto { diff --git a/resources/scss/_variables.scss b/resources/scss/_variables.scss index 986f698..f3d2700 100644 --- a/resources/scss/_variables.scss +++ b/resources/scss/_variables.scss @@ -1,15 +1,16 @@ @use "sass:color"; -// =================================== -// VARIABLES & MAPS // =================================== +// ===================================// +// VARIABLES & MAPS +// ===================================// // Theme Colors Map $theme-colors: ( - "primary": #5a81fa, - "secondary": #5a5fba, + "primary": #0A4174, + "secondary": #49769F, "success": #14b8a6, - "info": #3b82f6, - "warning": #fb923c, + "info": #7BBDE8, + "warning": #fbb716, "danger": #f43f5e, ); diff --git a/resources/views/admin/peminjaman/create.blade.php b/resources/views/admin/peminjaman/create.blade.php new file mode 100644 index 0000000..5f0c954 --- /dev/null +++ b/resources/views/admin/peminjaman/create.blade.php @@ -0,0 +1,291 @@ + + @section('page-title', $pageTitle) + +
+ + + +

Formulir Peminjaman Manual

+
+ +
@csrf +
+ +
+
+
+ +
Data Peminjaman
+
+ + + +
+ +
+
+ + +
+
+ + +
+
+ +
+ +
+
Buku Terpilih
+ 0 Buku +
+ +
+
+ +

Belum ada buku yang dipilih.

+
+
+ +
+ +
+ +
+ +
+
+
+ +
+
+
+
Pilih Buku
+
+
+
+
+ + +
+
+ +
+ @foreach ($daftarBuku as $buku) +
+ +
+ Cover +
+
{{ $buku['judul'] }}
+

{{ $buku['penulis'] }}

+ {{ $buku['kategori'] }} +
+
+ +
+
+
+ @endforeach +
+
+
+
+
+
+ + + @push('scripts') + + @endpush +
\ No newline at end of file diff --git a/resources/views/admin/peminjaman/index.blade.php b/resources/views/admin/peminjaman/index.blade.php new file mode 100644 index 0000000..fc3aa3f --- /dev/null +++ b/resources/views/admin/peminjaman/index.blade.php @@ -0,0 +1,280 @@ + + @section('page-title', $pageTitle) + +
+
+

Manajemen Peminjaman

+

Daftar ini hanya menampilkan buku yang masih berstatus "Dipinjam".

+
+ + Buat Peminjaman Manual + +
+ +
+
+
+ + + + + + + + + + + + + + + @php + $now = \Carbon\Carbon::now(); + $counter = 1; + @endphp + @forelse ($peminjamanAktif as $transaksi) + @php + $tenggat = $transaksi['tenggat_kembali']; + $isTerlambat = $now->startOfDay()->isAfter($tenggat->startOfDay()); + $isHariIni = $now->startOfDay()->isSameDay($tenggat->startOfDay()); + $selisihHari = $now->startOfDay()->diffInDays($tenggat->startOfDay(), false); + + $statusKeterlambatan = ''; + $dendaKeterlambatan = 0; + $statusClass = ''; + + if ($isTerlambat) { + $hariTerlambat = $tenggat->startOfDay()->diffInDays($now->startOfDay()); + $statusKeterlambatan = "Terlambat $hariTerlambat hari"; + $dendaKeterlambatan = $hariTerlambat * $transaksi['denda_per_hari']; + $statusClass = 'badge rounded-pill bg-danger-subtle text-danger-emphasis'; + } elseif ($isHariIni) { + $statusKeterlambatan = 'Hari ini'; + $statusClass = 'badge rounded-pill bg-warning-subtle text-warning-emphasis'; + } else { + $sisaHari = abs($selisihHari); + $statusKeterlambatan = "Sisa $sisaHari hari"; + $statusClass = 'badge rounded-pill bg-success-subtle text-success-emphasis'; + } + @endphp + + @foreach ($transaksi['books'] as $index => $buku) + + + + + + + + + + + + + @endforeach + @empty + + + + @endforelse + +
NOID PEMINJAMANNAMA PEMINJAMJUDUL BUKUTGL. PINJAMTENGGAT KEMBALISTATUSAKSI
{{ $counter++ }} + {{ $transaksi['id_peminjaman'] }} + {{ $transaksi['peminjam'] }}{{ $buku['judul'] }}{{ $transaksi['tanggal_pinjam']->format('d/m/Y') }}{{ $transaksi['tenggat_kembali']->format('d/m/Y') }} + {{ $statusKeterlambatan }} + + +
+
+ +

Tidak ada data peminjaman yang sedang aktif.

+
+
+
+
+
+ + @push('scripts') + + @endpush + +
\ No newline at end of file diff --git a/resources/views/auth/admin-login.blade.php b/resources/views/auth/admin-login.blade.php index 2c0bb86..701a42a 100644 --- a/resources/views/auth/admin-login.blade.php +++ b/resources/views/auth/admin-login.blade.php @@ -20,10 +20,10 @@
- - - -
+ + + +
diff --git a/resources/views/auth/login.blade.php b/resources/views/auth/login.blade.php index f0f7d71..2f56f69 100644 --- a/resources/views/auth/login.blade.php +++ b/resources/views/auth/login.blade.php @@ -17,7 +17,7 @@ @if ($role == 'siswa') Masukan NISN dan kata sandi Anda. @else - Masukan Email dan kata sandi Anda. + Masukan NIP dan kata sandi Anda. @endif

@@ -27,13 +27,12 @@
- {{-- <-- Pastikan ini ada --}} -
+ @else
- - - {{-- <-- Pastikan ini ada --}} + + +
@endif diff --git a/resources/views/components/book-card.blade.php b/resources/views/components/book-card.blade.php index d06e037..1c9a539 100644 --- a/resources/views/components/book-card.blade.php +++ b/resources/views/components/book-card.blade.php @@ -1,6 +1,6 @@ @props(['buku']) -
+
diff --git a/resources/views/dashboard.blade.php b/resources/views/dashboard.blade.php index 2206ef6..07d5df8 100644 --- a/resources/views/dashboard.blade.php +++ b/resources/views/dashboard.blade.php @@ -192,8 +192,7 @@ class="badge bg-{{ $item['type'] }}-soft text-{{ $item['type'] }} rounded-pill p @forelse($bukuPinjamOffline as $buku)
-
- +
Sisa: {{ $buku['sisa_hari'] }} hari
@@ -234,10 +233,10 @@ class="badge bg-{{ $item['type'] }}-soft text-{{ $item['type'] }} rounded-pill p
- Progress - {{ $buku['progress'] }}% + Progress {{ $buku['progress'] }}%
-
+
diff --git a/resources/views/layouts/app.blade.php b/resources/views/layouts/app.blade.php index 77ad5b7..da80987 100644 --- a/resources/views/layouts/app.blade.php +++ b/resources/views/layouts/app.blade.php @@ -20,6 +20,8 @@ + + @@ -98,6 +100,9 @@ class="notification-item d-flex my-1 rounded-3 text-body text-decoration-none @i + + + @endpush - + \ No newline at end of file diff --git a/resources/views/riwayat/online.blade.php b/resources/views/riwayat/online.blade.php index d9f8b7e..6f1efab 100644 --- a/resources/views/riwayat/online.blade.php +++ b/resources/views/riwayat/online.blade.php @@ -30,7 +30,7 @@ {{ $transaksi['status'] }} -