113 lines
6.2 KiB
PHP
113 lines
6.2 KiB
PHP
@extends('layouts.app')
|
|
|
|
@section('title', 'Daftar Pesanan Pelanggan')
|
|
|
|
@section('content')
|
|
<div class="container mx-auto py-6">
|
|
<div class="flex justify-between items-center mb-6">
|
|
<h2 class="text-2xl font-bold">Daftar Pesanan</h2>
|
|
</div>
|
|
|
|
<!-- Flash Message -->
|
|
@if(session('success'))
|
|
<div class="mb-4 p-3 rounded bg-green-100 text-green-800 border border-green-300 shadow">
|
|
{{ session('success') }}
|
|
</div>
|
|
@endif
|
|
|
|
<!-- Tabel -->
|
|
<div class="bg-white rounded-lg shadow overflow-x-auto">
|
|
<table class="w-full border border-gray-200 text-left border-collapse">
|
|
<thead class="bg-gray-100">
|
|
<tr>
|
|
<th class="px-3 py-2 border border-gray-200 w-[50px] text-center">No.</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">Template</th>
|
|
<th class="px-3 py-2 border border-gray-200">Harga</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>
|
|
@forelse($pelanggans as $index => $pelanggan)
|
|
<tr class="hover:bg-gray-50">
|
|
<td class="px-3 py-2 border border-gray-200 text-center">{{ $index + 1 }}</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->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') }}">
|
|
{{ ucfirst($pelanggan->status) }}
|
|
</span>
|
|
</td>
|
|
|
|
<!-- 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')
|
|
<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>
|
|
@empty
|
|
<tr>
|
|
<td colspan="7" class="px-3 py-4 text-center text-gray-500 border border-gray-200">
|
|
Belum ada pesanan.
|
|
</td>
|
|
</tr>
|
|
@endforelse
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="mt-4">
|
|
{{ $pelanggans->links() }}
|
|
</div>
|
|
</div>
|
|
@endsection
|