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 = Pelanggan::findOrFail($id);
$pelanggan->delete(); $pelanggan->delete();
return redirect()->route('pelanggans.index') return redirect()->route('admin.pelanggan.index')
->with('success', 'Pesanan berhasil dihapus.'); ->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">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">Email</th>
<th class="px-3 py-2 border border-gray-200">Template</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">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> </tr>
</thead> </thead>
<tbody> <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->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->email }}</td>
<td class="px-3 py-2 border border-gray-200">{{ $pelanggan->template->nama_template ?? '-' }}</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"> <td class="px-3 py-2 border border-gray-200">
<span class="px-2 py-1 rounded text-sm <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) }} {{ ucfirst($pelanggan->status) }}
</span> </span>
</td> </td>
<td class="px-3 py-2 border border-gray-200">Rp {{ number_format($pelanggan->harga, 0, ',', '.') }}</td>
<!-- Kolom Aksi -->
<td class="px-3 py-2 border border-gray-200 text-center"> <td class="px-3 py-2 border border-gray-200 text-center">
<div class="flex justify-center gap-2"> <div class="flex justify-center items-center gap-2">
<!-- Detail --> @if($pelanggan->status == 'menunggu')
<a href="{{ route('admin.pelanggan.show', $pelanggan->id) }}" <!-- Tombol Terima -->
class="px-3 py-1 rounded bg-blue-500 text-white text-sm hover:bg-blue-600 flex items-center"> <form action="{{ route('admin.pelanggan.update', $pelanggan->id) }}" method="POST" onsubmit="return confirm('Terima pesanan ini?')">
<i class="bi bi-eye mr-1"></i> Detail @csrf
</a> @method('PUT')
<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>
<!-- Form Update Status --> <!-- Tombol Tolak -->
<form action="{{ route('admin.pelanggan.update', $pelanggan->id) }}" method="POST" class="d-inline"> <form action="{{ route('admin.pelanggan.update', $pelanggan->id) }}" method="POST" onsubmit="return confirm('Tolak pesanan ini?')">
@csrf @csrf
@method('PUT') @method('PUT')
<select name="status" onchange="this.form.submit()" <input type="hidden" name="status" value="ditolak">
class="text-sm border rounded px-2 py-1"> <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">
<option value="menunggu" {{ $pelanggan->status == 'menunggu' ? 'selected' : '' }}>Menunggu</option> <i class="bi bi-x-circle"></i> Tolak
<option value="diterima" {{ $pelanggan->status == 'diterima' ? 'selected' : '' }}>Diterima</option> </button>
<option value="ditolak" {{ $pelanggan->status == 'ditolak' ? 'selected' : '' }}>Ditolak</option> </form>
</select> @else
</form> <!-- 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>
<!-- Hapus --> <!-- Tombol Hapus -->
<form action="{{ route('admin.pelanggan.destroy', $pelanggan->id) }}" method="POST" class="d-inline" onsubmit="return confirm('Yakin hapus pesanan?')"> <form action="{{ route('admin.pelanggan.destroy', $pelanggan->id) }}" method="POST" onsubmit="return confirm('Yakin hapus pesanan?')">
@csrf @csrf
@method('DELETE') @method('DELETE')
<button class="px-3 py-1 rounded bg-red-500 text-white text-sm hover:bg-red-600 flex items-center"> <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 mr-1"></i> Hapus <i class="bi bi-trash"></i> Hapus
</button> </button>
</form> </form>
@endif
</div> </div>
</td> </td>
</tr> </tr>