93 lines
5.0 KiB
PHP
93 lines
5.0 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">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>
|
|
</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>
|
|
<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>
|
|
<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">
|
|
@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
|
|
</button>
|
|
</form>
|
|
</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
|