fix desain

This commit is contained in:
Muzakki Parsaoran Siregar 2025-10-07 14:12:58 +07:00
parent 9fd4dac382
commit b23448b4ad
2 changed files with 50 additions and 30 deletions

View File

@ -83,7 +83,7 @@ class PelangganController extends Controller
$pelanggan = Pelanggan::findOrFail($id);
$pelanggan->delete();
return redirect()->route('pelanggans.index')
return redirect()->route('admin.pelanggan.index')
->with('success', 'Pesanan berhasil dihapus.');
}
}

View File

@ -24,9 +24,9 @@
<th class="px-3 py-2 border border-gray-200">Nama Pemesan</th>
<th class="px-3 py-2 border border-gray-200">Email</th>
<th class="px-3 py-2 border border-gray-200">Template</th>
<th class="px-3 py-2 border border-gray-200">Status</th>
<th class="px-3 py-2 border border-gray-200">Harga</th>
<th class="px-3 py-2 border border-gray-200 text-center w-[180px]">Aksi</th>
<th class="px-3 py-2 border border-gray-200">Status</th>
<th class="px-3 py-2 border border-gray-200 text-center w-[200px]">Aksi</th>
</tr>
</thead>
<tbody>
@ -36,41 +36,61 @@
<td class="px-3 py-2 border border-gray-200">{{ $pelanggan->nama_pemesan }}</td>
<td class="px-3 py-2 border border-gray-200">{{ $pelanggan->email }}</td>
<td class="px-3 py-2 border border-gray-200">{{ $pelanggan->template->nama_template ?? '-' }}</td>
<!-- Harga -->
<td class="px-3 py-2 border border-gray-200">
Rp {{ number_format($pelanggan->harga, 0, ',', '.') }}
</td>
<!-- Status -->
<td class="px-3 py-2 border border-gray-200">
<span class="px-2 py-1 rounded text-sm
{{ $pelanggan->status == 'diterima' ? 'bg-green-100 text-green-700' : ($pelanggan->status == 'ditolak' ? 'bg-red-100 text-red-700' : 'bg-yellow-100 text-yellow-700') }}">
{{ $pelanggan->status == 'diterima' ? 'bg-green-100 text-green-700' :
($pelanggan->status == 'ditolak' ? 'bg-red-100 text-red-700' :
'bg-yellow-100 text-yellow-700') }}">
{{ ucfirst($pelanggan->status) }}
</span>
</td>
<td class="px-3 py-2 border border-gray-200">Rp {{ number_format($pelanggan->harga, 0, ',', '.') }}</td>
<td class="px-3 py-2 border border-gray-200 text-center">
<div class="flex justify-center gap-2">
<!-- Detail -->
<a href="{{ route('admin.pelanggan.show', $pelanggan->id) }}"
class="px-3 py-1 rounded bg-blue-500 text-white text-sm hover:bg-blue-600 flex items-center">
<i class="bi bi-eye mr-1"></i> Detail
</a>
<!-- Form Update Status -->
<form action="{{ route('admin.pelanggan.update', $pelanggan->id) }}" method="POST" class="d-inline">
<!-- Kolom Aksi -->
<td class="px-3 py-2 border border-gray-200 text-center">
<div class="flex justify-center items-center gap-2">
@if($pelanggan->status == 'menunggu')
<!-- Tombol Terima -->
<form action="{{ route('admin.pelanggan.update', $pelanggan->id) }}" method="POST" onsubmit="return confirm('Terima pesanan ini?')">
@csrf
@method('PUT')
<select name="status" onchange="this.form.submit()"
class="text-sm border rounded px-2 py-1">
<option value="menunggu" {{ $pelanggan->status == 'menunggu' ? 'selected' : '' }}>Menunggu</option>
<option value="diterima" {{ $pelanggan->status == 'diterima' ? 'selected' : '' }}>Diterima</option>
<option value="ditolak" {{ $pelanggan->status == 'ditolak' ? 'selected' : '' }}>Ditolak</option>
</select>
</form>
<!-- Hapus -->
<form action="{{ route('admin.pelanggan.destroy', $pelanggan->id) }}" method="POST" class="d-inline" onsubmit="return confirm('Yakin hapus pesanan?')">
@csrf
@method('DELETE')
<button class="px-3 py-1 rounded bg-red-500 text-white text-sm hover:bg-red-600 flex items-center">
<i class="bi bi-trash mr-1"></i> Hapus
<input type="hidden" name="status" value="diterima">
<button class="inline-flex items-center justify-center gap-1 px-3 py-1.5 rounded-md bg-green-500 text-white text-sm font-medium hover:bg-green-600 transition-all">
<i class="bi bi-check-circle"></i> Terima
</button>
</form>
<!-- Tombol Tolak -->
<form action="{{ route('admin.pelanggan.update', $pelanggan->id) }}" method="POST" onsubmit="return confirm('Tolak pesanan ini?')">
@csrf
@method('PUT')
<input type="hidden" name="status" value="ditolak">
<button class="inline-flex items-center justify-center gap-1 px-3 py-1.5 rounded-md bg-red-500 text-white text-sm font-medium hover:bg-red-600 transition-all">
<i class="bi bi-x-circle"></i> Tolak
</button>
</form>
@else
<!-- Tombol Detail -->
<a href="{{ route('admin.pelanggan.show', $pelanggan->id) }}"
class="inline-flex items-center justify-center gap-1 px-3 py-1.5 rounded-md bg-blue-500 text-white text-sm font-medium hover:bg-blue-600 transition-all">
<i class="bi bi-eye"></i> Detail
</a>
<!-- Tombol Hapus -->
<form action="{{ route('admin.pelanggan.destroy', $pelanggan->id) }}" method="POST" onsubmit="return confirm('Yakin hapus pesanan?')">
@csrf
@method('DELETE')
<button class="inline-flex items-center justify-center gap-1 px-3 py-1.5 rounded-md bg-gray-500 text-white text-sm font-medium hover:bg-gray-600 transition-all">
<i class="bi bi-trash"></i> Hapus
</button>
</form>
@endif
</div>
</td>
</tr>