<?php $__env->startSection('content'); ?>

    <main id="main" class="main">

        <div class="pagetitle">
          <h1>General Tables</h1>
          <nav>
            <ol class="breadcrumb">
              <li class="breadcrumb-item"><a href="index.html">Home</a></li>
              <li class="breadcrumb-item">Tables</li>
              <li class="breadcrumb-item active">General</li>
            </ol>
          </nav>
        </div><!-- End Page Title -->

        <section class="section">
            <div class="row">
                <div class="col-lg-12">
                    <div class="card">
                        <div class="card-body">
                          <h5 class="card-title">Default Table</h5>

                          <!-- Default Table -->
                            <table class="table">
                                <thead>
                                    <tr>
                                        <th scope="col">Sr No</th>
                                        <th scope="col">Order Id</th>
                                        <th scope="col">Oredered Product</th>
                                        <th scope="col">Client Name</th>
                                        <th scope="col">Order Staus</th>
                                        <th scope="col">Agent Status</th>
                                        <th scope="col">View</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <?php $i = 0; ?>
                                    <?php $__currentLoopData = $order; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $orders): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <?php
                                            $orderDetails = $order_details->where('order_id', $orders->id);

                                            $productsForOrder = $products->whereIn('id', $orderDetails->pluck('product_id'));
                                        ?>

                                        <?php if($orderDetails->isNotEmpty()): ?>
                                            <?php $i++; ?>
                                            <tr>
                                                <th scope="row"><?php echo e($i); ?></th>
                                                <td><?php echo e($orders->unique_order_id); ?></td>
                                                <td><?php echo e($orders->created_at); ?></td>
                                                <td><?php echo e($orders->user_id); ?></td>
                                                <td>
                                                    <?php if($orders->order_delivery_status == 'P'): ?>
                                                        <div>PENDING</div>
                                                    <?php elseif($orders->order_delivery_status == 'PC'): ?>
                                                        <div>PROCESS</div>
                                                    <?php elseif($orders->order_delivery_status == 'CL'): ?>
                                                        <div>CANCELED</div>
                                                    <?php elseif($orders->order_delivery_status == 'H'): ?>
                                                        <div>HOLD</div>
                                                    <?php elseif($orders->order_delivery_status == 'D'): ?>
                                                        <div>Delivered</div>
                                                    <?php elseif($orders->order_delivery_status == 'S'): ?>
                                                        <div>Shipped</div>
                                                    <?php endif; ?>
                                                </td>
                                                <td>
                                                    <!-- Display all associated products for this order -->
                                                    <?php echo $productsForOrder->pluck('product_name')->implode('<br>'); ?>

                                                </td>
                                                <td>
                                                    <?php if($orders->order_delivery_status == 'PC' || $orders->order_delivery_status == 'CL' || $orders->order_delivery_status == 'S' || $orders->order_delivery_status == 'D' || $orders->order_delivery_status == 'H'): ?>
                                                        <div>
                                                            Agent Assigned
                                                        </div>
                                                    <?php else: ?>
                                                        <div>
                                                            Agent Not Assigned Yet
                                                        </div>
                                                    <?php endif; ?>
                                                </td>
                                                <td><a href="<?php echo e(url('/viewProduct')); ?>/<?php echo e($orders->id); ?>" class="btn btn-primary">VIEW</a></td>
                                            </tr>
                                        <?php endif; ?>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                </tbody>
                            </table>
                          <!-- End Default Table Example -->
                        </div>
                    </div>
                </div>
            </div>
        </section>
        
    </main><!-- End #main -->
            

    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"></script>

<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.admin.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/adminrighflorist/public_html/resources/views/admin/productAssign.blade.php ENDPATH**/ ?>