Fix: role petugas perpus
This commit is contained in:
parent
1764c5f9f4
commit
22d0c2f645
|
|
@ -83,6 +83,48 @@ public function create()
|
|||
]);
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$validated = $request->validate([
|
||||
'peminjam_id' => 'required|exists:users,id',
|
||||
'tanggal_pinjam' => 'required|date',
|
||||
'tanggal_kembali' => 'required|date|after:tanggal_pinjam',
|
||||
'buku_ids' => 'required|array|min:1|max:2',
|
||||
'buku_ids.*' => 'exists:books,id',
|
||||
]);
|
||||
|
||||
\DB::beginTransaction();
|
||||
try {
|
||||
foreach ($validated['buku_ids'] as $bookId) {
|
||||
$book = Book::findOrFail($bookId);
|
||||
|
||||
// Check if book is available
|
||||
if ($book->status !== 'Tersedia') {
|
||||
throw new \Exception("Buku '{$book->judul}' tidak tersedia.");
|
||||
}
|
||||
|
||||
// Create loan record
|
||||
Loan::create([
|
||||
'user_id' => $validated['peminjam_id'],
|
||||
'book_id' => $bookId,
|
||||
'loan_code' => 'LOAN-' . date('Ymd') . '-' . strtoupper(substr(md5(uniqid()), 0, 6)),
|
||||
'borrowed_at' => $validated['tanggal_pinjam'],
|
||||
'due_at' => $validated['tanggal_kembali'],
|
||||
'status' => 'Dipinjam',
|
||||
]);
|
||||
|
||||
// Update book status
|
||||
$book->update(['status' => 'Dipinjam']);
|
||||
}
|
||||
|
||||
\DB::commit();
|
||||
return redirect()->route('admin.peminjaman.index')->with('success', 'Peminjaman berhasil dibuat.');
|
||||
} catch (\Exception $e) {
|
||||
\DB::rollBack();
|
||||
return back()->withErrors(['error' => $e->getMessage()])->withInput();
|
||||
}
|
||||
}
|
||||
|
||||
public function dendaIndex()
|
||||
{
|
||||
$now = Carbon::now();
|
||||
|
|
|
|||
|
|
@ -54,4 +54,42 @@ public function edit($id)
|
|||
'rekomendasi' => $rekomendasi
|
||||
]);
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$validated = $request->validate([
|
||||
'judul' => 'required|string|max:255',
|
||||
'kategori' => 'required|string|max:100',
|
||||
'youtube_link' => 'required|url',
|
||||
'deskripsi' => 'required|string',
|
||||
]);
|
||||
|
||||
Recommendation::create($validated);
|
||||
|
||||
return redirect()->route('admin.rekomendasi.index')->with('success', 'Rekomendasi berhasil ditambahkan.');
|
||||
}
|
||||
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
$rekomendasi = Recommendation::findOrFail($id);
|
||||
|
||||
$validated = $request->validate([
|
||||
'judul' => 'required|string|max:255',
|
||||
'kategori' => 'required|string|max:100',
|
||||
'youtube_link' => 'required|url',
|
||||
'deskripsi' => 'required|string',
|
||||
]);
|
||||
|
||||
$rekomendasi->update($validated);
|
||||
|
||||
return redirect()->route('admin.rekomendasi.index')->with('success', 'Rekomendasi berhasil diperbarui.');
|
||||
}
|
||||
|
||||
public function destroy($id)
|
||||
{
|
||||
$rekomendasi = Recommendation::findOrFail($id);
|
||||
$rekomendasi->delete();
|
||||
|
||||
return redirect()->route('admin.rekomendasi.index')->with('success', 'Rekomendasi berhasil dihapus.');
|
||||
}
|
||||
}
|
||||
|
|
@ -57,5 +57,69 @@ public function edit($id)
|
|||
]);
|
||||
}
|
||||
|
||||
// You might also want to implement store, update, destroy here later
|
||||
public function store(Request $request)
|
||||
{
|
||||
$validated = $request->validate([
|
||||
'judul' => 'required|string|max:255',
|
||||
'penulis' => 'required|string|max:255',
|
||||
'category_id' => 'required|exists:categories,id',
|
||||
'tahun' => 'required|integer',
|
||||
'kode_buku' => 'nullable|string',
|
||||
'tipe_akses' => 'required|array',
|
||||
'cover' => 'nullable|image|mimes:jpeg,png,jpg|max:2048',
|
||||
'file_pdf' => 'nullable|mimes:pdf|max:10240',
|
||||
]);
|
||||
|
||||
if ($request->hasFile('cover')) {
|
||||
$path = $request->file('cover')->store('covers', 'public');
|
||||
$validated['cover'] = 'storage/' . $path;
|
||||
}
|
||||
|
||||
if ($request->hasFile('file_pdf')) {
|
||||
$path = $request->file('file_pdf')->store('books', 'local');
|
||||
$validated['file_pdf'] = basename($path);
|
||||
}
|
||||
|
||||
Book::create($validated);
|
||||
|
||||
return redirect()->route('admin.buku.index')->with('success', 'Buku berhasil ditambahkan.');
|
||||
}
|
||||
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
$buku = Book::findOrFail($id);
|
||||
|
||||
$validated = $request->validate([
|
||||
'judul' => 'required|string|max:255',
|
||||
'penulis' => 'required|string|max:255',
|
||||
'category_id' => 'required|exists:categories,id',
|
||||
'tahun' => 'required|integer',
|
||||
'kode_buku' => 'nullable|string',
|
||||
'tipe_akses' => 'required|array',
|
||||
'cover' => 'nullable|image|mimes:jpeg,png,jpg|max:2048',
|
||||
'file_pdf' => 'nullable|mimes:pdf|max:10240',
|
||||
]);
|
||||
|
||||
if ($request->hasFile('cover')) {
|
||||
$path = $request->file('cover')->store('covers', 'public');
|
||||
$validated['cover'] = 'storage/' . $path;
|
||||
}
|
||||
|
||||
if ($request->hasFile('file_pdf')) {
|
||||
$path = $request->file('file_pdf')->store('books', 'local');
|
||||
$validated['file_pdf'] = basename($path);
|
||||
}
|
||||
|
||||
$buku->update($validated);
|
||||
|
||||
return redirect()->route('admin.buku.index')->with('success', 'Buku berhasil diperbarui.');
|
||||
}
|
||||
|
||||
public function destroy($id)
|
||||
{
|
||||
$buku = Book::findOrFail($id);
|
||||
$buku->delete();
|
||||
|
||||
return redirect()->route('admin.buku.index')->with('success', 'Buku berhasil dihapus.');
|
||||
}
|
||||
}
|
||||
|
|
@ -42,4 +42,52 @@ public function edit($id)
|
|||
'pengumuman' => $pengumuman,
|
||||
]);
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$validated = $request->validate([
|
||||
'title' => 'required|string|max:255',
|
||||
'content' => 'required|string',
|
||||
'type' => 'required|in:info,warning,success,danger',
|
||||
'icon' => 'nullable|string|max:50',
|
||||
]);
|
||||
|
||||
// Provide default icon if not provided
|
||||
if (!isset($validated['icon']) || empty($validated['icon'])) {
|
||||
$validated['icon'] = 'bi-megaphone';
|
||||
}
|
||||
|
||||
Announcement::create($validated);
|
||||
|
||||
return redirect()->route('admin.pengumuman.index')->with('success', 'Pengumuman berhasil ditambahkan.');
|
||||
}
|
||||
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
$pengumuman = Announcement::findOrFail($id);
|
||||
|
||||
$validated = $request->validate([
|
||||
'title' => 'required|string|max:255',
|
||||
'content' => 'required|string',
|
||||
'type' => 'required|in:info,warning,success,danger',
|
||||
'icon' => 'nullable|string|max:50',
|
||||
]);
|
||||
|
||||
// Provide default icon if not provided
|
||||
if (!isset($validated['icon']) || empty($validated['icon'])) {
|
||||
$validated['icon'] = 'bi-megaphone';
|
||||
}
|
||||
|
||||
$pengumuman->update($validated);
|
||||
|
||||
return redirect()->route('admin.pengumuman.index')->with('success', 'Pengumuman berhasil diperbarui.');
|
||||
}
|
||||
|
||||
public function destroy($id)
|
||||
{
|
||||
$pengumuman = Announcement::findOrFail($id);
|
||||
$pengumuman->delete();
|
||||
|
||||
return redirect()->route('admin.pengumuman.index')->with('success', 'Pengumuman berhasil dihapus.');
|
||||
}
|
||||
}
|
||||
|
|
@ -5,6 +5,7 @@
|
|||
use App\Http\Controllers\Controller;
|
||||
use App\Models\User;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
|
||||
class UserController extends Controller
|
||||
{
|
||||
|
|
@ -40,5 +41,58 @@ public function edit($id)
|
|||
]);
|
||||
}
|
||||
|
||||
// You might also want to implement store, update, destroy here later
|
||||
public function store(Request $request)
|
||||
{
|
||||
$validated = $request->validate([
|
||||
'nama_lengkap' => 'required|string|max:255',
|
||||
'email' => 'required|email|unique:users,email',
|
||||
'nomor_induk' => 'nullable|string|max:50',
|
||||
'phone' => 'nullable|string|max:20',
|
||||
'role' => 'required|in:siswa,guru,penjaga perpus',
|
||||
'kelas' => 'nullable|string|max:50',
|
||||
'password' => 'required|string|min:8|confirmed',
|
||||
]);
|
||||
|
||||
$validated['password'] = Hash::make($validated['password']);
|
||||
$validated['name'] = $validated['nama_lengkap']; // Set name field for compatibility
|
||||
|
||||
User::create($validated);
|
||||
|
||||
return redirect()->route('admin.pengguna.index')->with('success', 'Pengguna berhasil ditambahkan.');
|
||||
}
|
||||
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
$pengguna = User::findOrFail($id);
|
||||
|
||||
$validated = $request->validate([
|
||||
'nama_lengkap' => 'required|string|max:255',
|
||||
'email' => 'required|email|unique:users,email,' . $id,
|
||||
'nomor_induk' => 'nullable|string|max:50',
|
||||
'phone' => 'nullable|string|max:20',
|
||||
'role' => 'required|in:siswa,guru,penjaga perpus',
|
||||
'kelas' => 'nullable|string|max:50',
|
||||
'password' => 'nullable|string|min:8|confirmed',
|
||||
]);
|
||||
|
||||
if ($request->filled('password')) {
|
||||
$validated['password'] = Hash::make($validated['password']);
|
||||
} else {
|
||||
unset($validated['password']);
|
||||
}
|
||||
|
||||
$validated['name'] = $validated['nama_lengkap']; // Set name field for compatibility
|
||||
|
||||
$pengguna->update($validated);
|
||||
|
||||
return redirect()->route('admin.pengguna.index')->with('success', 'Pengguna berhasil diperbarui.');
|
||||
}
|
||||
|
||||
public function destroy($id)
|
||||
{
|
||||
$pengguna = User::findOrFail($id);
|
||||
$pengguna->delete();
|
||||
|
||||
return redirect()->route('admin.pengguna.index')->with('success', 'Pengguna berhasil dihapus.');
|
||||
}
|
||||
}
|
||||
|
|
@ -13,46 +13,50 @@
|
|||
<div class="card border-0 shadow-sm">
|
||||
<div class="card-body p-4">
|
||||
<div class="card-body">
|
||||
<form action="#" method="POST">
|
||||
{{-- Form ini tidak akan berfungsi karena tidak ada backend --}}
|
||||
<form action="{{ route('admin.buku.store') }}" method="POST" enctype="multipart/form-data">
|
||||
@csrf
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
<div class="mb-3">
|
||||
<label for="judul" class="form-label">Judul Buku</label>
|
||||
<input type="text" class="form-control" id="judul"
|
||||
placeholder="Masukkan judul buku">
|
||||
<input type="text" name="judul" class="form-control" id="judul"
|
||||
placeholder="Masukkan judul buku" required>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="penulis" class="form-label">Penulis</label>
|
||||
<input type="text" class="form-control" id="penulis"
|
||||
placeholder="Masukkan nama penulis">
|
||||
<input type="text" name="penulis" class="form-control" id="penulis"
|
||||
placeholder="Masukkan nama penulis" required>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-4 mb-3">
|
||||
<label for="kategori" class="form-label">Kategori</label>
|
||||
<input type="text" class="form-control" id="kategori"
|
||||
placeholder="Contoh: Fiksi, Sains">
|
||||
<label for="category_id" class="form-label">Kategori</label>
|
||||
<select name="category_id" class="form-select" id="category_id" required>
|
||||
<option value="" disabled selected>Pilih Kategori</option>
|
||||
@foreach($categories as $category)
|
||||
<option value="{{ $category->id }}">{{ $category->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-4 mb-3">
|
||||
<label for="tahun" class="form-label">Tahun Terbit</label>
|
||||
<input type="number" class="form-control" id="tahun"
|
||||
placeholder="Contoh: 2024">
|
||||
<input type="number" name="tahun" class="form-control" id="tahun"
|
||||
placeholder="Contoh: 2024" required>
|
||||
</div>
|
||||
<div class="col-md-4 mb-3">
|
||||
<label for="kode_buku" class="form-label">Kode Buku</label>
|
||||
<input type="number" class="form-control" id="kode_buku"
|
||||
<input type="text" name="kode_buku" class="form-control" id="kode_buku"
|
||||
placeholder="Contoh: 330">
|
||||
</div>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Tipe Akses</label>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" id="tipe_offline">
|
||||
<input class="form-check-input" type="checkbox" name="tipe_akses[]" value="offline" id="tipe_offline">
|
||||
<label class="form-check-label" for="tipe_offline">Peminjaman
|
||||
Offline</label>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" id="tipe_online">
|
||||
<input class="form-check-input" type="checkbox" name="tipe_akses[]" value="online" id="tipe_online">
|
||||
<label class="form-check-label" for="tipe_online">Baca Online</label>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -60,11 +64,11 @@
|
|||
<div class="col-md-4">
|
||||
<div class="mb-3">
|
||||
<label for="cover" class="form-label">Cover Buku</label>
|
||||
<input type="file" class="form-control" id="cover">
|
||||
<input type="file" name="cover" class="form-control" id="cover">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="file_pdf" class="form-label">File PDF (untuk buku online)</label>
|
||||
<input type="file" class="form-control" id="file_pdf">
|
||||
<input type="file" name="file_pdf" class="form-control" id="file_pdf">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -13,60 +13,64 @@
|
|||
<div class="card border-0 shadow-sm">
|
||||
<div class="card-body p-4">
|
||||
<div class="card-body">
|
||||
<form action="#" method="POST">
|
||||
{{-- Form ini tidak akan berfungsi karena tidak ada backend --}}
|
||||
<form action="{{ route('admin.buku.update', $buku->id) }}" method="POST" enctype="multipart/form-data">
|
||||
@csrf
|
||||
@method('PUT')
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
<div class="mb-3">
|
||||
<label for="judul" class="form-label">Judul Buku</label>
|
||||
<input type="text" class="form-control" id="judul"
|
||||
value="{{ $buku['judul'] }}">
|
||||
<input type="text" name="judul" class="form-control" id="judul"
|
||||
value="{{ old('judul', $buku->judul) }}" required>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="penulis" class="form-label">Penulis</label>
|
||||
<input type="text" class="form-control" id="penulis"
|
||||
value="{{ $buku['penulis'] }}">
|
||||
<input type="text" name="penulis" class="form-control" id="penulis"
|
||||
value="{{ old('penulis', $buku->penulis) }}" required>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-6 mb-3">
|
||||
<label for="kategori" class="form-label">Kategori</label>
|
||||
<input type="text" class="form-control" id="kategori"
|
||||
value="{{ $buku['kategori'] }}">
|
||||
<label for="category_id" class="form-label">Kategori</label>
|
||||
<select name="category_id" class="form-select" id="category_id" required>
|
||||
@foreach($categories as $category)
|
||||
<option value="{{ $category->id }}" {{ old('category_id', $buku->category_id) == $category->id ? 'selected' : '' }}>
|
||||
{{ $category->name }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-6 mb-3">
|
||||
<label for="tahun" class="form-label">Tahun Terbit</label>
|
||||
<input type="number" class="form-control" id="tahun"
|
||||
value="{{ $buku['tahun'] }}">
|
||||
<input type="number" name="tahun" class="form-control" id="tahun"
|
||||
value="{{ old('tahun', $buku->tahun) }}" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@php
|
||||
$tipe_akses = is_array($buku['tipe_akses'])
|
||||
? $buku['tipe_akses']
|
||||
: [$buku['tipe_akses']];
|
||||
$tipe_akses = is_array($buku->tipe_akses)
|
||||
? $buku->tipe_akses
|
||||
: [$buku->tipe_akses];
|
||||
$isOffline = in_array('offline', $tipe_akses);
|
||||
@endphp
|
||||
|
||||
{{-- Field Kode Buku - Hanya untuk Buku Offline --}}
|
||||
@if($isOffline)
|
||||
<div class="mb-3">
|
||||
<div class="mb-3" id="kodeBukuWrapper">
|
||||
<label for="kode_buku" class="form-label">Kode Buku</label>
|
||||
<input type="text" class="form-control" id="kode_buku"
|
||||
value="{{ $buku['kode_buku'] ?? '' }}" placeholder="Masukkan kode buku">
|
||||
<input type="text" name="kode_buku" class="form-control" id="kode_buku"
|
||||
value="{{ old('kode_buku', $buku->kode_buku) }}" placeholder="Masukkan kode buku">
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Tipe Akses (Tidak dapat diubah)</label>
|
||||
<label class="form-label">Tipe Akses</label>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" id="tipe_offline"
|
||||
@if (in_array('offline', $tipe_akses)) checked @endif disabled>
|
||||
<input class="form-check-input" type="checkbox" name="tipe_akses[]" value="offline" id="tipe_offline"
|
||||
@if (in_array('offline', $tipe_akses)) checked @endif>
|
||||
<label class="form-check-label" for="tipe_offline">Peminjaman
|
||||
Offline</label>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" id="tipe_online"
|
||||
@if (in_array('online', $tipe_akses)) checked @endif disabled>
|
||||
<input class="form-check-input" type="checkbox" name="tipe_akses[]" value="online" id="tipe_online"
|
||||
@if (in_array('online', $tipe_akses)) checked @endif>
|
||||
<label class="form-check-label" for="tipe_online">Baca Online</label>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -75,10 +79,14 @@
|
|||
<div class="col-md-4">
|
||||
<div class="mb-3">
|
||||
<label for="cover" class="form-label">Cover Buku</label>
|
||||
<input type="file" class="form-control" id="cover">
|
||||
<img src="{{ asset($buku['cover']) }}" alt="Cover saat ini"
|
||||
<input type="file" name="cover" class="form-control" id="cover">
|
||||
<img src="{{ asset($buku->cover) }}" alt="Cover saat ini"
|
||||
class="img-thumbnail mt-2" width="150">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="file_pdf" class="form-label">Update File PDF (Opsional)</label>
|
||||
<input type="file" name="file_pdf" class="form-control" id="file_pdf">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
|
|
|
|||
|
|
@ -8,7 +8,18 @@
|
|||
<h3 class="my-0 fw-bold">Formulir Peminjaman Manual</h3>
|
||||
</div>
|
||||
|
||||
<form action="#" method="POST" id="formPeminjaman" autocomplete="off"> @csrf
|
||||
<form action="{{ route('admin.peminjaman.store') }}" method="POST" id="formPeminjaman" autocomplete="off"> @csrf
|
||||
@if ($errors->any())
|
||||
<div class="alert alert-danger alert-dismissible fade show" role="alert">
|
||||
<strong>Terjadi kesalahan:</strong>
|
||||
<ul class="mb-0">
|
||||
@foreach ($errors->all() as $error)
|
||||
<li>{{ $error }}</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="alert"></button>
|
||||
</div>
|
||||
@endif
|
||||
<div class="row g-4">
|
||||
|
||||
<div class="col-lg-7">
|
||||
|
|
|
|||
|
|
@ -12,37 +12,47 @@
|
|||
<div class="card border-0 shadow-sm">
|
||||
<div class="card-body p-4">
|
||||
<div class="card-body">
|
||||
<form action="#" method="POST">
|
||||
<form action="{{ route('admin.pengguna.store') }}" method="POST">
|
||||
@csrf
|
||||
<div class="mb-3">
|
||||
<label for="nama_lengkap" class="form-label">Nama Lengkap</label>
|
||||
<input type="text" class="form-control" id="nama_lengkap"
|
||||
placeholder="Masukkan nama lengkap">
|
||||
<input type="text" name="nama_lengkap" class="form-control" id="nama_lengkap"
|
||||
placeholder="Masukkan nama lengkap" required>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="email" class="form-label">Email</label>
|
||||
<input type="email" class="form-control" id="email"
|
||||
placeholder="Masukkan alamat email">
|
||||
<input type="email" name="email" class="form-control" id="email"
|
||||
placeholder="Masukkan alamat email" required>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="nisn" class="form-label">NISN (jika siswa)</label>
|
||||
<input type="text" class="form-control" id="nisn" placeholder="Masukkan NISN">
|
||||
<label for="nomor_induk" class="form-label">Nomor Induk (NISN/NUPTK)</label>
|
||||
<input type="text" name="nomor_induk" class="form-control" id="nomor_induk" placeholder="Masukkan NISN atau NUPTK">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="phone" class="form-label">Nomor HP</label>
|
||||
<input type="text" name="phone" class="form-control" id="phone" placeholder="Masukkan nomor HP">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="kelas" class="form-label">Kelas (jika siswa)</label>
|
||||
<input type="text" name="kelas" class="form-control" id="kelas" placeholder="Contoh: X IPA 1">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="role" class="form-label">Role</label>
|
||||
<select class="form-select" id="role">
|
||||
<option selected>Pilih role...</option>
|
||||
<select name="role" class="form-select" id="role" required>
|
||||
<option value="" selected>Pilih role...</option>
|
||||
<option value="siswa">Siswa</option>
|
||||
<option value="guru">Guru</option>
|
||||
<option value="penjaga perpus">Penjaga Perpus</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-6 mb-3">
|
||||
<label for="password" class="form-label">Password</label>
|
||||
<input type="password" class="form-control" id="password">
|
||||
<input type="password" name="password" class="form-control" id="password" required>
|
||||
</div>
|
||||
<div class="col-md-6 mb-3">
|
||||
<label for="password_confirmation" class="form-label">Konfirmasi Password</label>
|
||||
<input type="password" class="form-control" id="password_confirmation">
|
||||
<input type="password" name="password_confirmation" class="form-control" id="password_confirmation" required>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
|
|
|
|||
|
|
@ -12,41 +12,55 @@
|
|||
<div class="card border-0 shadow-sm">
|
||||
<div class="card-body p-4">
|
||||
<div class="card-body">
|
||||
<form action="#" method="POST">
|
||||
<form action="{{ route('admin.pengguna.update', $pengguna->id) }}" method="POST">
|
||||
@csrf
|
||||
@method('PUT')
|
||||
<div class="mb-3">
|
||||
<label for="nama_lengkap" class="form-label">Nama Lengkap</label>
|
||||
<input type="text" class="form-control" id="nama_lengkap"
|
||||
value="{{ $pengguna['nama_lengkap'] }}">
|
||||
<input type="text" name="nama_lengkap" class="form-control" id="nama_lengkap"
|
||||
value="{{ old('nama_lengkap', $pengguna->nama_lengkap) }}" required>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="email" class="form-label">Email</label>
|
||||
<input type="email" class="form-control" id="email"
|
||||
value="{{ $pengguna['email'] }}">
|
||||
<input type="email" name="email" class="form-control" id="email"
|
||||
value="{{ old('email', $pengguna->email) }}" required>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="nisn" class="form-label">NISN (jika siswa)</label>
|
||||
<input type="text" class="form-control" id="nisn"
|
||||
value="{{ $pengguna['nisn'] ?? '' }}">
|
||||
<label for="nomor_induk" class="form-label">Nomor Induk (NISN/NUPTK)</label>
|
||||
<input type="text" name="nomor_induk" class="form-control" id="nomor_induk"
|
||||
value="{{ old('nomor_induk', $pengguna->nomor_induk) }}">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="phone" class="form-label">Nomor HP</label>
|
||||
<input type="text" name="phone" class="form-control" id="phone"
|
||||
value="{{ old('phone', $pengguna->phone) }}">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="kelas" class="form-label">Kelas (jika siswa)</label>
|
||||
<input type="text" name="kelas" class="form-control" id="kelas"
|
||||
value="{{ old('kelas', $pengguna->kelas) }}">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="role" class="form-label">Role</label>
|
||||
<select class="form-select" id="role">
|
||||
<option>Pilih role...</option>
|
||||
<option value="siswa" @if ($pengguna['role'] == 'siswa') selected @endif>Siswa
|
||||
<select name="role" class="form-select" id="role" required>
|
||||
<option value="">Pilih role...</option>
|
||||
<option value="siswa" @if (old('role', $pengguna->role) == 'siswa') selected @endif>Siswa
|
||||
</option>
|
||||
<option value="penjaga perpus" @if ($pengguna['role'] == 'penjaga perpus') selected @endif>
|
||||
<option value="guru" @if (old('role', $pengguna->role) == 'guru') selected @endif>Guru
|
||||
</option>
|
||||
<option value="penjaga perpus" @if (old('role', $pengguna->role) == 'penjaga perpus') selected @endif>
|
||||
Penjaga Perpus</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-6 mb-3">
|
||||
<label for="password" class="form-label">Password Baru</label>
|
||||
<input type="password" class="form-control" id="password"
|
||||
<input type="password" name="password" class="form-control" id="password"
|
||||
placeholder="Kosongkan jika tidak diubah">
|
||||
</div>
|
||||
<div class="col-md-6 mb-3">
|
||||
<label for="password_confirmation" class="form-label">Konfirmasi Password</label>
|
||||
<input type="password" class="form-control" id="password_confirmation">
|
||||
<input type="password" name="password_confirmation" class="form-control" id="password_confirmation">
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
|
|
|
|||
|
|
@ -12,27 +12,26 @@
|
|||
<div class="card border-0 shadow-sm">
|
||||
<div class="card-body p-4">
|
||||
<div class="card-body">
|
||||
<form action="#" method="POST">
|
||||
{{-- Form ini tidak akan berfungsi karena tidak ada backend --}}
|
||||
<form action="{{ route('admin.pengumuman.store') }}" method="POST">
|
||||
@csrf
|
||||
<div class="mb-3">
|
||||
<label for="judul" class="form-label">Judul Pengumuman</label>
|
||||
<input type="text" class="form-control" id="judul"
|
||||
placeholder="Masukkan judul pengumuman">
|
||||
<label for="title" class="form-label">Judul Pengumuman</label>
|
||||
<input type="text" name="title" class="form-control" id="title"
|
||||
placeholder="Masukkan judul pengumuman" required>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="tipe" class="form-label">Tipe Pengumuman</label>
|
||||
<select class="form-select" id="tipe">
|
||||
<option selected>Pilih tipe...</option>
|
||||
<label for="type" class="form-label">Tipe Pengumuman</label>
|
||||
<select name="type" class="form-select" id="type" required>
|
||||
<option value="">Pilih tipe...</option>
|
||||
<option value="info">Info</option>
|
||||
<option value="success">Success</option>
|
||||
<option value="warning">Warning</option>
|
||||
<option value="danger">Danger</option>
|
||||
<option value="secondary">Secondary</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="content" class="form-label">Isi Pengumuman</label>
|
||||
<textarea class="form-control" id="content" rows="5" placeholder="Tulis isi pengumuman di sini..."></textarea>
|
||||
<textarea name="content" class="form-control" id="content" rows="5" placeholder="Tulis isi pengumuman di sini..." required></textarea>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="d-flex justify-content-end">
|
||||
|
|
|
|||
|
|
@ -12,32 +12,31 @@
|
|||
<div class="card border-0 shadow-sm">
|
||||
<div class="card-body p-4">
|
||||
<div class="card-body">
|
||||
<form action="#" method="POST">
|
||||
{{-- Form ini tidak akan berfungsi karena tidak ada backend --}}
|
||||
<form action="{{ route('admin.pengumuman.update', $pengumuman->id) }}" method="POST">
|
||||
@csrf
|
||||
@method('PUT')
|
||||
<div class="mb-3">
|
||||
<label for="judul" class="form-label">Judul Pengumuman</label>
|
||||
<input type="text" class="form-control" id="judul"
|
||||
value="{{ $pengumuman['title'] }}">
|
||||
<label for="title" class="form-label">Judul Pengumuman</label>
|
||||
<input type="text" name="title" class="form-control" id="title"
|
||||
value="{{ old('title', $pengumuman->title) }}" required>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="tipe" class="form-label">Tipe Pengumuman</label>
|
||||
<select class="form-select" id="tipe">
|
||||
<option>Pilih tipe...</option>
|
||||
<option value="info" @if ($pengumuman['type'] == 'info') selected @endif>Info
|
||||
<label for="type" class="form-label">Tipe Pengumuman</label>
|
||||
<select name="type" class="form-select" id="type" required>
|
||||
<option value="">Pilih tipe...</option>
|
||||
<option value="info" @if (old('type', $pengumuman->type) == 'info') selected @endif>Info
|
||||
</option>
|
||||
<option value="success" @if ($pengumuman['type'] == 'success') selected @endif>Success
|
||||
<option value="success" @if (old('type', $pengumuman->type) == 'success') selected @endif>Success
|
||||
</option>
|
||||
<option value="warning" @if ($pengumuman['type'] == 'warning') selected @endif>Warning
|
||||
<option value="warning" @if (old('type', $pengumuman->type) == 'warning') selected @endif>Warning
|
||||
</option>
|
||||
<option value="danger" @if ($pengumuman['type'] == 'danger') selected @endif>Danger
|
||||
<option value="danger" @if (old('type', $pengumuman->type) == 'danger') selected @endif>Danger
|
||||
</option>
|
||||
<option value="secondary" @if ($pengumuman['type'] == 'secondary') selected @endif>
|
||||
Secondary</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="content" class="form-label">Isi Pengumuman</label>
|
||||
<textarea class="form-control" id="content" rows="5">{{ $pengumuman['content'] }}</textarea>
|
||||
<textarea name="content" class="form-control" id="content" rows="5" required>{{ old('content', $pengumuman->content) }}</textarea>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="d-flex justify-content-end">
|
||||
|
|
|
|||
|
|
@ -12,15 +12,16 @@
|
|||
<div class="card border-0 shadow-sm">
|
||||
<div class="card-body p-4">
|
||||
<div class="card-body">
|
||||
<form action="#" method="POST">
|
||||
<form action="{{ route('admin.rekomendasi.store') }}" method="POST">
|
||||
@csrf
|
||||
<div class="mb-3"><label class="form-label">Judul</label><input type="text"
|
||||
class="form-control"></div>
|
||||
name="judul" class="form-control" required></div>
|
||||
<div class="mb-3"><label class="form-label">Kategori</label><input type="text"
|
||||
class="form-control" placeholder="Contoh: Teknologi, Sains, Biologi"></div>
|
||||
name="kategori" class="form-control" placeholder="Contoh: Teknologi, Sains, Biologi" required></div>
|
||||
<div class="mb-3"><label class="form-label">Link YouTube</label><input type="url"
|
||||
class="form-control" placeholder="https://www.youtube.com/watch?v=xxxxxx"></div>
|
||||
name="youtube_link" class="form-control" placeholder="https://www.youtube.com/watch?v=xxxxxx" required></div>
|
||||
<div class="mb-3"><label class="form-label">Deskripsi</label>
|
||||
<textarea name="deskripsi" id="editor"></textarea>
|
||||
<textarea name="deskripsi" id="editor" required></textarea>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="d-flex justify-content-end"><button type="submit"
|
||||
|
|
|
|||
|
|
@ -12,15 +12,17 @@
|
|||
<div class="card border-0 shadow-sm">
|
||||
<div class="card-body p-4">
|
||||
<div class="card-body">
|
||||
<form action="#" method="POST">
|
||||
<form action="{{ route('admin.rekomendasi.update', $rekomendasi->id) }}" method="POST">
|
||||
@csrf
|
||||
@method('PUT')
|
||||
<div class="mb-3"><label class="form-label">Judul</label><input type="text"
|
||||
class="form-control" value="{{ $rekomendasi['judul'] }}"></div>
|
||||
name="judul" class="form-control" value="{{ old('judul', $rekomendasi->judul) }}" required></div>
|
||||
<div class="mb-3"><label class="form-label">Kategori</label><input type="text"
|
||||
class="form-control" value="{{ $rekomendasi['kategori'] }}"></div>
|
||||
name="kategori" class="form-control" value="{{ old('kategori', $rekomendasi->kategori) }}" required></div>
|
||||
<div class="mb-3"><label class="form-label">Link YouTube</label><input type="url"
|
||||
class="form-control" value="{{ $rekomendasi['youtube_link'] }}"></div>
|
||||
name="youtube_link" class="form-control" value="{{ old('youtube_link', $rekomendasi->youtube_link) }}" required></div>
|
||||
<div class="mb-3"><label class="form-label">Deskripsi</label>
|
||||
<textarea name="deskripsi" id="editor">{{ $rekomendasi['deskripsi'] }}</textarea>
|
||||
<textarea name="deskripsi" id="editor" required>{{ old('deskripsi', $rekomendasi->deskripsi) }}</textarea>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="d-flex justify-content-end"><button type="submit"
|
||||
|
|
|
|||
|
|
@ -83,23 +83,35 @@
|
|||
|
||||
Route::get('/buku', [AdminBookController::class, 'index'])->name('buku.index');
|
||||
Route::get('/buku/tambah', [AdminBookController::class, 'create'])->name('buku.create');
|
||||
Route::post('/buku', [AdminBookController::class, 'store'])->name('buku.store');
|
||||
Route::get('/buku/{id}/edit', [AdminBookController::class, 'edit'])->name('buku.edit');
|
||||
Route::put('/buku/{id}', [AdminBookController::class, 'update'])->name('buku.update');
|
||||
Route::delete('/buku/{id}', [AdminBookController::class, 'destroy'])->name('buku.destroy');
|
||||
|
||||
Route::get('/pengguna', [AdminUserController::class, 'index'])->name('pengguna.index');
|
||||
Route::get('/pengguna/tambah', [AdminUserController::class, 'create'])->name('pengguna.create');
|
||||
Route::post('/pengguna', [AdminUserController::class, 'store'])->name('pengguna.store');
|
||||
Route::get('/pengguna/{id}/edit', [AdminUserController::class, 'edit'])->name('pengguna.edit');
|
||||
Route::put('/pengguna/{id}', [AdminUserController::class, 'update'])->name('pengguna.update');
|
||||
Route::delete('/pengguna/{id}', [AdminUserController::class, 'destroy'])->name('pengguna.destroy');
|
||||
|
||||
Route::get('/pengumuman', [AdminPengumumanController::class, 'index'])->name('pengumuman.index');
|
||||
Route::get('/pengumuman/tambah', [AdminPengumumanController::class, 'create'])->name('pengumuman.create');
|
||||
Route::post('/pengumuman', [AdminPengumumanController::class, 'store'])->name('pengumuman.store');
|
||||
Route::get('/pengumuman/{id}/edit', [AdminPengumumanController::class, 'edit'])->name('pengumuman.edit');
|
||||
Route::put('/pengumuman/{id}', [AdminPengumumanController::class, 'update'])->name('pengumuman.update');
|
||||
Route::delete('/pengumuman/{id}', [AdminPengumumanController::class, 'destroy'])->name('pengumuman.destroy');
|
||||
|
||||
Route::get('/rekomendasi', [AdminRekomendasiController
|
||||
::class, 'index'])->name('rekomendasi.index');
|
||||
Route::get('/rekomendasi', [AdminRekomendasiController::class, 'index'])->name('rekomendasi.index');
|
||||
Route::get('/rekomendasi/tambah', [AdminRekomendasiController::class, 'create'])->name('rekomendasi.create');
|
||||
Route::post('/rekomendasi', [AdminRekomendasiController::class, 'store'])->name('rekomendasi.store');
|
||||
Route::get('/rekomendasi/{id}/edit', [AdminRekomendasiController::class, 'edit'])->name('rekomendasi.edit');
|
||||
Route::put('/rekomendasi/{id}', [AdminRekomendasiController::class, 'update'])->name('rekomendasi.update');
|
||||
Route::delete('/rekomendasi/{id}', [AdminRekomendasiController::class, 'destroy'])->name('rekomendasi.destroy');
|
||||
|
||||
Route::get('/peminjaman', [AdminPeminjamanController::class, 'index'])->name('peminjaman.index');
|
||||
Route::get('/peminjaman/tambah', [AdminPeminjamanController::class, 'create'])->name('peminjaman.create');
|
||||
Route::post('/peminjaman', [AdminPeminjamanController::class, 'store'])->name('peminjaman.store');
|
||||
|
||||
Route::get('/denda', [AdminPeminjamanController::class, 'dendaIndex'])->name('denda.index');
|
||||
Route::post('/denda/sanksi', [AdminPeminjamanController::class, 'berikanSanksi'])->name('denda.sanksi');
|
||||
|
|
|
|||
Loading…
Reference in New Issue