@extends('layouts.content') @section('content')
Kembali ke Pesanan @if (session('error'))
{{ session('error') }}
@endif @if (session('success'))
{{ session('success') }}
@endif

{{ $order->invoice_number }}

{{ $order->created_at->translatedFormat('d M Y H:i') }}
@php $statusColor = '#f59e0b'; $statusLabel = 'Menunggu'; $statusIcon = 'bi-clock'; if ($order->order_status === 'processing') { $statusLabel = 'Dikemas'; $statusColor = '#f59e0b'; $statusIcon = 'bi-box-seam'; } elseif ($order->order_status === 'shipped') { $statusLabel = 'Dikirim'; $statusColor = '#3b82f6'; $statusIcon = 'bi-truck'; } elseif ($order->order_status === 'completed') { $statusLabel = 'Selesai'; $statusColor = '#10b981'; $statusIcon = 'bi-check-circle'; } elseif ($order->order_status === 'cancelled') { $statusLabel = 'Dibatalkan'; $statusColor = '#ef4444'; $statusIcon = 'bi-x-circle'; } @endphp {{ $statusLabel }}
@if($order->order_status === 'completed')
Beri Ulasan
@endif
Produk Dibeli
@forelse($order->details as $detail) @php $pkg = $detail->package; $prod = $pkg?->product; $photoUrl = asset('assets/img/selada.png'); if ($prod && $prod->media->isNotEmpty()) { $mainMedia = $prod->media->firstWhere('is_main', true) ?? $prod->media->first(); $ext = strtolower(pathinfo($mainMedia->getRawOriginal('file_url'), PATHINFO_EXTENSION)); if (in_array($ext, ['jpg','jpeg','png','webp','gif','heic'])) { $photoUrl = $mainMedia->file_url; } } @endphp
{{ $prod->product_name ?? '-' }}
{{ $prod->product_name ?? '-' }}
Varian: {{ $pkg->weight_in_kg ? $pkg->weight_in_kg . ' Kg' : '-' }}
{{ $detail->quantity }} x Rp {{ number_format($detail->unit_price, 0, ',', '.') }} Rp {{ number_format($detail->quantity * $detail->unit_price, 0, ',', '.') }}
@empty
Tidak ada detail produk.
@endforelse
Rincian Pembayaran
Total Produk Rp {{ number_format($order->total_product_price, 0, ',', '.') }}
Ongkos Kirim ({{ $order->total_weight_kg }} kg) Rp {{ number_format($order->shipping_cost, 0, ',', '.') }}
@if($order->coupon_discount_nominal > 0)
Diskon Kupon - Rp {{ number_format($order->coupon_discount_nominal, 0, ',', '.') }}
@endif
Total Pembayaran Rp {{ number_format($order->total_payment, 0, ',', '.') }}
@if($order->payment_status)
Status Pembayaran: {{ ucfirst($order->payment_status) }}
@endif
Pengiriman
@if($order->address)
{{ $order->address->recipient_name }}
{{ $order->address->recipient_phone }}
{{ $order->address->full_address }}, {{ $order->address->village ? $order->address->village . ', ' : '' }} {{ $order->address->district }}, {{ $order->address->city }}, {{ $order->address->province }} {{ $order->address->postal_code }}
@endif @if(!empty($order->tracking_number) && trim($order->tracking_number) !== '')
Nomor Resi: {{ $order->tracking_number }}
@endif @if(in_array($order->order_status, ['processing', 'shipped', 'completed']) && $order->rate && !empty($order->rate->estimated_days))
Estimasi Sampai: {{ $order->rate->estimated_days }} hari
@endif
@if($order->coupon)
Kupon
{{ $order->coupon->coupon_code }} - Rp {{ number_format($order->coupon_discount_nominal, 0, ',', '.') }}
@endif
@endsection