@extends('layouts.main') @section('content')

Detail Penjualan

Informasi Pesanan
@php $customerDetails = is_array($order->customer_details) ? $order->customer_details : json_decode($order->customer_details, true); $itemsData = is_array($order->items_data) ? $order->items_data : json_decode($order->items_data, true); @endphp
@if($order->promo_discount_amount > 0) @endif
Order ID: #{{ $order->id }}
Reference ID: {{ $order->order_id }}
Transaction ID: {{ $order->transaction_id ?? '-' }}
Subtotal: Rp {{ number_format($order->subtotal ?? $order->total_amount, 0, ',', '.') }}
Diskon: - Rp {{ number_format($order->promo_discount_amount, 0, ',', '.') }} @if($order->promo_code)
{{ $order->promo_code }} @if($order->promo_discount_type)
Tipe: {{ ucfirst($order->promo_discount_type) }} @if($order->promo_discount_value) ({{ $order->promo_discount_type == 'percentage' ? $order->promo_discount_value . '%' : 'Rp ' . number_format($order->promo_discount_value, 0, ',', '.') }}) @endif @endif @endif
Ongkir: @if($order->shipping_cost > 0) + Rp {{ number_format($order->shipping_cost, 0, ',', '.') }} @else GRATIS @endif
Total Akhir: Rp {{ number_format($order->grand_total ?? $order->total_amount, 0, ',', '.') }}
Status: @if($order->status == 'paid') Lunas @elseif($order->status == 'pending') Pending @elseif($order->status == 'failed') Gagal @elseif($order->status == 'expired') Expired @else {{ ucfirst($order->status) }} @endif
Status Order: @if($order->status_order == 'completed') Selesai @elseif($order->status_order == 'delivered') Terkirim @elseif($order->status_order == 'delivering') Dalam Pengiriman @elseif($order->status_order == 'waiting_pickup') Menunggu Pickup @else {{ ucfirst(str_replace('_', ' ', $order->status_order)) }} @endif
@if($courier) @endif
Payment Method: {{ strtoupper($order->payment_method ?? 'N/A') }}
Paid At: {{ $order->paid_at ? $order->paid_at->format('d/m/Y H:i:s') : '-' }}
Created At: {{ $order->created_at->format('d/m/Y H:i:s') }}
Updated At: {{ $order->updated_at->format('d/m/Y H:i:s') }}
Kurir: {{ $courier->name }}
{{ $courier->email }}
Detail Item Pesanan
@if(is_array($itemsData)) @foreach($itemsData as $item) @endforeach @endif @if($order->promo_discount_amount > 0) @endif
Produk Variant Quantity Harga Satuan Total
{{ $item['product_name'] ?? '-' }} {{ $item['variant_name'] ?? '-' }} {{ $item['quantity'] ?? 0 }} Rp {{ number_format($item['unit_price'] ?? 0, 0, ',', '.') }} Rp {{ number_format($item['total_price'] ?? 0, 0, ',', '.') }}
Subtotal Item: Rp {{ number_format($order->subtotal ?? $order->total_amount, 0, ',', '.') }}
Diskon @if($order->promo_code)({{ $order->promo_code }})@endif: - Rp {{ number_format($order->promo_discount_amount, 0, ',', '.') }}
Ongkir: @if($order->shipping_cost > 0) + Rp {{ number_format($order->shipping_cost, 0, ',', '.') }} @else GRATIS @endif
Total Akhir: Rp {{ number_format($order->grand_total ?? $order->total_amount, 0, ',', '.') }}
Informasi Customer
@if(isset($customerDetails['penerima'])) @endif @if(isset($customerDetails['detail'])) @endif @if(isset($customerDetails['nama_alamat'])) @endif @if(isset($customerDetails['lat']) && isset($customerDetails['lon'])) @endif
Nama: {{ ($customerDetails['first_name'] ?? '') . ' ' . ($customerDetails['last_name'] ?? '') }}
Email: {{ $customerDetails['email'] ?? '-' }}
Phone: {{ $customerDetails['phone'] ?? '-' }}
Penerima: {{ $customerDetails['penerima'] ?? '-' }}
Alamat: {{ $customerDetails['detail'] ?? '-' }}
Nama Alamat: {{ $customerDetails['nama_alamat'] ?? '-' }}
Koordinat: {{ $customerDetails['lat'] ?? '-' }}, {{ $customerDetails['lon'] ?? '-' }} @if($customerDetails['lat'] && $customerDetails['lon'])
Lihat di Maps @endif
@if($order->user)
Informasi User Account
User ID: {{ $order->user->id }}
Nama: {{ $order->user->name }}
Email: {{ $order->user->email }}
@endif @if($order->midtrans_response)
Midtrans Response
@php $midtransData = is_array($order->midtrans_response) ? $order->midtrans_response : json_decode($order->midtrans_response, true); @endphp @if(is_array($midtransData))

{{ json_encode($midtransData, JSON_PRETTY_PRINT) }}
@endif
@endif
@endsection @section('styles') @endsection