@include('partials.navbar')
Riwayat

Pesanan Saya

@forelse($orders as $order) @php $isPending = $order->status === 'pending'; $statusLabel = 'Menunggu Konfirmasi'; $statusColor = 'bg-yellow-100 text-yellow-700'; if ($order->status === 'pending') { $statusLabel = 'Belum Dibayar'; $statusColor = 'bg-red-100 text-red-700'; } elseif (in_array($order->status, ['confirmed', 'shipped'])) { $statusLabel = 'Sedang Diproses'; $statusColor = 'bg-blue-100 text-blue-700'; } elseif ($order->status === 'completed') { $statusLabel = 'Pesanan Selesai'; $statusColor = 'bg-green-100 text-green-700'; } elseif ($order->status === 'rejected') { $statusLabel = 'Dibatalkan'; $statusColor = 'bg-gray-200 text-gray-700'; } $items = is_array($order->items) ? $order->items : json_decode($order->items, true); $firstItem = !empty($items) ? $items[0] : null; $itemCount = is_array($items) ? count($items) : 0; @endphp
{{ $order->order_id }}
{{ $statusLabel }}
@if($firstItem && isset($firstItem['image'])) {{ $firstItem['name'] }} @else @endif
@if($firstItem)

{{ $firstItem['name'] }}

{{ (int)($firstItem['quantity'] ?? 1) }} barang x Rp {{ number_format((float)($firstItem['price'] ?? 0), 0, ',', '.') }}

@else

Pesanan Custom

@endif @if($itemCount > 1)

+ {{ $itemCount - 1 }} produk lainnya

@endif

Total Belanja

Rp {{ number_format((float) $order->total_price, 0, ',', '.') }}

Lihat Detail
@empty

Belum ada pesanan

Anda belum pernah melakukan pemesanan untuk status ini.

Belanja Sekarang
@endforelse