This commit is contained in:
Alfa Ramadhan 2025-09-04 13:34:43 +07:00
commit 2b945a5243
8 changed files with 366 additions and 452 deletions

View File

@ -41,25 +41,6 @@ class ReviewController extends Controller
return response()->json($review, 200);
}
// Update ulasan
public function update(Request $request, $id)
{
$review = Review::findOrFail($id);
$validated = $request->validate([
'rating' => 'integer|min:1|max:5',
'message' => 'string',
'name' => 'string|max:100',
'city' => 'string|max:100',
]);
$review->update($validated);
return response()->json([
'message' => 'Ulasan berhasil diperbarui',
'data' => $review
], 200);
}
// Hapus ulasan
public function destroy($id)

View File

@ -27,7 +27,7 @@ class KategoriController extends Controller
$request->validate([
'nama' => 'required|string|max:255',
'deskripsi' => 'nullable|string',
'foto' => 'nullable|image|mimes:jpg,jpeg,png|max:2048'
'foto' => 'nullable|image|mimes:jpeg,png,jpg,gif|max:5120'
]);
$data = $request->all();
@ -48,7 +48,7 @@ class KategoriController extends Controller
$request->validate([
'nama' => 'required|string|max:255',
'deskripsi' => 'nullable|string',
'foto' => 'nullable|image|mimes:jpg,jpeg,png|max:2048'
'foto' => 'nullable|image|mimes:jpg,jpeg,png|max:5120'
]);
$data = $request->all();

View File

@ -3,111 +3,52 @@
@section('title', 'Halaman Dasbor')
@section('content')
<div class="container">
<div class="container mx-auto py-4">
<!-- Header -->
<div class="d-flex justify-content-between align-items-center mb-4">
<h3 class="fw-bold">Halaman Dasbor</h3>
<div class="d-flex align-items-center gap-3">
<div class="date-box bg-primary bg-opacity-10 text-primary px-3 py-2 rounded">
<div class="flex justify-between items-center mb-4">
<h3 class="text-xl font-bold">Halaman Dasbor</h3>
<div class="flex items-center gap-3">
<div class="bg-blue-100 text-blue-600 px-3 py-2 rounded-lg flex items-center gap-2 text-sm">
<i class="bi bi-clock-history"></i>
{{ \Carbon\Carbon::now()->translatedFormat('l, d F Y') }}
</div>
<!-- Logout -->
</div>
</div>
<!-- Cards -->
<div class="row g-4">
<div class="col-md-4">
<div class="dashboard-card">
<div class="grid grid-cols-1 md:grid-cols-3 gap-4">
<div class="bg-white rounded-lg shadow-md p-4 flex justify-between items-center hover:shadow-lg transition-transform duration-300 transform hover:-translate-y-2">
<div>
<h5>Kategori</h5>
<h3>10</h3>
<h5 class="text-gray-500 text-sm">Kategori</h5>
<h3 class="font-bold text-xl">10</h3>
</div>
<i class="bi bi-diagram-3 dashboard-icon"></i>
<div class="w-12 h-12 bg-blue-100 text-blue-600 rounded-lg flex items-center justify-center text-xl">
<i class="bi bi-diagram-3"></i>
</div>
</div>
<div class="col-md-4">
<div class="dashboard-card">
<div class="bg-white rounded-lg shadow-md p-4 flex justify-between items-center hover:shadow-lg transition-transform duration-300 transform hover:-translate-y-2">
<div>
<h5>Templat</h5>
<h3>20</h3>
<h5 class="text-gray-500 text-sm">Templat</h5>
<h3 class="font-bold text-xl">20</h3>
</div>
<i class="bi bi-card-list dashboard-icon"></i>
<div class="w-12 h-12 bg-blue-100 text-blue-600 rounded-lg flex items-center justify-center text-xl">
<i class="bi bi-card-list"></i>
</div>
</div>
<div class="col-md-4">
<div class="dashboard-card">
<div class="bg-white rounded-lg shadow-md p-4 flex justify-between items-center hover:shadow-lg transition-transform duration-300 transform hover:-translate-y-2">
<div>
<h5>Pelanggan</h5>
<h3>24</h3>
<h5 class="text-gray-500 text-sm">Pelanggan</h5>
<h3 class="font-bold text-xl">24</h3>
</div>
<i class="bi bi-person dashboard-icon"></i>
<div class="w-12 h-12 bg-blue-100 text-blue-600 rounded-lg flex items-center justify-center text-xl">
<i class="bi bi-person"></i>
</div>
</div>
</div>
<!-- Pesan login -->
<div class="alert alert-success mt-4">
<div class="bg-green-100 text-green-700 p-4 rounded-lg mt-4">
Berhasil login sebagai <strong>{{ auth('admin')->user()->name }}</strong>
</div>
</div>
<style>
/* STYLE DASHBOARD CARD */
.dashboard-card {
border-radius: 12px;
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
padding: 20px;
display: flex;
justify-content: space-between;
align-items: center;
background: #fff;
transition: all 0.3s ease;
}
.dashboard-card:hover {
transform: translateY(-3px);
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}
.dashboard-card h5 {
font-size: 14px;
color: #6c757d;
}
.dashboard-card h3 {
font-weight: bold;
margin: 0;
}
.dashboard-icon {
width: 50px; /* ukuran kotak tetap */
height: 50px; /* tinggi sama dengan lebar */
display: flex; /* agar icon center */
justify-content: center;
align-items: center;
font-size: 24px; /* ukuran ikon */
color: #0d6efd; /* warna ikon */
background: #eef4ff; /* background biru muda */
border-radius: 12px; /* sudut sedikit rounded */
flex-shrink: 0; /* biar kotak gak mengecil */
}
/* Kotak tanggal di header dashboard */
.date-box {
background: #eef4ff;
color: #0d6efd;
padding: 6px 12px;
border-radius: 10px;
font-size: 14px;
display: inline-flex;
align-items: center;
gap: 6px;
}
</style>
@endsection

