@extends('layouts.admin') @section('title', 'Detail Pesanan #' . $order->order_number) @section('page_title', 'Detail Pesanan') @section('breadcrumb') Pesanan / {{ $order->order_number }} @endsection @section('topbar_actions') Kembali @endsection @section('content') @if($errors->any())
@endif
{{-- LEFT: Order Items + Address --}}
{{-- Order Items Card --}}
Produk yang Dibeli

{{ $order->orderItems->count() }} macam produk, total {{ $order->orderItems->sum('quantity') }} unit

{{ $order->order_number }}
@foreach($order->orderItems as $item) @endforeach
Produk Harga Satuan Qty Subtotal
@if($item->product && $item->product->image) @php $orderItemImg = \Illuminate\Support\Str::startsWith($item->product->image, ['http://', 'https://']) ? $item->product->image : asset('storage/' . $item->product->image); @endphp {{ $item->product_name }} @else
@endif
{{ $item->product_name }}
@if($item->product)
Stok terkini: {{ $item->product->stock }} unit
@endif
Rp {{ number_format($item->price, 0, ',', '.') }} {{ $item->quantity }} Rp {{ number_format($item->subtotal, 0, ',', '.') }}
Total Pembayaran: Rp {{ number_format($order->total, 0, ',', '.') }}
{{-- Shipping Address Card --}}
Alamat Pengiriman

{{ $order->shipping_address ?: 'Alamat pengiriman belum diisi oleh pembeli.' }}

{{-- RIGHT: Update Status + Buyer Info --}}
{{-- Current Status --}}
Status Pesanan
{{-- Current Status Badge --}}
Status Saat Ini:
@php $statusStyles = [ 'pending' => 'background:#fef3c7;color:#92400e;border:1px solid #fde68a;', 'processing' => 'background:#e0f2fe;color:#075985;border:1px solid #bae6fd;', 'shipped' => 'background:#fdf2f8;color:#db2777;border:1px solid #fbcfe8;', 'completed' => 'background:#dcfce7;color:#166534;border:1px solid #bbf7d0;', 'cancelled' => 'background:#fff1f2;color:#be123c;border:1px solid #fecdd3;', ]; $statusIcons = [ 'pending' => 'bi-hourglass-split', 'processing' => 'bi-arrow-repeat', 'shipped' => 'bi-truck', 'completed' => 'bi-check-circle-fill', 'cancelled' => 'bi-x-circle-fill', ]; $s = $order->status; $cStyle = $statusStyles[$s] ?? 'background:#f1f5f9;color:#475569;border:1px solid #e2e8f0;'; $cIcon = $statusIcons[$s] ?? 'bi-circle'; @endphp {{ ucfirst($s) }}
{{-- Update Status Form --}}
@csrf @method('PATCH')
@error('status')
{{ $message }}
@enderror
{{-- Buyer Info Card --}}
Data Pembeli
@if($order->user)
{{ strtoupper(substr($order->user->name, 0, 2)) }}
{{ $order->user->name }}
{{ ucfirst($order->user->role) }}
Email: {{ $order->user->email }}
User ID: #{{ $order->user->id }}
Bergabung: {{ $order->user->created_at->format('d M Y') }}
Waktu Pesan: {{ $order->created_at->format('d M Y, H:i') }}
@else
Data pengguna tidak ditemukan atau akun telah dihapus.
@endif
@endsection