Riwayat
Pesanan Saya
@forelse($orders as $index => $order)
@php
$isPending = $order->status === 'pending';
$statusLabel = 'Menunggu Konfirmasi';
$statusBg = 'bg-yellow-50 text-yellow-700 border-yellow-200/60';
$statusIcon = 'fas fa-hourglass-half';
if ($order->status === 'pending') {
$statusLabel = 'Belum Dibayar';
$statusBg = 'bg-[#fff5f5] text-[#8B0000] border-[#8B0000]/10';
$statusIcon = 'fas fa-clock';
} elseif (in_array($order->status, ['confirmed', 'shipped'])) {
$statusLabel = 'Sedang Diproses';
$statusBg = 'bg-blue-50 text-blue-600 border-blue-200/60';
$statusIcon = 'fas fa-fire';
} elseif ($order->status === 'completed') {
$statusLabel = 'Selesai';
$statusBg = 'bg-emerald-50 text-emerald-600 border-emerald-200/60';
$statusIcon = 'fas fa-check-circle';
} elseif ($order->status === 'rejected') {
$statusLabel = 'Dibatalkan';
$statusBg = 'bg-gray-50 text-gray-500 border-gray-200/60';
$statusIcon = 'fas fa-times-circle';
}
$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;
$reviewedOrderIds = $reviewedOrderIds ?? [];
$isReviewed = in_array($order->order_id, $reviewedOrderIds, true);
@endphp
@endforelse
{{-- Card header --}}
{{-- Card body --}}
@empty
{{-- Empty state --}}
{{ $statusLabel }}
{{ optional($order->created_at)->format('d M Y, H:i') }}
@if($order->status === 'completed')
{{-- All items for completed --}}
@endif
{{-- Card footer --}}
@foreach($items as $iIt => $it)
@if(!$loop->last)
@endif
@endforeach
@else
{{-- First item only --}}
@if(isset($it['image']) && $it['image'])
@else
@endif
{{ $it['name'] ?? 'Pesanan Custom' }}
{{ (int)($it['quantity'] ?? 1) }}x · Rp {{ number_format((float)($it['price'] ?? 0), 0, ',', '.') }}
@if($firstItem && isset($firstItem['image']))
@else
@endif
@if($firstItem)
{{ $firstItem['name'] }}
{{ (int)($firstItem['quantity'] ?? 1) }}x · Rp {{ number_format((float)($firstItem['price'] ?? 0), 0, ',', '.') }}
@elsePesanan Custom
@endif @if($itemCount > 1)+ {{ $itemCount - 1 }} produk lainnya
@endif
{{-- Left: ID + total --}}
{{-- Right: actions --}}
{{-- Mobile quick rating --}}
@if($order->status === 'completed' && !$isReviewed)
{{ $order->order_id }}
Rp {{ number_format((float) $order->total_price, 0, ',', '.') }}
@if($order->status === 'completed' && !$isReviewed)
Tulis Ulasan
@elseif($order->status === 'completed' && $isReviewed)
Sudah Diulas
Pesan Lagi
@else
Detail
@endif
Ulasan Cepat
Ulasan Cepat
@endif
Belum ada pesanan
Anda belum pernah melakukan pemesanan untuk status ini. Yuk, mulai pesan sekarang!
Belanja Sekarang