FIx desain

This commit is contained in:
Muzakki Parsaoran Siregar 2025-09-04 10:03:10 +07:00
parent ead36a80de
commit 5c59fffc5c
4 changed files with 266 additions and 218 deletions

View File

@ -15,44 +15,45 @@
<!-- Tabel Fitur -->
<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 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 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="inline"
onsubmit="return confirm('Yakin mau hapus fitur ini?')">
@csrf
@method('DELETE')
<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="p-2 text-center text-gray-500">Belum ada fitur</td>
</tr>
@endforelse
</tbody>
</table>
<table class="w-full table-fixed border border-gray-300 text-left">
<thead class="bg-gray-100">
<tr>
<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 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="inline"
onsubmit="return confirm('Yakin mau hapus fitur ini?')">
@csrf
@method('DELETE')
<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="p-2 text-center text-gray-500">Belum ada fitur</td>
</tr>
@endforelse
</tbody>
</table>
</div>
</div>
</div>

View File

@ -3,146 +3,182 @@
@section('title', 'Manajemen Kategori')
@section('content')
<div class="container mx-auto py-4">
<!-- Header -->
<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>
<!-- 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 class="container mx-auto py-4">
<!-- Header -->
<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>
<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="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 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="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"
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"
class="max-w-full max-h-full object-contain">
</div>
@endif
</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{{ $item->id }}">
<i class="bi bi-pencil mr-1"></i> Ubah
</button>
<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="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="p-2 text-center text-gray-500">Belum ada kategori</td>
</tr>
@endforelse
</tbody>
</table>
</div>
</div>
</div>
<!-- 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">
@csrf
@method('PUT')
<div class="modal-header">
<h5 class="modal-title text-lg font-medium">Edit Kategori</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
<!-- 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>
<div class="modal-body">
<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">
<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="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 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>
<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 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"
class="max-w-full max-h-full object-contain">
@endif
</div>
</td>
<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="inline" onsubmit="return confirm('Yakin mau hapus kategori ini?')">
@csrf
@method('DELETE')
<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="p-2 text-center text-gray-500 border border-gray-300">Belum ada
kategori</td>
</tr>
@endforelse
</tbody>
</table>
</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">
@csrf
<div class="modal-header">
<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-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-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-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="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>
<!-- 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">
@csrf
@method('PUT')
<div class="modal-header">
<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-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>
@endif
</div>
</div>
@endif
<div class="modal-footer">
<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>
<div class="modal-footer">
<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
@endforeach
@endsection

View File

@ -20,50 +20,56 @@
@endif
<!-- 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 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 $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-yellow-500' : 'bi-star text-gray-400' }}"></i>
@endfor
</td>
<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="p-2 text-center text-gray-500">Belum ada ulasan</td>
</tr>
@endforelse
</tbody>
</table>
</div>
<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 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 $key => $review)
<tr>
<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 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-blue-600 hover:underline flex items-center pr-2.5"
data-bs-toggle="modal" data-bs-target="#modalEdit{{ $review->id }}">
<i class="bi bi-pencil mr-1"></i> Ubah
</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="p-2 text-center text-gray-500 border border-gray-300">
Belum ada ulasan
</td>
</tr>
@endforelse
</tbody>
</table>
</div>
</div>

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');