[Back]

<?php $__env->startSection('content'); ?>
<div class="flex items-center justify-between mb-6">
    <h1 class="text-2xl font-bold">Orders</h1>

    <div class="flex gap-2">
        <a class="px-3 py-2 rounded border text-sm" href="<?php echo e(route('admin.orders.index')); ?>">All</a>
        <a class="px-3 py-2 rounded border text-sm" href="<?php echo e(route('admin.orders.index', ['status' => 'payment_pending'])); ?>">Payment Pending</a>
        <a class="px-3 py-2 rounded border text-sm" href="<?php echo e(route('admin.orders.index', ['status' => 'paid'])); ?>">Paid</a>
        <a class="px-3 py-2 rounded border text-sm" href="<?php echo e(route('admin.orders.index', ['status' => 'failed'])); ?>">Failed</a>
    </div>
</div>

<div class="bg-white rounded-xl shadow overflow-hidden">
    <table class="w-full text-sm">
        <thead class="bg-gray-50">
            <tr>
                <th class="p-4 text-left">Order No</th>
                <th class="p-4 text-left">Customer</th>
                <th class="p-4 text-left">Total</th>
                <th class="p-4 text-left">Status</th>
                <th class="p-4 text-left">Payment</th>
                <th class="p-4 text-right">Action</th>
            </tr>
        </thead>
        <tbody>
        <?php $__empty_1 = true; $__currentLoopData = $orders; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $o): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
            <tr class="border-t">
                <td class="p-4 font-medium"><?php echo e($o->order_no); ?></td>
                <td class="p-4">
                    <div class="font-medium"><?php echo e($o->customer_name ?? '-'); ?></div>
                    <div class="text-xs text-gray-500"><?php echo e($o->customer_phone ?? '-'); ?></div>
                </td>
                <td class="p-4">RM <?php echo e(number_format($o->total_cents/100, 2)); ?></td>
                <td class="p-4">
                    <span class="px-2 py-1 rounded text-xs bg-gray-100"><?php echo e($o->status); ?></span>
                </td>
                <td class="p-4">
                    <span class="px-2 py-1 rounded text-xs bg-gray-100">
                        <?php echo e($o->payment->status ?? 'no payment row'); ?>

                    </span>
                </td>
                <td class="p-4 text-right">
                    <a class="underline" href="<?php echo e(route('admin.orders.show', $o)); ?>">View</a>
                </td>
            </tr>
        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
            <tr>
                <td class="p-6 text-gray-600" colspan="6">No orders yet.</td>
            </tr>
        <?php endif; ?>
        </tbody>
    </table>
</div>

<div class="mt-6">
    <?php echo e($orders->links()); ?>

</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/index.blade.php ENDPATH**/ ?>