View File

@ -3,55 +3,57 @@
@section('title', 'Manajemen Fitur')
@section('content')
<div class="container">
<div class="container mx-auto py-4">
<!-- Header -->
<div class="d-flex justify-content-between align-items-center mb-4">
<h3 class="fw-bold">Manajemen Fitur</h3>
<button class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#modalTambah">
<i class="bi bi-plus-lg"></i> Tambah Fitur
<div class="flex justify-between items-center mb-4">
<h3 class="text-xl font-bold">Manajemen Fitur</h3>
<button class="bg-blue-600 text-white px-3 py-1 rounded" data-bs-toggle="modal" data-bs-target="#modalTambah">
<i class="bi bi-plus-lg mr-1"></i> Tambah Fitur
</button>
</div>
<!-- Tabel Fitur -->
<div class="card shadow-sm border-0">
<div class="card-body">
<table class="table table-hover align-middle">
<thead>
<div class="bg-white rounded-lg shadow-sm">
<div class="p-4">
<table class="w-full table-fixed border border-gray-300 text-left">
<thead class="bg-gray-100">
<tr>
<th width="50">No</th>
<th>Nama Fitur</th>
<th width="180">Aksi</th>
<th class="w-[10%] p-2 border border-gray-300">Nomor</th>
<th class="w-[70%] p-2 border border-gray-300">Fitur</th>
<th class="w-[20%] p-2 border border-gray-300 text-center">Aksi</th>
</tr>
</thead>
<tbody>
@forelse ($fiturs as $key => $fitur)
<tr>
<td>{{ $key + 1 }}</td>
<td>{{ $fitur->nama_fitur }}</td>
<td>
<button class="btn btn-warning btn-sm" data-bs-toggle="modal"
data-bs-target="#modalEdit{{ $fitur->id }}">
<i class="bi bi-pencil"></i>
<tr class="hover:bg-gray-50">
<td class="p-2 border border-gray-300">{{ $key + 1 }}</td>
<td class="p-2 border border-gray-300 truncate whitespace-nowrap">{{ $fitur->nama_fitur }}</td>
<td class="p-2 border border-gray-300 text-center">
<div class="flex justify-center space-x-2">
<button class="text-blue-600 flex items-center pr-4" data-bs-toggle="modal" data-bs-target="#modalEdit{{ $fitur->id }}">
<i class="bi bi-pencil mr-1"></i> Ubah
</button>
<form action="{{ route('admin.fitur.destroy', $fitur->id) }}"
method="POST"
class="d-inline"
class="inline"
onsubmit="return confirm('Yakin mau hapus fitur ini?')">
@csrf
@method('DELETE')
<button class="btn btn-danger btn-sm">
<i class="bi bi-trash"></i>
<button class="text-red-600 flex items-center">
<i class="bi bi-trash mr-1"></i> Hapus
</button>
</form>
</div>
</td>
</tr>
@empty
<tr>
<td colspan="3" class="text-center text-muted">Belum ada fitur</td>
<td colspan="3" class="p-2 text-center text-gray-500">Belum ada fitur</td>
</tr>
@endforelse
</tbody>
</table>
</table>
</div>
</div>
</div>
@ -62,18 +64,18 @@
<form action="{{ route('admin.fitur.store') }}" method="POST" class="modal-content">
@csrf
<div class="modal-header">
<h5 class="modal-title">Tambah Fitur</h5>
<h5 class="modal-title text-lg font-medium">Tambah Fitur</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
</div>
<div class="modal-body">
<div class="mb-3">
<label>Nama Fitur</label>
<input type="text" name="nama_fitur" class="form-control" required>
<div class="mb-4">
<label class="block text-sm font-medium">Nama Fitur</label>
<input type="text" name="nama_fitur" class="w-full p-2 border rounded" required>
</div>
</div>
<div class="modal-footer">
<button class="btn btn-secondary" data-bs-dismiss="modal">Batal</button>
<button class="btn btn-primary">Simpan</button>
<button class="bg-gray-300 text-black px-3 py-1 rounded" data-bs-dismiss="modal">Batal</button>
<button class="bg-blue-600 text-white px-3 py-1 rounded">Simpan</button>
</div>
</form>
</div>
@ -87,18 +89,18 @@
@csrf
@method('PUT')
<div class="modal-header">
<h5 class="modal-title">Edit Fitur</h5>
<h5 class="modal-title text-lg font-medium">Edit Fitur</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
</div>
<div class="modal-body">
<div class="mb-3">
<label>Nama Fitur</label>
<input type="text" name="nama_fitur" value="{{ $fitur->nama_fitur }}" class="form-control" required>
<div class="mb-4">
<label class="block text-sm font-medium">Nama Fitur</label>
<input type="text" name="nama_fitur" value="{{ $fitur->nama_fitur }}" class="w-full p-2 border rounded" required>
</div>
</div>
<div class="modal-footer">
<button class="btn btn-secondary" data-bs-dismiss="modal">Batal</button>
<button class="btn btn-primary">Simpan Perubahan</button>
<button class="bg-gray-300 text-black px-3 py-1 rounded" data-bs-dismiss="modal">Batal</button>
<button class="bg-blue-600 text-white px-3 py-1 rounded">Simpan Perubahan</button>
</div>
</form>
</div>

