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

    <main id="main" class="main">
        <div class="container">
            <form action="<?php echo e(url('/admin/order/productAssign')); ?>" method="post">
                    <?php echo csrf_field(); ?>
                    <table class="table" styla="margin-top:10%;">
                        <thead>
                            <tr>
                                <th>From Date</th>
                                <th>To Date</th>
                                <th>Select the Status</th>
                                <th></th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr>
                                <td><input type="date" name="fromDate" id="FromDate" class="form-control" required /></td>
                                <td><input type="date" name="toDate" id="toDate" class="form-control" required /></td>
                                <td>
                                    <select name="status" id="status" class="form-control" required>
                                        <option value="" selected>SELECT STATUS</option>
                                        <option value="P">PENDING</option>
                                        <option value="PC">PROCESSED</option>
                                        <option value="S">SHIPPED</option>
                                        <option value="D">DELIVERED</option>
                                        <option value="H">HOLD</option>
                                        <option value="CL">CANCELED</option>
                                    </select>
                                </td>
                                <td><button class="btn btn-primary" type="submit">Search</button></td>
                            </tr>
                        </tbody>
                    </table>
            </form>
            <table class="table">
                <?php if($agent_assigned->isEmpty()): ?>
                    No Data Found
                <?php else: ?>
                    <thead>
                        <tr>
                            <th scope="col">Sr No</th>
                            <th scope="col">Assign Order Id</th>
                            <th scope="col">Order id</th>
                            <th scope="col">Agent Name</th>
                            <th scope="col">Product Name</th>
                            <th scope="col">Delivery Date</th>
                            <th scope="col">Delivery Status</th>
                            
                            <th scope="col">Acion</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php $i = 0; ?>
                        <?php $__currentLoopData = $agent_assigned; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $agent_assigneds): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <?php $i++; ?>
                            <tr>
                                <th scope="row"><?php echo e($i); ?></th>
                                <td><?php echo e($agent_assigneds->agent_order_id); ?></td>
                                <td>
                                    <?php
                                        $orderId = null;
                                    ?>
                                    <?php $__currentLoopData = $assined; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $assineds): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <?php $__currentLoopData = $orders; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $order): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                            <?php if($assineds->OID == $order->id): ?>
                                                <?php echo e($order->unique_order_id); ?>

                                                <?php
                                                    $orderId = $order->id;
                                                    break 2;
                                                ?>
                                            <?php endif; ?>
                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                </td>
                                <td>
                                    <?php $__currentLoopData = $agents; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $agent): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <?php if($agent_assigneds->agent_id == $agent->id): ?>
                                            <?php echo e($agent->name); ?>

                                            <?php break; ?>
                                        <?php endif; ?>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                </td>
                                <td>
                                    <?php
                                        $printedProducts = [];
                                    ?>
                                    <?php $__currentLoopData = $product_maped; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $product_mapeds): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <?php if($product_mapeds->agent_assinged_id == $agent_assigneds->id): ?>
                                            <?php $__currentLoopData = $agent_product_list; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $product): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                <?php if($product->id == $product_mapeds->product_id && !in_array($product->id, $printedProducts)): ?>
                                                    <?php echo e($product->item); ?><br>
                                                    <?php
                                                        $printedProducts[] = $product->id; 
                                                    ?>
                                                <?php endif; ?>
                                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                        <?php endif; ?>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                </td>
                                <td>
                                    <?php
                                        $founddetails = false;
                                    ?>
                                    <?php $__currentLoopData = $order_details; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $order_detail): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <?php if($order_detail->order_id == $agent_assigneds->OID): ?>
                                            <?php echo e($order_detail->delivery_date); ?>

                                            <?php
                                                $founddetails = true;
                                                break;
                                            ?>
                                        <?php endif; ?>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                </td>
                                <td>
                                    <?php if($agent_assigneds->status=='P'): ?>
                                        <h6><span class="badge bg-danger">PENDING</span></h6>
                                    <?php elseif($agent_assigneds->status=='PC'): ?>
                                        <h6><span class="badge bg-info">PROGRESS</span></h6>
                                    <?php elseif($agent_assigneds->status=='CL'): ?>
                                        <h6><span class="badge bg-dark">CANCEL</span></h6>
                                    <?php elseif($agent_assigneds->status=='H'): ?>
                                        <h6><span class="badge bg-warning">HOLD</span></h6>
                                    <?php elseif($agent_assigneds->status=='D'): ?>
                                        <h6><span class="badge bg-success">DELIVERED</span></h6>
                                    <?php elseif($agent_assigneds->status=='S'): ?>
                                        <h6><span class="badge bg-primary">SHIPPED</span></h6>
                                    <?php endif; ?>
                                </td>
                                
                                <td><a href="<?php echo e(url('/admin/order/dashboard')); ?>/<?php echo e(encrypt($agent_assigneds->agent_order_id)); ?>/<?php echo e(encrypt($agent_assigneds->agent_id)); ?>" class="btn btn-dark btn-sm"><i class="ri-file-edit-fill"></i></a></td>
                            </tr>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    </tbody>
                <?php endif; ?>    
            </table>
            <a class="btn btn-danger" href="<?php echo e(url('/admin/order/main')); ?>">Back</a>
        </div>
    </main>

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