tailwind css
This commit is contained in:
parent
aeb1d56e85
commit
657daa7466
@ -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' // 5MB = 5120KB
|
||||
]);
|
||||
|
||||
$data = $request->all();
|
||||
|
@ -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
|
@ -3,51 +3,52 @@
|
||||
@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-auto text-left">
|
||||
<thead class="bg-gray-100">
|
||||
<tr>
|
||||
<th width="50">No</th>
|
||||
<th>Nama Fitur</th>
|
||||
<th width="180">Aksi</th>
|
||||
<th class=" p-2">No</th>
|
||||
<th class="p-2">Nama Fitur</th>
|
||||
<th class="p-2 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="border-t">
|
||||
<td class="p-2">{{ $key + 1 }}</td>
|
||||
<td class="p-2">{{ $fitur->nama_fitur }}</td>
|
||||
<td class="p-2 text-center">
|
||||
<div class="flex justify-center space-x-2">
|
||||
<button class="text-blue-600 pr-4 hover:underline flex items-center" data-bs-toggle="modal" data-bs-target="#modalEdit{{ $fitur->id }}">
|
||||
<i class="bi bi-pencil mr-1"></i> Edit
|
||||
</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 hover:underline 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>
|
||||
@ -62,18 +63,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 +88,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>
|
||||
|
@ -3,68 +3,68 @@
|
||||
@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-1 rounded" data-bs-toggle="modal" data-bs-target="#modalTambah">
|
||||
<i class="bi bi-plus-lg mr-1"></i> Nambah Kategori
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<!-- 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-auto text-left">
|
||||
<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">No</th>
|
||||
<th class="p-2">Nama Kategori</th>
|
||||
<th class="p-2">Keterangan</th>
|
||||
<th class="p-2">Foto</th>
|
||||
<th class="p-2 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;">
|
||||
{{ $item->deskripsi ?? '-' }}
|
||||
</td>
|
||||
<td>
|
||||
<tr class="border-t">
|
||||
<td class="p-2">{{ $key + 1 }}</td>
|
||||
<td class="p-2">{{ $item->nama }}</td>
|
||||
<td class="p-2 text-ellipsis overflow-hidden max-w-xs">{{ $item->deskripsi ?? '-' }}</td>
|
||||
<td class="p-2">
|
||||
@if($item->foto)
|
||||
<div class="w-12 h-12 overflow-hidden rounded bg-gray-100 flex items-center justify-center">
|
||||
<img src="{{ asset('storage/'.$item->foto) }}" alt="foto"
|
||||
width="50" height="50"
|
||||
class="rounded" style="object-fit:cover;">
|
||||
class="max-w-full max-h-full object-contain">
|
||||
</div>
|
||||
@else
|
||||
<div class="w-12 h-12 overflow-hidden rounded bg-gray-100 flex items-center justify-center">
|
||||
<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">
|
||||
</div>
|
||||
@endif
|
||||
</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 text-center">
|
||||
<div class="flex justify-center space-x-2">
|
||||
<button class="text-blue-600 pr-4 hover:underline flex items-center" 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"
|
||||
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">Belum ada kategori</td>
|
||||
</tr>
|
||||
@endforelse
|
||||
</tbody>
|
||||
@ -79,26 +79,27 @@
|
||||
<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>
|
||||
@ -112,30 +113,36 @@
|
||||
@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-3">
|
||||
<label class="form-label">Deskripsi</label>
|
||||
<textarea name="deskripsi" class="form-control" rows="3">{{ $item->deskripsi }}</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">{{ $item->deskripsi }}</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>
|
||||
@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">
|
||||
<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>
|
||||
@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>
|
||||
|
@ -3,93 +3,176 @@
|
||||
@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>
|
||||
<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 Ulasan
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{{-- Alert sukses --}}
|
||||
<!-- Alert sukses -->
|
||||
@if(session('success'))
|
||||
<div class="alert alert-success">{{ session('success') }}</div>
|
||||
<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">
|
||||
<table class="w-full table-auto text-left">
|
||||
<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">No</th>
|
||||
<th class="p-2">Nama</th>
|
||||
<th class="p-2">Kota</th>
|
||||
<th class="p-2">Rating</th>
|
||||
<th class="p-2">Pesan</th>
|
||||
<th class="p-2 text-center">Aksi</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@forelse ($reviews as $i => $review)
|
||||
<tr>
|
||||
<td>{{ $i + 1 }}</td>
|
||||
<td>{{ $review->name }}</td>
|
||||
<td>{{ $review->city }}</td>
|
||||
<td>
|
||||
@forelse ($reviews as $key => $review)
|
||||
<tr class="border-t">
|
||||
<td class="p-2">{{ $key + 1 }}</td>
|
||||
<td class="p-2">{{ $review->name }}</td>
|
||||
<td class="p-2">{{ $review->city }}</td>
|
||||
<td class="p-2">
|
||||
@for($s = 1; $s <= 5; $s++)
|
||||
<i class="bi {{ $s <= $review->rating ? 'bi-star-fill text-warning' : 'bi-star text-secondary' }}"></i>
|
||||
<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">{{ $review->message }}</td>
|
||||
<td class="p-2 text-center">
|
||||
<div class="flex justify-center space-x-2">
|
||||
<button class="text-blue-600 pr-4 hover:underline flex items-center" data-bs-toggle="modal" data-bs-target="#modalEdit{{ $review->id }}">
|
||||
<i class="bi bi-pencil mr-1"></i> Edit
|
||||
</button>
|
||||
<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">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 Tambah -->
|
||||
<div class="modal fade" id="modalTambah" tabindex="-1">
|
||||
<div class="modal-dialog">
|
||||
<form action="{{ route('admin.reviews.store') }}" method="POST" class="modal-content">
|
||||
@csrf
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title text-lg font-medium">Tambah Ulasan</h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="mb-4">
|
||||
<label class="block text-sm font-medium">Nama</label>
|
||||
<input type="text" name="name" class="w-full p-2 border rounded" required>
|
||||
</div>
|
||||
<div class="mb-4">
|
||||
<label class="block text-sm font-medium">Kota</label>
|
||||
<input type="text" name="city" class="w-full p-2 border rounded" required>
|
||||
</div>
|
||||
<div class="mb-4">
|
||||
<label class="block text-sm font-medium">Rating</label>
|
||||
<select name="rating" class="w-full p-2 border rounded" required>
|
||||
<option value="1">1 Bintang</option>
|
||||
<option value="2">2 Bintang</option>
|
||||
<option value="3">3 Bintang</option>
|
||||
<option value="4">4 Bintang</option>
|
||||
<option value="5">5 Bintang</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="mb-4">
|
||||
<label class="block text-sm font-medium">Pesan</label>
|
||||
<textarea name="message" class="w-full p-2 border rounded" required></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<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-blue-600 text-white px-3 py-1 rounded">Simpan</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Modal Edit -->
|
||||
@foreach ($reviews as $review)
|
||||
<div class="modal fade" id="modalEdit{{ $review->id }}" tabindex="-1">
|
||||
<div class="modal-dialog">
|
||||
<form action="{{ route('admin.reviews.update', $review->id) }}" method="POST" class="modal-content">
|
||||
@csrf
|
||||
@method('PUT')
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title text-lg font-medium">Edit Ulasan</h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="mb-4">
|
||||
<label class="block text-sm font-medium">Nama</label>
|
||||
<input type="text" name="name" value="{{ $review->name }}" class="w-full p-2 border rounded" required>
|
||||
</div>
|
||||
<div class="mb-4">
|
||||
<label class="block text-sm font-medium">Kota</label>
|
||||
<input type="text" name="city" value="{{ $review->city }}" class="w-full p-2 border rounded" required>
|
||||
</div>
|
||||
<div class="mb-4">
|
||||
<label class="block text-sm font-medium">Rating</label>
|
||||
<select name="rating" class="w-full p-2 border rounded" required>
|
||||
<option value="1" {{ $review->rating == 1 ? 'selected' : '' }}>1 Bintang</option>
|
||||
<option value="2" {{ $review->rating == 2 ? 'selected' : '' }}>2 Bintang</option>
|
||||
<option value="3" {{ $review->rating == 3 ? 'selected' : '' }}>3 Bintang</option>
|
||||
<option value="4" {{ $review->rating == 4 ? 'selected' : '' }}>4 Bintang</option>
|
||||
<option value="5" {{ $review->rating == 5 ? 'selected' : '' }}>5 Bintang</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="mb-4">
|
||||
<label class="block text-sm font-medium">Pesan</label>
|
||||
<textarea name="message" class="w-full p-2 border rounded" required>{{ $review->message }}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<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-blue-600 text-white px-3 py-1 rounded">Simpan Perubahan</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
@endforeach
|
||||
|
||||
<!-- 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>
|
||||
|
||||
{{-- Script kecil untuk set action form hapus --}}
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
const modalEl = document.getElementById('confirmDeleteModal');
|
||||
@ -106,4 +189,3 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
});
|
||||
</script>
|
||||
@endsection
|
||||
|
@ -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;
|
||||
@ -161,7 +162,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>
|
||||
|
||||
|
@ -29,7 +29,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 +38,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 () {
|
||||
|
Loading…
Reference in New Issue
Block a user