View File

@ -3,142 +3,182 @@
@section('title', 'Manajemen Kategori')
@section('content')
<div class="container-fluid py-4">
<div class="container mx-auto py-4">
<!-- Header -->
<div class="d-flex justify-content-between align-items-center mb-4">
<h3 class="fw-bold mb-0">Manajemen Kategori</h3>
<button class="btn btn-primary px-3" data-bs-toggle="modal" data-bs-target="#modalTambah">
<i class="bi bi-plus-lg me-1"></i> Nambah Kategori
<div class="flex justify-between items-center mb-4">
<h3 class="text-xl font-bold">Manajemen Kategori</h3>
<button class="bg-blue-600 text-white px-3 py-2.5 rounded" data-bs-toggle="modal" data-bs-target="#modalTambah">
<i class="bi bi-plus-lg mr-1"></i> Nambah Kategori
</button>
</div>
<!-- Flash Message -->
@if (session('success'))
<div id="toast-success" class="mb-4 p-3 rounded bg-green-100 text-green-800 border border-green-300 shadow">
{{ session('success') }}
</div>
<script>
setTimeout(() => {
document.getElementById('toast-success')?.remove();
}, 3000);
</script>
@endif
@if ($errors->any())
<div id="toast-error" class="mb-4 p-3 rounded bg-red-100 text-red-800 border border-red-300 shadow">
<ul class="list-disc ml-5">
@foreach ($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div>
<script>
setTimeout(() => {
document.getElementById('toast-error')?.remove();
}, 5000);
</script>
@endif
<!-- Tabel Kategori -->
<div class="card border-0 shadow-sm rounded-3">
<div class="card-body">
<table class="table table-borderless align-middle text-nowrap">
<thead class="table-light">
<div class="bg-white rounded-lg shadow-sm">
<div class="p-4">
<table class="w-full table-fixed text-left border border-gray-300 border-collapse">
<thead class="bg-gray-100">
<tr>
<th width="50">Nomor</th>
<th>Nama Kategori</th>
<th>Keterangan</th>
<th>Foto</th>
<th width="150" class="text-center">Aksi</th>
<th class="p-2 border border-gray-300 w-[50px] text-center">No</th>
<th class="p-2 border border-gray-300 w-[150px]">Nama Kategori</th>
<th class="p-2 border border-gray-300 w-[300px]">Keterangan</th>
<th class="p-2 border border-gray-300 w-[90px] text-center">Foto</th>
<th class="p-2 border border-gray-300 w-[110px] text-center">Aksi</th>
</tr>
</thead>
<tbody>
@forelse ($kategori as $key => $item)
<tr class="align-middle">
<td>{{ $key + 1 }}</td>
<td>{{ $item->nama }}</td>
<td class="text-truncate" style="max-width:300px;">
<tr>
<td class="p-2 border border-gray-300 text-center truncate">{{ $key + 1 }}</td>
<td class="p-2 border border-gray-300 truncate">{{ $item->nama }}</td>
<td class="p-2 border border-gray-300 truncate">
{{ $item->deskripsi ?? '-' }}
</td>
<td>
@if($item->foto)
<img src="{{ asset('storage/'.$item->foto) }}" alt="foto"
width="50" height="50"
class="rounded" style="object-fit:cover;">
<td class="p-2 border border-gray-300 text-center">
<div
class="w-12 h-12 overflow-hidden rounded bg-gray-100 flex items-center justify-center mx-auto">
@if ($item->foto)
<img src="{{ asset('storage/' . $item->foto) }}" alt="foto"
class="max-w-full max-h-full object-contain">
@else
<img src="{{ asset('default-image.png') }}" alt="default"
width="50" height="50"
class="rounded" style="object-fit:cover;">
class="max-w-full max-h-full object-contain">
@endif
</div>
</td>
<td class="text-center">
<button class="btn btn-link text-primary p-0 me-2"
data-bs-toggle="modal"
data-bs-target="#modalEdit{{ $item->id }}">
<i class="bi bi-pencil me-1"></i> Ubah
<td class="p-2 border border-gray-300 text-center">
<div class="flex justify-center space-x-2">
<button class="text-blue-600 hover:underline flex items-center pr-4"
data-bs-toggle="modal" data-bs-target="#modalEdit{{ $item->id }}">
<i class="bi bi-pencil mr-1"></i> Ubah
</button>
<form action="{{ route('admin.kategori.destroy', $item->id) }}"
method="POST"
class="d-inline"
onsubmit="return confirm('Yakin mau hapus kategori ini?')">
<form action="{{ route('admin.kategori.destroy', $item->id) }}" method="POST"
class="inline" onsubmit="return confirm('Yakin mau hapus kategori ini?')">
@csrf
@method('DELETE')
<button class="btn btn-link text-danger p-0">
<i class="bi bi-trash me-1"></i> Hapus
<button class="text-red-600 hover:underline flex items-center">
<i class="bi bi-trash mr-1"></i> Hapus
</button>
</form>
</div>
</td>
</tr>
@empty
<tr>
<td colspan="5" class="text-center text-muted">Belum ada kategori</td>
<td colspan="5" class="p-2 text-center text-gray-500 border border-gray-300">Belum ada
kategori</td>
</tr>
@endforelse
</tbody>
</table>
</div>
</div>
</div>
<!-- Modal Tambah -->
<div class="modal fade" id="modalTambah" tabindex="-1">
</div>
</div>
<div class="modal fade" id="modalTambah" tabindex="-1">
<div class="modal-dialog">
<form action="{{ route('admin.kategori.store') }}" method="POST" enctype="multipart/form-data" class="modal-content">
<form action="{{ route('admin.kategori.store') }}" method="POST" enctype="multipart/form-data"
class="modal-content">
@csrf
<div class="modal-header">
<h5 class="modal-title">Tambah Kategori</h5>
<h5 class="modal-title text-lg font-medium">Tambah Kategori</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
</div>
<div class="modal-body">
<div class="mb-3">
<label class="form-label">Nama</label>
<input type="text" name="nama" class="form-control" required>
<div class="mb-4">
<label class="block text-sm font-medium">Nama</label>
<input type="text" name="nama" class="w-full p-2 border rounded" required>
</div>
<div class="mb-3">
<label class="form-label">Deskripsi</label>
<textarea name="deskripsi" class="form-control" rows="3"></textarea>
<div class="mb-4">
<label class="block text-sm font-medium">Deskripsi</label>
<textarea name="deskripsi" class="w-full p-2 border rounded" rows="3"></textarea>
</div>
<div class="mb-3">
<label class="form-label">Foto</label>
<input type="file" name="foto" class="form-control">
<div class="mb-4">
<label class="block text-sm font-medium">Foto</label>
<input type="file" name="foto" class="w-full p-2 border rounded" accept="image/*">
<small class="text-gray-500">Format yang didukung: JPG, PNG, GIF. Maksimal 5MB.</small>
</div>
</div>
<div class="modal-footer">
<button class="btn btn-secondary" data-bs-dismiss="modal">Batal</button>
<button class="btn btn-primary">Simpan</button>
<button class="bg-gray-300 text-black px-3 py-1 rounded" data-bs-dismiss="modal">Batal</button>
<button class="bg-blue-600 text-white px-3 py-1 rounded">Simpan</button>
</div>
</form>
</div>
</div>
</div>
<!-- Modal Edit -->
@foreach ($kategori as $item)
<div class="modal fade" id="modalEdit{{ $item->id }}" tabindex="-1">
<!-- Modal Edit -->
@foreach ($kategori as $item)
<div class="modal fade" id="modalEdit{{ $item->id }}" tabindex="-1">
<div class="modal-dialog">
<form action="{{ route('admin.kategori.update', $item->id) }}" method="POST" enctype="multipart/form-data" class="modal-content">
<form action="{{ route('admin.kategori.update', $item->id) }}" method="POST"
enctype="multipart/form-data" class="modal-content">
@csrf
@method('PUT')
<div class="modal-header">
<h5 class="modal-title">Edit Kategori</h5>
<h5 class="modal-title text-lg font-medium">Edit Kategori</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
</div>
<div class="modal-body">
<div class="mb-3">
<label class="form-label">Nama</label>
<input type="text" name="nama" value="{{ $item->nama }}" class="form-control" required>
<div class="mb-4">
<label class="block text-sm font-medium">Nama</label>
<input type="text" name="nama" value="{{ $item->nama }}"
class="w-full p-2 border rounded" required>
</div>
<div class="mb-4">
<label class="block text-sm font-medium">Deskripsi</label>
<textarea name="deskripsi" class="w-full p-2 border rounded" rows="3">{{ $item->deskripsi }}</textarea>
</div>
<div class="mb-4">
<label class="block text-sm font-medium">Foto</label>
<input type="file" name="foto" class="w-full p-2 border rounded" accept="image/*">
<small class="text-gray-500">Format yang didukung: JPG, PNG, GIF. Maksimal 5MB.</small>
@if ($item->foto)
<div class="mt-2">
<small class="text-gray-500">Foto saat ini:</small><br>
<div
class="w-20 h-20 mt-1 overflow-hidden rounded bg-gray-100 flex items-center justify-center border">
<img src="{{ asset('storage/' . $item->foto) }}" alt="foto"
class="max-w-full max-h-full object-contain">
</div>
<div class="mb-3">
<label class="form-label">Deskripsi</label>
<textarea name="deskripsi" class="form-control" rows="3">{{ $item->deskripsi }}</textarea>
</div>
<div class="mb-3">
<label class="form-label">Foto</label>
<input type="file" name="foto" class="form-control">
@if($item->foto)
<small class="text-muted">Foto saat ini:</small><br>
<img src="{{ asset('storage/'.$item->foto) }}" alt="foto" width="70" class="mt-1 rounded">
@endif
</div>
</div>
<div class="modal-footer">
<button class="btn btn-secondary" data-bs-dismiss="modal">Batal</button>
<button class="btn btn-primary">Simpan Perubahan</button>
<button class="bg-gray-300 text-black px-3 py-1 rounded"
data-bs-dismiss="modal">Batal</button>
<button class="bg-blue-600 text-white px-3 py-1 rounded">Simpan Perubahan</button>
</div>
</form>
</div>
</div>
@endforeach
@endsection
</div>
@endforeach
@endsection

View File

@ -3,95 +3,95 @@
@section('title', 'Manajemen Ulasan')
@section('content')
<div class="container-fluid">
<div class="d-flex justify-content-between align-items-center mb-4">
<h3 class="fw-bold">Manajemen Ulasan</h3>
{{-- Info kecil bahwa tambah data via Postman --}}
<div class="container mx-auto py-4">
<!-- Header -->
<div class="flex justify-between items-center mb-4">
<h3 class="text-xl font-bold">Manajemen Ulasan</h3>
</div>
{{-- Alert sukses --}}
@if(session('success'))
<div class="alert alert-success">{{ session('success') }}</div>
<!-- Alert sukses -->
@if (session('success'))
<div class="bg-green-100 border border-green-400 text-green-700 px-4 py-3 rounded mb-4" role="alert">
{{ session('success') }}
</div>
@endif
{{-- Tabel Ulasan --}}
<div class="card shadow-sm border-0">
<div class="card-body">
<div class="table-responsive">
<table class="table table-hover align-middle">
<thead class="table-light">
<!-- Tabel Ulasan -->
<div class="bg-white rounded-lg shadow-sm">
<div class="p-4 overflow-x-auto">
<table class="w-full table-fixed text-left border border-gray-300 border-collapse">
<thead class="bg-gray-100">
<tr>
<th width="60">No</th>
<th>Nama</th>
<th>Kota</th>
<th>Rating</th>
<th>Pesan</th>
<th width="120" class="text-center">Aksi</th>
<th class="p-2 border border-gray-300 w-[50px] text-center">No</th>
<th class="p-2 border border-gray-300 w-[150px]">Nama</th>
<th class="p-2 border border-gray-300 w-[120px]">Kota</th>
<th class="p-2 border border-gray-300 w-[120px] text-center">Rating</th>
<th class="p-2 border border-gray-300 w-[350px]">Pesan</th>
<th class="p-2 border border-gray-300 w-[120px] text-center">Aksi</th>
</tr>
</thead>
<tbody>
@forelse ($reviews as $i => $review)
@forelse ($reviews as $key => $review)
<tr>
<td>{{ $i + 1 }}</td>
<td>{{ $review->name }}</td>
<td>{{ $review->city }}</td>
<td>
@for($s=1; $s<=5; $s++)
<i class="bi {{ $s <= $review->rating ? 'bi-star-fill text-warning' : 'bi-star text-secondary' }}"></i>
<td class="p-2 border border-gray-300 text-center truncate">{{ $key + 1 }}</td>
<td class="p-2 border border-gray-300 truncate">{{ $review->name }}</td>
<td class="p-2 border border-gray-300 truncate">{{ $review->city }}</td>
<td class="p-2 border border-gray-300 text-center">
@for ($s = 1; $s <= 5; $s++)
<i
class="bi {{ $s <= $review->rating ? 'bi-star-fill text-yellow-500' : 'bi-star text-gray-400' }}"></i>
@endfor
</td>
<td>{{ $review->message }}</td>
<td class="text-center">
<button
type="button"
class="btn btn-sm btn-danger btn-delete"
data-action="{{ route('admin.reviews.destroy', $review) }}"
data-name="{{ $review->name }}"
>
<i class="bi bi-trash"></i> Hapus
<td class="p-2 border border-gray-300 truncate" title="{{ $review->message }}">
{{ $review->message }}
</td>
<td class="p-2 border border-gray-300 text-center">
<div class="flex justify-center space-x-2">
<button class="text-red-600 hover:underline flex items-center btn-delete"
data-action="{{ route('admin.reviews.destroy', $review->id) }}"
data-name="{{ $review->name }}">
<i class="bi bi-trash mr-1"></i> Hapus
</button>
</div>
</td>
</tr>
@empty
<tr>
<td colspan="6" class="text-center text-muted">Belum ada ulasan</td>
<td colspan="6" class="p-2 text-center text-gray-500 border border-gray-300">
Belum ada ulasan
</td>
</tr>
@endforelse
</tbody>
</table>
</div>
</div>
</div>
</div>
{{-- Modal Konfirmasi Hapus (satu modal untuk semua baris) --}}
<div class="modal fade" id="confirmDeleteModal" tabindex="-1" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered">
<!-- Modal Konfirmasi Hapus -->
<div class="modal fade" id="confirmDeleteModal" tabindex="-1">
<div class="modal-dialog">
<form id="deleteForm" method="POST" class="modal-content">
@csrf
@method('DELETE')
<div class="modal-header">
<h5 class="modal-title">Hapus Ulasan</h5>
<h5 class="modal-title text-lg font-medium">Hapus Ulasan</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
</div>
<div class="modal-body">
Apakah Anda yakin ingin menghapus ulasan dari <strong id="deleteName"></strong>?
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Batal</button>
<button type="submit" class="btn btn-danger">Ya, Hapus</button>
<button type="button" class="bg-gray-300 text-black px-3 py-1 rounded"
data-bs-dismiss="modal">Batal</button>
<button type="submit" class="bg-red-600 text-white px-3 py-1 rounded">Ya, Hapus</button>
</div>
</form>
</div>
</div>
</div>
{{-- Script kecil untuk set action form hapus --}}
<script>
document.addEventListener('DOMContentLoaded', () => {
<script>
document.addEventListener('DOMContentLoaded', () => {
const modalEl = document.getElementById('confirmDeleteModal');
const deleteForm = document.getElementById('deleteForm');
const deleteName = document.getElementById('deleteName');
@ -103,7 +103,6 @@ document.addEventListener('DOMContentLoaded', () => {
new bootstrap.Modal(modalEl).show();
});
});
});
</script>
@endsection
});
</script>
@endsection

