@extends('layouts.admin') @section('title', 'Detail Pesanan #' . $order->order_number) @section('content')

Pesanan #{{ $order->order_number }}

@if ($order->status === 'pending') Pending @elseif ($order->status === 'processing') Processing @elseif ($order->status === 'shipped') Shipped @elseif ($order->status === 'completed') Completed @elseif ($order->status === 'cancelled') Cancelled @else {{ $order->status }} @endif

Waktu Pemesanan: {{ $order->created_at->format('d F Y, H:i') }} WIB

Kembali ke Daftar
Produk yang Dibeli
{{ $order->orderItems->count() }} Variasi Produk ({{ $order->orderItems->sum('quantity') }} unit)
@foreach ($order->orderItems as $item) @endforeach
Item Produk Harga Satuan Quantity Subtotal
@if (!empty($item->product?->image)) {{ $item->product_name }} @else
📦
@endif
{{ $item->product_name }}
Product ID: #{{ $item->product_id }} @if ($item->product) Sisa Stok: {{ $item->product->stock }} @endif
Rp {{ number_format($item->price, 0, ',', '.') }} {{ $item->quantity }} pcs Rp {{ number_format($item->subtotal, 0, ',', '.') }}
Subtotal Produk: Rp {{ number_format($order->subtotal, 0, ',', '.') }}
Ongkos Kirim: {{ $order->shipping_cost > 0 ? 'Rp ' . number_format($order->shipping_cost, 0, ',', '.') : 'Gratis' }}
Total Tagihan: Rp {{ number_format($order->total, 0, ',', '.') }}
Log Waktu & Aktivitas Pesanan
Dibuat Pada {{ $order->created_at->format('d M Y, H:i') }} WIB
Dibayar Pada {{ $order->paid_at ? $order->paid_at->format('d M Y, H:i') . ' WIB' : 'Belum tercatat' }}
Selesai Pada {{ $order->completed_at ? $order->completed_at->format('d M Y, H:i') . ' WIB' : 'Belum selesai' }}
Ubah Status Pesanan
@if ($order->status === 'pending') Pending @elseif ($order->status === 'processing') Processing @elseif ($order->status === 'shipped') Shipped @elseif ($order->status === 'completed') Completed @elseif ($order->status === 'cancelled') Cancelled @endif
@csrf @method('PATCH')
@error('status')
{{ $message }}
@enderror
Jika status diubah ke cancelled, stok produk yang dibeli akan dikembalikan otomatis ke katalog.
Data Buyer / Pemesan
Nama Lengkap {{ $order->user->name ?? 'User Tidak Diketahui' }}
Role Akun {{ $order->user->role ?? 'buyer' }}
Terdaftar Pada {{ $order->user?->created_at ? $order->user->created_at->format('d M Y') : '-' }}
Tujuan Pengiriman
Kontak / No. Telepon {{ $order->shipping_phone }}
Alamat Lengkap

{{ $order->shipping_address }}

{{ $order->shipping_city }}, Kode Pos {{ $order->shipping_postal_code }}
@if (!empty($order->notes))
Catatan dari Buyer:
"{{ $order->notes }}"
@endif
@endsection