tailwind css
This commit is contained in:
parent
aeb1d56e85
commit
657daa7466
@ -24,11 +24,11 @@ class KategoriController extends Controller
|
|||||||
// Simpan kategori baru
|
// Simpan kategori baru
|
||||||
public function store(Request $request)
|
public function store(Request $request)
|
||||||
{
|
{
|
||||||
$request->validate([
|
$request->validate([
|
||||||
'nama' => 'required|string|max:255',
|
'nama' => 'required|string|max:255',
|
||||||
'deskripsi' => 'nullable|string',
|
'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();
|
$data = $request->all();
|
||||||
if ($request->hasFile('foto')) {
|
if ($request->hasFile('foto')) {
|
||||||
@ -51,7 +51,7 @@ class KategoriController extends Controller
|
|||||||
'foto' => 'nullable|image|mimes:jpg,jpeg,png|max:2048'
|
'foto' => 'nullable|image|mimes:jpg,jpeg,png|max:2048'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$data = $request->all();
|
$data = $request->all();
|
||||||
if ($request->hasFile('foto')) {
|
if ($request->hasFile('foto')) {
|
||||||
if ($kategori->foto) {
|
if ($kategori->foto) {
|
||||||
Storage::disk('public')->delete($kategori->foto);
|
Storage::disk('public')->delete($kategori->foto);
|
||||||
|
@ -3,111 +3,52 @@
|
|||||||
@section('title', 'Halaman Dasbor')
|
@section('title', 'Halaman Dasbor')
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
<div class="container">
|
<div class="container mx-auto py-4">
|
||||||
<!-- Header -->
|
<!-- Header -->
|
||||||
<div class="d-flex justify-content-between align-items-center mb-4">
|
<div class="flex justify-between items-center mb-4">
|
||||||
<h3 class="fw-bold">Halaman Dasbor</h3>
|
<h3 class="text-xl font-bold">Halaman Dasbor</h3>
|
||||||
|
<div class="flex items-center gap-3">
|
||||||
<div class="d-flex align-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">
|
||||||
<div class="date-box bg-primary bg-opacity-10 text-primary px-3 py-2 rounded">
|
|
||||||
<i class="bi bi-clock-history"></i>
|
<i class="bi bi-clock-history"></i>
|
||||||
{{ \Carbon\Carbon::now()->translatedFormat('l, d F Y') }}
|
{{ \Carbon\Carbon::now()->translatedFormat('l, d F Y') }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Logout -->
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Cards -->
|
<!-- Cards -->
|
||||||
<div class="row g-4">
|
<div class="grid grid-cols-1 md:grid-cols-3 gap-4">
|
||||||
<div class="col-md-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 class="dashboard-card">
|
<div>
|
||||||
<div>
|
<h5 class="text-gray-500 text-sm">Kategori</h5>
|
||||||
<h5>Kategori</h5>
|
<h3 class="font-bold text-xl">10</h3>
|
||||||
<h3>10</h3>
|
</div>
|
||||||
</div>
|
<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 dashboard-icon"></i>
|
<i class="bi bi-diagram-3"></i>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-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 class="dashboard-card">
|
<div>
|
||||||
<div>
|
<h5 class="text-gray-500 text-sm">Templat</h5>
|
||||||
<h5>Templat</h5>
|
<h3 class="font-bold text-xl">20</h3>
|
||||||
<h3>20</h3>
|
</div>
|
||||||
</div>
|
<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 dashboard-icon"></i>
|
<i class="bi bi-card-list"></i>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-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 class="dashboard-card">
|
<div>
|
||||||
<div>
|
<h5 class="text-gray-500 text-sm">Pelanggan</h5>
|
||||||
<h5>Pelanggan</h5>
|
<h3 class="font-bold text-xl">24</h3>
|
||||||
<h3>24</h3>
|
</div>
|
||||||
</div>
|
<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 dashboard-icon"></i>
|
<i class="bi bi-person"></i>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Pesan login -->
|
<!-- 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>
|
Berhasil login sebagai <strong>{{ auth('admin')->user()->name }}</strong>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<style>
|
@endsection
|
||||||
/* 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('title', 'Manajemen Fitur')
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
<div class="container">
|
<div class="container mx-auto py-4">
|
||||||
<!-- Header -->
|
<!-- Header -->
|
||||||
<div class="d-flex justify-content-between align-items-center mb-4">
|
<div class="flex justify-between items-center mb-4">
|
||||||
<h3 class="fw-bold">Manajemen Fitur</h3>
|
<h3 class="text-xl font-bold">Manajemen Fitur</h3>
|
||||||
<button class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#modalTambah">
|
<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"></i> Tambah Fitur
|
<i class="bi bi-plus-lg mr-1"></i> Tambah Fitur
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Tabel Fitur -->
|
<!-- Tabel Fitur -->
|
||||||
<div class="card shadow-sm border-0">
|
<div class="bg-white rounded-lg shadow-sm">
|
||||||
<div class="card-body">
|
<div class="p-4">
|
||||||
<table class="table table-hover align-middle">
|
<table class="w-full table-auto text-left">
|
||||||
<thead>
|
<thead class="bg-gray-100">
|
||||||
<tr>
|
<tr>
|
||||||
<th width="50">No</th>
|
<th class=" p-2">No</th>
|
||||||
<th>Nama Fitur</th>
|
<th class="p-2">Nama Fitur</th>
|
||||||
<th width="180">Aksi</th>
|
<th class="p-2 text-center">Aksi</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@forelse ($fiturs as $key => $fitur)
|
@forelse ($fiturs as $key => $fitur)
|
||||||
<tr>
|
<tr class="border-t">
|
||||||
<td>{{ $key + 1 }}</td>
|
<td class="p-2">{{ $key + 1 }}</td>
|
||||||
<td>{{ $fitur->nama_fitur }}</td>
|
<td class="p-2">{{ $fitur->nama_fitur }}</td>
|
||||||
<td>
|
<td class="p-2 text-center">
|
||||||
<button class="btn btn-warning btn-sm" data-bs-toggle="modal"
|
<div class="flex justify-center space-x-2">
|
||||||
data-bs-target="#modalEdit{{ $fitur->id }}">
|
<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"></i>
|
<i class="bi bi-pencil mr-1"></i> Edit
|
||||||
</button>
|
|
||||||
<form action="{{ route('admin.fitur.destroy', $fitur->id) }}"
|
|
||||||
method="POST"
|
|
||||||
class="d-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>
|
</button>
|
||||||
</form>
|
<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>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@empty
|
@empty
|
||||||
<tr>
|
<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>
|
</tr>
|
||||||
@endforelse
|
@endforelse
|
||||||
</tbody>
|
</tbody>
|
||||||
@ -62,18 +63,18 @@
|
|||||||
<form action="{{ route('admin.fitur.store') }}" method="POST" class="modal-content">
|
<form action="{{ route('admin.fitur.store') }}" method="POST" class="modal-content">
|
||||||
@csrf
|
@csrf
|
||||||
<div class="modal-header">
|
<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>
|
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<div class="mb-3">
|
<div class="mb-4">
|
||||||
<label>Nama Fitur</label>
|
<label class="block text-sm font-medium">Nama Fitur</label>
|
||||||
<input type="text" name="nama_fitur" class="form-control" required>
|
<input type="text" name="nama_fitur" class="w-full p-2 border rounded" required>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button class="btn btn-secondary" data-bs-dismiss="modal">Batal</button>
|
<button class="bg-gray-300 text-black px-3 py-1 rounded" data-bs-dismiss="modal">Batal</button>
|
||||||
<button class="btn btn-primary">Simpan</button>
|
<button class="bg-blue-600 text-white px-3 py-1 rounded">Simpan</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
@ -87,21 +88,21 @@
|
|||||||
@csrf
|
@csrf
|
||||||
@method('PUT')
|
@method('PUT')
|
||||||
<div class="modal-header">
|
<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>
|
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<div class="mb-3">
|
<div class="mb-4">
|
||||||
<label>Nama Fitur</label>
|
<label class="block text-sm font-medium">Nama Fitur</label>
|
||||||
<input type="text" name="nama_fitur" value="{{ $fitur->nama_fitur }}" class="form-control" required>
|
<input type="text" name="nama_fitur" value="{{ $fitur->nama_fitur }}" class="w-full p-2 border rounded" required>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button class="btn btn-secondary" data-bs-dismiss="modal">Batal</button>
|
<button class="bg-gray-300 text-black px-3 py-1 rounded" data-bs-dismiss="modal">Batal</button>
|
||||||
<button class="btn btn-primary">Simpan Perubahan</button>
|
<button class="bg-blue-600 text-white px-3 py-1 rounded">Simpan Perubahan</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@endforeach
|
@endforeach
|
||||||
@endsection
|
@endsection
|
@ -3,68 +3,68 @@
|
|||||||
@section('title', 'Manajemen Kategori')
|
@section('title', 'Manajemen Kategori')
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
<div class="container-fluid py-4">
|
<div class="container mx-auto py-4">
|
||||||
<!-- Header -->
|
<!-- Header -->
|
||||||
<div class="d-flex justify-content-between align-items-center mb-4">
|
<div class="flex justify-between items-center mb-4">
|
||||||
<h3 class="fw-bold mb-0">Manajemen Kategori</h3>
|
<h3 class="text-xl font-bold">Manajemen Kategori</h3>
|
||||||
<button class="btn btn-primary px-3" data-bs-toggle="modal" data-bs-target="#modalTambah">
|
<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 me-1"></i> Nambah Kategori
|
<i class="bi bi-plus-lg mr-1"></i> Nambah Kategori
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Tabel Kategori -->
|
<!-- Tabel Kategori -->
|
||||||
<div class="card border-0 shadow-sm rounded-3">
|
<div class="bg-white rounded-lg shadow-sm">
|
||||||
<div class="card-body">
|
<div class="p-4">
|
||||||
<table class="table table-borderless align-middle text-nowrap">
|
<table class="w-full table-auto text-left">
|
||||||
<thead class="table-light">
|
<thead class="bg-gray-100">
|
||||||
<tr>
|
<tr>
|
||||||
<th width="50">Nomor</th>
|
<th class="p-2">No</th>
|
||||||
<th>Nama Kategori</th>
|
<th class="p-2">Nama Kategori</th>
|
||||||
<th>Keterangan</th>
|
<th class="p-2">Keterangan</th>
|
||||||
<th>Foto</th>
|
<th class="p-2">Foto</th>
|
||||||
<th width="150" class="text-center">Aksi</th>
|
<th class="p-2 text-center">Aksi</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@forelse ($kategori as $key => $item)
|
@forelse ($kategori as $key => $item)
|
||||||
<tr class="align-middle">
|
<tr class="border-t">
|
||||||
<td>{{ $key + 1 }}</td>
|
<td class="p-2">{{ $key + 1 }}</td>
|
||||||
<td>{{ $item->nama }}</td>
|
<td class="p-2">{{ $item->nama }}</td>
|
||||||
<td class="text-truncate" style="max-width:300px;">
|
<td class="p-2 text-ellipsis overflow-hidden max-w-xs">{{ $item->deskripsi ?? '-' }}</td>
|
||||||
{{ $item->deskripsi ?? '-' }}
|
<td class="p-2">
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
@if($item->foto)
|
@if($item->foto)
|
||||||
<img src="{{ asset('storage/'.$item->foto) }}" alt="foto"
|
<div class="w-12 h-12 overflow-hidden rounded bg-gray-100 flex items-center justify-center">
|
||||||
width="50" height="50"
|
<img src="{{ asset('storage/'.$item->foto) }}" alt="foto"
|
||||||
class="rounded" style="object-fit:cover;">
|
class="max-w-full max-h-full object-contain">
|
||||||
|
</div>
|
||||||
@else
|
@else
|
||||||
<img src="{{ asset('default-image.png') }}" alt="default"
|
<div class="w-12 h-12 overflow-hidden rounded bg-gray-100 flex items-center justify-center">
|
||||||
width="50" height="50"
|
<img src="{{ asset('default-image.png') }}" alt="default"
|
||||||
class="rounded" style="object-fit:cover;">
|
class="max-w-full max-h-full object-contain">
|
||||||
|
</div>
|
||||||
@endif
|
@endif
|
||||||
</td>
|
</td>
|
||||||
<td class="text-center">
|
<td class="p-2 text-center">
|
||||||
<button class="btn btn-link text-primary p-0 me-2"
|
<div class="flex justify-center space-x-2">
|
||||||
data-bs-toggle="modal"
|
<button class="text-blue-600 pr-4 hover:underline flex items-center" data-bs-toggle="modal" data-bs-target="#modalEdit{{ $item->id }}">
|
||||||
data-bs-target="#modalEdit{{ $item->id }}">
|
<i class="bi bi-pencil mr-1"></i> Ubah
|
||||||
<i class="bi bi-pencil me-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?')">
|
|
||||||
@csrf
|
|
||||||
@method('DELETE')
|
|
||||||
<button class="btn btn-link text-danger p-0">
|
|
||||||
<i class="bi bi-trash me-1"></i> Hapus
|
|
||||||
</button>
|
</button>
|
||||||
</form>
|
<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>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@empty
|
@empty
|
||||||
<tr>
|
<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>
|
</tr>
|
||||||
@endforelse
|
@endforelse
|
||||||
</tbody>
|
</tbody>
|
||||||
@ -79,26 +79,27 @@
|
|||||||
<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
|
@csrf
|
||||||
<div class="modal-header">
|
<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>
|
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<div class="mb-3">
|
<div class="mb-4">
|
||||||
<label class="form-label">Nama</label>
|
<label class="block text-sm font-medium">Nama</label>
|
||||||
<input type="text" name="nama" class="form-control" required>
|
<input type="text" name="nama" class="w-full p-2 border rounded" required>
|
||||||
</div>
|
</div>
|
||||||
<div class="mb-3">
|
<div class="mb-4">
|
||||||
<label class="form-label">Deskripsi</label>
|
<label class="block text-sm font-medium">Deskripsi</label>
|
||||||
<textarea name="deskripsi" class="form-control" rows="3"></textarea>
|
<textarea name="deskripsi" class="w-full p-2 border rounded" rows="3"></textarea>
|
||||||
</div>
|
</div>
|
||||||
<div class="mb-3">
|
<div class="mb-4">
|
||||||
<label class="form-label">Foto</label>
|
<label class="block text-sm font-medium">Foto</label>
|
||||||
<input type="file" name="foto" class="form-control">
|
<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>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button class="btn btn-secondary" data-bs-dismiss="modal">Batal</button>
|
<button class="bg-gray-300 text-black px-3 py-1 rounded" data-bs-dismiss="modal">Batal</button>
|
||||||
<button class="btn btn-primary">Simpan</button>
|
<button class="bg-blue-600 text-white px-3 py-1 rounded">Simpan</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
@ -112,33 +113,39 @@
|
|||||||
@csrf
|
@csrf
|
||||||
@method('PUT')
|
@method('PUT')
|
||||||
<div class="modal-header">
|
<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>
|
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<div class="mb-3">
|
<div class="mb-4">
|
||||||
<label class="form-label">Nama</label>
|
<label class="block text-sm font-medium">Nama</label>
|
||||||
<input type="text" name="nama" value="{{ $item->nama }}" class="form-control" required>
|
<input type="text" name="nama" value="{{ $item->nama }}" class="w-full p-2 border rounded" required>
|
||||||
</div>
|
</div>
|
||||||
<div class="mb-3">
|
<div class="mb-4">
|
||||||
<label class="form-label">Deskripsi</label>
|
<label class="block text-sm font-medium">Deskripsi</label>
|
||||||
<textarea name="deskripsi" class="form-control" rows="3">{{ $item->deskripsi }}</textarea>
|
<textarea name="deskripsi" class="w-full p-2 border rounded" rows="3">{{ $item->deskripsi }}</textarea>
|
||||||
</div>
|
</div>
|
||||||
<div class="mb-3">
|
<div class="mb-4">
|
||||||
<label class="form-label">Foto</label>
|
<label class="block text-sm font-medium">Foto</label>
|
||||||
<input type="file" name="foto" class="form-control">
|
<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)
|
@if($item->foto)
|
||||||
<small class="text-muted">Foto saat ini:</small><br>
|
<div class="mt-2">
|
||||||
<img src="{{ asset('storage/'.$item->foto) }}" alt="foto" width="70" class="mt-1 rounded">
|
<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
|
@endif
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button class="btn btn-secondary" data-bs-dismiss="modal">Batal</button>
|
<button class="bg-gray-300 text-black px-3 py-1 rounded" data-bs-dismiss="modal">Batal</button>
|
||||||
<button class="btn btn-primary">Simpan Perubahan</button>
|
<button class="bg-blue-600 text-white px-3 py-1 rounded">Simpan Perubahan</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@endforeach
|
@endforeach
|
||||||
@endsection
|
@endsection
|
@ -3,93 +3,176 @@
|
|||||||
@section('title', 'Manajemen Ulasan')
|
@section('title', 'Manajemen Ulasan')
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
<div class="container-fluid">
|
<div class="container mx-auto py-4">
|
||||||
<div class="d-flex justify-content-between align-items-center mb-4">
|
<!-- Header -->
|
||||||
<h3 class="fw-bold">Manajemen Ulasan</h3>
|
<div class="flex justify-between items-center mb-4">
|
||||||
|
<h3 class="text-xl font-bold">Manajemen Ulasan</h3>
|
||||||
{{-- Info kecil bahwa tambah data via Postman --}}
|
<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>
|
</div>
|
||||||
|
|
||||||
{{-- Alert sukses --}}
|
<!-- Alert sukses -->
|
||||||
@if(session('success'))
|
@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
|
@endif
|
||||||
|
|
||||||
{{-- Tabel Ulasan --}}
|
<!-- Tabel Ulasan -->
|
||||||
<div class="card shadow-sm border-0">
|
<div class="bg-white rounded-lg shadow-sm">
|
||||||
<div class="card-body">
|
<div class="p-4">
|
||||||
<div class="table-responsive">
|
<table class="w-full table-auto text-left">
|
||||||
<table class="table table-hover align-middle">
|
<thead class="bg-gray-100">
|
||||||
<thead class="table-light">
|
<tr>
|
||||||
<tr>
|
<th class="p-2">No</th>
|
||||||
<th width="60">No</th>
|
<th class="p-2">Nama</th>
|
||||||
<th>Nama</th>
|
<th class="p-2">Kota</th>
|
||||||
<th>Kota</th>
|
<th class="p-2">Rating</th>
|
||||||
<th>Rating</th>
|
<th class="p-2">Pesan</th>
|
||||||
<th>Pesan</th>
|
<th class="p-2 text-center">Aksi</th>
|
||||||
<th width="120" class="text-center">Aksi</th>
|
</tr>
|
||||||
</tr>
|
</thead>
|
||||||
</thead>
|
<tbody>
|
||||||
<tbody>
|
@forelse ($reviews as $key => $review)
|
||||||
@forelse ($reviews as $i => $review)
|
<tr class="border-t">
|
||||||
<tr>
|
<td class="p-2">{{ $key + 1 }}</td>
|
||||||
<td>{{ $i + 1 }}</td>
|
<td class="p-2">{{ $review->name }}</td>
|
||||||
<td>{{ $review->name }}</td>
|
<td class="p-2">{{ $review->city }}</td>
|
||||||
<td>{{ $review->city }}</td>
|
<td class="p-2">
|
||||||
<td>
|
@for($s = 1; $s <= 5; $s++)
|
||||||
@for($s=1; $s<=5; $s++)
|
<i class="bi {{ $s <= $review->rating ? 'bi-star-fill text-yellow-500' : 'bi-star text-gray-400' }}"></i>
|
||||||
<i class="bi {{ $s <= $review->rating ? 'bi-star-fill text-warning' : 'bi-star text-secondary' }}"></i>
|
@endfor
|
||||||
@endfor
|
</td>
|
||||||
</td>
|
<td class="p-2">{{ $review->message }}</td>
|
||||||
<td>{{ $review->message }}</td>
|
<td class="p-2 text-center">
|
||||||
<td class="text-center">
|
<div class="flex justify-center space-x-2">
|
||||||
<button
|
<button class="text-blue-600 pr-4 hover:underline flex items-center" data-bs-toggle="modal" data-bs-target="#modalEdit{{ $review->id }}">
|
||||||
type="button"
|
<i class="bi bi-pencil mr-1"></i> Edit
|
||||||
class="btn btn-sm btn-danger btn-delete"
|
</button>
|
||||||
data-action="{{ route('admin.reviews.destroy', $review) }}"
|
<button class="text-red-600 hover:underline flex items-center btn-delete" data-action="{{ route('admin.reviews.destroy', $review->id) }}" data-name="{{ $review->name }}">
|
||||||
data-name="{{ $review->name }}"
|
<i class="bi bi-trash mr-1"></i> Hapus
|
||||||
>
|
</button>
|
||||||
<i class="bi bi-trash"></i> Hapus
|
</div>
|
||||||
</button>
|
</td>
|
||||||
</td>
|
</tr>
|
||||||
</tr>
|
@empty
|
||||||
@empty
|
<tr>
|
||||||
<tr>
|
<td colspan="6" class="p-2 text-center text-gray-500">Belum ada ulasan</td>
|
||||||
<td colspan="6" class="text-center text-muted">Belum ada ulasan</td>
|
</tr>
|
||||||
</tr>
|
@endforelse
|
||||||
@endforelse
|
</tbody>
|
||||||
</tbody>
|
</table>
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{-- Modal Konfirmasi Hapus (satu modal untuk semua baris) --}}
|
<!-- Modal Tambah -->
|
||||||
<div class="modal fade" id="confirmDeleteModal" tabindex="-1" aria-hidden="true">
|
<div class="modal fade" id="modalTambah" tabindex="-1">
|
||||||
<div class="modal-dialog modal-dialog-centered">
|
<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">
|
<form id="deleteForm" method="POST" class="modal-content">
|
||||||
@csrf
|
@csrf
|
||||||
@method('DELETE')
|
@method('DELETE')
|
||||||
<div class="modal-header">
|
<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>
|
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
Apakah Anda yakin ingin menghapus ulasan dari <strong id="deleteName">—</strong>?
|
Apakah Anda yakin ingin menghapus ulasan dari <strong id="deleteName">—</strong>?
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Batal</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="btn btn-danger">Ya, Hapus</button>
|
<button type="submit" class="bg-red-600 text-white px-3 py-1 rounded">Ya, Hapus</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{-- Script kecil untuk set action form hapus --}}
|
|
||||||
<script>
|
<script>
|
||||||
document.addEventListener('DOMContentLoaded', () => {
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
const modalEl = document.getElementById('confirmDeleteModal');
|
const modalEl = document.getElementById('confirmDeleteModal');
|
||||||
@ -105,5 +188,4 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
@endsection
|
@endsection
|
||||||
|
|
@ -7,6 +7,7 @@
|
|||||||
<title>@yield('title', 'Admin Panel')</title>
|
<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 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">
|
<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>
|
<style>
|
||||||
body {
|
body {
|
||||||
background-color: #f1f5f9;
|
background-color: #f1f5f9;
|
||||||
@ -161,7 +162,7 @@
|
|||||||
<div id="sidebar" class="sidebar bg-white d-flex flex-column">
|
<div id="sidebar" class="sidebar bg-white d-flex flex-column">
|
||||||
|
|
||||||
<!-- LOGO -->
|
<!-- 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;">
|
<img src="{{ asset('images/logo.png') }}" alt="Logo" class="img-fluid mb-2" style="max-height: 80px;">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -29,7 +29,6 @@ Route::prefix('admin')->name('admin.')->group(function () {
|
|||||||
|
|
||||||
|
|
||||||
use App\Http\Controllers\Api\ReviewController;
|
use App\Http\Controllers\Api\ReviewController;
|
||||||
|
|
||||||
use App\Models\Review;
|
use App\Models\Review;
|
||||||
|
|
||||||
Route::prefix('admin')->name('admin.')->middleware('auth:admin')->group(function () {
|
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'));
|
return view('admin.reviews.index', compact('reviews'));
|
||||||
})->name('reviews.index');
|
})->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
|
// Hapus ulasan
|
||||||
Route::delete('/ulasan/{review}', function (Review $review) {
|
Route::delete('/ulasan/{review}', function (Review $review) {
|
||||||
$review->delete();
|
$review->delete();
|
||||||
return redirect()->route('admin.reviews.index')->with('success', 'Ulasan berhasil dihapus');
|
return redirect()->route('admin.reviews.index')->with('success', 'Ulasan berhasil dihapus');
|
||||||
})->name('reviews.destroy');
|
})->name('reviews.destroy');
|
||||||
});
|
});
|
||||||
|
|
||||||
use App\Http\Controllers\FiturController;
|
use App\Http\Controllers\FiturController;
|
||||||
|
|
||||||
Route::prefix('admin')->name('admin.')->group(function () {
|
Route::prefix('admin')->name('admin.')->group(function () {
|
||||||
|
Loading…
Reference in New Issue
Block a user