View File

@ -7,6 +7,7 @@
<title>@yield('title', 'Admin Panel')</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons/font/bootstrap-icons.css">
<script src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4"></script>
<style>
body {
background-color: #f1f5f9;
@ -99,53 +100,6 @@
border-left: none;
}
/* BOTTOM PROFILE */
.sidebar-bottom {
padding: 15px 20px;
border-top: 1px solid #eee;
background: #fafafa;
}
.sidebar-bottom .logout {
color: #dc3545;
display: flex;
align-items: center;
font-weight: 600;
text-decoration: none;
font-size: 14px;
}
.sidebar-bottom .logout i {
margin-right: 8px;
}
.sidebar-bottom .profile {
margin-top: 15px;
display: flex;
align-items: center;
gap: 10px;
}
.sidebar-bottom .profile img {
width: 38px;
height: 38px;
border-radius: 50%;
object-fit: cover;
border: 2px solid #ddd;
}
.sidebar-bottom .profile p {
margin: 0;
font-size: 14px;
font-weight: 600;
color: #333;
}
.sidebar-bottom .profile small {
font-size: 12px;
color: #6c757d;
}
/* MAIN CONTENT */
.main-content {
margin-left: 250px;
@ -161,7 +115,7 @@
<div id="sidebar" class="sidebar bg-white d-flex flex-column">
<!-- LOGO -->
<div class="sidebar-header text-center py-4">
<div class="sidebar-header text-center py-4 px-10">
<img src="{{ asset('images/logo.png') }}" alt="Logo" class="img-fluid mb-2" style="max-height: 80px;">
</div>
@ -230,26 +184,14 @@
</li>
</ul>
</div>
<!-- PROFILE BOX DI PALING BAWAH -->
<div class="sidebar-bottom border-top p-3">
<div class="d-flex align-items-center">
<img src="{{ asset('default-avatar.png') }}" alt="Admin" class="rounded-circle me-2"
style="width:40px; height:40px;">
<div>
<p class="mb-0 fw-semibold">{{ auth('admin')->user()->name }}</p>
<small class="text-muted">{{ auth('admin')->user()->email }}</small>
</div>
</div>
</div>
</div>
<!-- MAIN CONTENT -->
<div class="main-content">
<!-- MAIN CONTENT -->
<div class="main-content">
@yield('content')
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>

View File

@ -3,6 +3,11 @@
use Illuminate\Support\Facades\Route;
use App\Http\Controllers\AdminAuthController;
Route::get('/', function () {
return redirect()->route('admin.login');
});
Route::prefix('admin')->name('admin.')->group(function () {
Route::middleware('guest:admin')->group(function () {
Route::get('/login', [AdminAuthController::class, 'showLogin'])->name('login');
@ -29,7 +34,6 @@ Route::prefix('admin')->name('admin.')->group(function () {
use App\Http\Controllers\Api\ReviewController;
use App\Models\Review;
Route::prefix('admin')->name('admin.')->middleware('auth:admin')->group(function () {
@ -39,13 +43,18 @@ Route::prefix('admin')->name('admin.')->middleware('auth:admin')->group(function
return view('admin.reviews.index', compact('reviews'));
})->name('reviews.index');
// Tambah ulasan
Route::post('/ulasan', [ReviewController::class, 'store'])->name('reviews.store');
// Update ulasan
Route::put('/ulasan/{review}', [ReviewController::class, 'update'])->name('reviews.update');
// Hapus ulasan
Route::delete('/ulasan/{review}', function (Review $review) {
$review->delete();
return redirect()->route('admin.reviews.index')->with('success', 'Ulasan berhasil dihapus');
})->name('reviews.destroy');
});
use App\Http\Controllers\FiturController;
Route::prefix('admin')->name('admin.')->group(function () {