<?php echo $__env->make('layouts.head', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>
<body>
<?php echo $__env->make('layouts.topbar', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>
<?php echo $__env->make('layouts.Adminnavbar', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>

<div class="container py-5">
    <h2 class="mb-4 text-center fw-bold">Manage Orders</h2>

    <table class="table table-striped table-hover">
        <thead>
            <tr>
                <th>#ID</th>
                <th>Customer</th>
                <th>Phone</th>
                <th>Items</th>
                <th>Total (Tsh)</th>
                <th>Actions</th>
            </tr>
        </thead>
        <tbody>
            <?php $__empty_1 = true; $__currentLoopData = $orders ?? []; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $order): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
    <tr>
        <td><?php echo e($order->id); ?></td>
        <td><?php echo e($order->name); ?></td>
        
        <td><?php echo e($order->phone); ?></td>
        <td>
            <?php if(!empty($order->items)): ?>
                <?php echo e(collect($order->items)->pluck('name')->join(', ')); ?>

            <?php else: ?>
                N/A
            <?php endif; ?>
        </td>
        <td><?php echo e(number_format($order->total, 2)); ?></td>
        <td>
            <a href="<?php echo e(route('admin.orders.show', $order->id)); ?>" class="btn btn-sm btn-info">View</a>
            <form action="<?php echo e(route('admin.orders.destroy', $order->id)); ?>" method="POST" class="d-inline-block">
                <?php echo csrf_field(); ?>
                <?php echo method_field('DELETE'); ?>
                <button class="btn btn-sm btn-danger" onclick="return confirm('Delete this order?')">Delete</button>
            </form>

        </td>
    </tr>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
    <tr>
        <td colspan="6" class="text-center text-muted">No orders found.</td>
    </tr>
<?php endif; ?>

        </tbody>
    </table>
    <div class="d-flex justify-content-center mt-4">
    <?php echo e($orders->links('pagination::bootstrap-5')); ?>

</div>
</div>

<?php echo $__env->make('layouts.footer', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>
<?php echo $__env->make('layouts.links', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>
</body>
</html>
<?php /**PATH /home/u905600066/domains/kauka.medicalsean.com/public_html/resources/views/admin/orders/index.blade.php ENDPATH**/ ?>