[Back]
<?php $__env->startSection('content'); ?>
<div class="flex items-center justify-between mb-6">
<div>
<h1 class="text-2xl font-bold">Order <?php echo e($order->order_no); ?></h1>
<p class="text-sm text-gray-600">Created: <?php echo e($order->created_at->format('Y-m-d H:i')); ?></p>
</div>
<a href="<?php echo e(route('admin.orders.index')); ?>" class="underline">Back</a>
</div>
<div class="grid lg:grid-cols-3 gap-6">
<div class="lg:col-span-2 space-y-6">
<div class="bg-white rounded-xl shadow p-6">
<h2 class="font-semibold mb-4">Items</h2>
<div class="space-y-3 text-sm">
<?php $__currentLoopData = $order->items; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<div class="flex justify-between">
<div>
<div class="font-medium"><?php echo e($item->product->name ?? 'Deleted product'); ?></div>
<div class="text-xs text-gray-500">
Qty: <?php echo e($item->quantity); ?> × RM <?php echo e(number_format($item->unit_price_cents/100, 2)); ?>
</div>
</div>
<div class="font-medium">
RM <?php echo e(number_format($item->line_total_cents/100, 2)); ?>
</div>
</div>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</div>
<hr class="my-4">
<div class="flex justify-between font-bold">
<div>Total</div>
<div>RM <?php echo e(number_format($order->total_cents/100, 2)); ?></div>
</div>
</div>
<div class="bg-white rounded-xl shadow p-6">
<h2 class="font-semibold mb-4">Payment (FPX)</h2>
<?php if($order->payment): ?>
<div class="text-sm space-y-2">
<div><span class="text-gray-500">Provider:</span> <?php echo e($order->payment->provider); ?></div>
<div><span class="text-gray-500">Status:</span> <?php echo e($order->payment->status); ?></div>
<div><span class="text-gray-500">Reference:</span> <?php echo e($order->payment->reference ?? '-'); ?></div>
<?php if($order->payment->payload): ?>
<details class="mt-3">
<summary class="cursor-pointer text-sm underline">View payload</summary>
<pre class="mt-2 p-3 bg-gray-50 rounded text-xs overflow-auto"><?php echo e(json_encode($order->payment->payload, JSON_PRETTY_PRINT)); ?></pre>
</details>
<?php endif; ?>
</div>
<?php else: ?>
<div class="text-sm text-gray-600">No payment record found.</div>
<?php endif; ?>
</div>
</div>
<div class="space-y-6">
<div class="bg-white rounded-xl shadow p-6">
<h2 class="font-semibold mb-4">Customer</h2>
<div class="text-sm space-y-2">
<div><span class="text-gray-500">Name:</span> <?php echo e($order->customer_name ?? '-'); ?></div>
<div><span class="text-gray-500">Phone:</span> <?php echo e($order->customer_phone ?? '-'); ?></div>
<div><span class="text-gray-500">User ID:</span> <?php echo e($order->user_id); ?></div>
</div>
</div>
<div class="bg-white rounded-xl shadow p-6">
<h2 class="font-semibold mb-4">Order Status</h2>
<div class="mb-3 text-sm">
Current: <span class="px-2 py-1 rounded bg-gray-100"><?php echo e($order->status); ?></span>
</div>
<form method="POST" action="<?php echo e(route('admin.orders.status', $order)); ?>" class="space-y-3">
<?php echo csrf_field(); ?>
<?php echo method_field('PATCH'); ?>
<select name="status" class="w-full rounded border-gray-300">
<?php $__currentLoopData = ['pending','payment_pending','paid','failed','cancelled']; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $st): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<option value="<?php echo e($st); ?>" <?php echo e($order->status === $st ? 'selected' : ''); ?>>
<?php echo e($st); ?>
</option>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</select>
<button class="w-full px-4 py-2 rounded bg-black text-white">
Update Status
</button>
</form>
<p class="text-xs text-gray-500 mt-3">
While FPX is stubbed, you can manually set status to “paid” after you confirm payment.
</p>
</div>
</div>
</div>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('layouts.public', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\Users\nashr\Repo\landing-fpx\resources\views/admin/orders/show.blade.php ENDPATH**/ ?>