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



        <!-- End of Topbar -->

        <!-- Begin Page Content -->
        <div class="container-fluid">



    <div class="row">
         <!-- DataTales Example -->
              <div class="card shadow" style="width:100%">
                <div class="card-header py-3">
                  <h6 class="m-0 font-weight-bold text-primary">Next day orders</h6>
                  <?php if(count($errors) > 0): ?>
                              <?php if($errors->any()): ?>
                                <div class="alert alert-primary" role="alert">
                                  <?php echo e($errors->first()); ?>

                                  <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                                    <span aria-hidden="true">×</span>
                                  </button>
                                </div>
                              <?php endif; ?>
                          <?php endif; ?>
                </div>
                <div class="card-body">
                  <div class="table-responsive">
                    <table class="table table-bordered" id="example3" width="100%" cellspacing="0">
                      <thead>
                        <tr>
                        <th>S.No</th>
                        <th>Cart Id</th>
                        <th>Total Price</th>
                        <th>Products Price</th>
                        <th>Delivery charge</th>
                        <th>Delivery Date</th>
                        <th>User Name</th>
                        <th>Order Details</th>
                        <th>Assign</th>
                        </tr>
                      </thead>
                      
                      <tbody>
                      <?php if(count($nextdayorder)>0): ?>
                                      <?php $i=1; ?>
                                      <?php $__currentLoopData = $nextdayorder; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $nextdayorders): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                    <tr>
                                        <td><?php echo e($i); ?></td>
                                        <td><?php echo e($nextdayorders->order_cart_id); ?></td>
                                        <td><?php echo e($nextdayorders->total_price); ?></td>
                                         <td><?php echo e($nextdayorders->products_price); ?></td>
                                         <td><?php echo e($nextdayorders->delivery_charge); ?></td>
                                        <td><?php echo e($nextdayorders->delivery_date); ?></td>
                                        <td><?php echo e($nextdayorders->user_name); ?></td>
                                         <td><button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModal1<?php echo e($nextdayorders->order_cart_id); ?>">Details</button></td>
                                       
                                       <td>
                                            <?php if($nextdayorders->delivery_boy_id == "N/A"): ?>               
                							<button type="button" class="btn btn-danger" data-toggle="modal" data-target="#exampleModal<?php echo e($nextdayorders->order_id); ?>">Assign</button>
                							
                							 <?php else: ?>
                							 <button type="button" class="btn btn-danger" data-toggle="modal" data-target="#exampleModal<?php echo e($nextdayorders->order_id); ?>">Assigned/edit<span>
                							 (<?php echo e($nextdayorders->delivery_boy_name); ?>)</span></button></button>
                							 <?php endif; ?>
                                        </td>
            
                                    </tr>
                                     <div class="modal fade" id="exampleModal<?php echo e($nextdayorders->order_id); ?>" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
                                	<div class="modal-dialog" role="document">
                                		<div class="modal-content">
                                			<div class="modal-header">
                                				<h5 class="modal-title" id="exampleModalLabel">Assign Delivery Boy/ Incentive</h5>
                                					<button type="button" class="close" data-dismiss="modal" aria-label="Close">
                                						<span aria-hidden="true">&times;</span>
                                					</button>
                                			</div>
                                			<?php if($boy_area_id !='N/A'): ?>
                                			<!--//form-->
                                			<form action="<?php echo e(route('assigned_order')); ?>" method="post">   
                                			<?php echo e(csrf_field()); ?>

                                			<div class="modal-body">
                                			 <div class="form-group">
                                                <label for="exampleFormControlSelect3">choose a Delivery Boy<sup>*</sup></label>
                                                <select class="form-control form-control-sm" id="exampleFormControlSelect3 " name="delivery_boy_name">
                                                  <?php $__currentLoopData = $delivery_boy; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $delivery_boys): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                  <?php if($delivery_boys->area_id==$nextdayorders->area_id): ?>
                            		          	    <option value="<?php echo e($delivery_boys->delivery_boy_id); ?>"><span style="font-weight:bold"><?php echo e($delivery_boys->delivery_boy_name); ?></span> 
                            		          	    </option>
                            		          	  <?php endif; ?>
                            		              <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                                  
                                                  
                                                </select>
                                                </div>
                                                
                                                  <!--<label for="exampleInputName1">Incentive for this order</label>-->
                                                  <!--<input type="text" class="form-control" id="exampleInputName1" name="incentive" placeholder="Incentive for this order">-->
                                                  <input type="hidden" class="form-control" name="order_id" value=<?php echo e($nextdayorders->order_id); ?>>
                                                
                                                
                                			</div>
                                			<div class="modal-footer">
                                			    <button type="submit" class="btn btn-success mr-2">Assign</button>
                                				<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
                                			</div>
                                			</form>
                                			<!--//form-->
                                			<?php else: ?>
                                			<h4>Uh-Oh! your delivery boys for this delivery area are offline</h4>
                                			<?php endif; ?>
                                		</div>
                                	</div>
                                </div>
                                    <?php $i++; ?>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                  <?php else: ?>
                                    <tr>
                                      <td>No data found</td>
                                    </tr>
                                  <?php endif; ?>
                                   
                      </tbody>
                    </table>
                  </div>
                </div>
              </div>

          </div>

        </div>
        <!-- /.container-fluid -->
          
          <?php $__currentLoopData = $nextdayorder; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $nextdayorders): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <div class="modal fade" id="exampleModal1<?php echo e($nextdayorders->order_cart_id); ?>" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
                                	<div class="modal-dialog" role="document">
                                		<div class="modal-content">
                                			<div class="modal-header">
                                				<h5 class="modal-title" id="exampleModalLabel">Order Details</h5>
                                					<button type="button" class="close" data-dismiss="modal" aria-label="Close">
                                						<span aria-hidden="true">&times;</span>
                                					</button>
                                			</div>
                                			<!--//form-->
                                			<table class="table table-bordered" id="example3" width="100%" cellspacing="0">
                                              <thead>
                                                <tr>
                                                <th>S.No</th>
                                                <th>product details</th>
                                                <th>Price</th>
                                                </tr>
                                              </thead>
                                              
                                              <tbody>
                                              <?php if(count($details)>0): ?>
                                                              <?php $i=1; ?>
                                                              
                                                  <tr>             
                                                <?php $__currentLoopData = $details; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $detailss): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                  <?php if($detailss->cart_id==$nextdayorders->order_cart_id): ?>
                            		          	   
                                                                <td><img style="width:100px;height:100px; border-radius:50%" src="<?php echo e(url($detailss->varient_image)); ?>" alt="$detailss->product_name"></td>
                                                                <td><h6><?php echo e($detailss->product_name); ?></h6>
                                                                <?php if($detailss->varient_color != NULL): ?>
                                                                <p style="margin-bottom:0px !important"><b>color :&nbsp;</b><span style="color:grey"><?php echo e($detailss->varient_color); ?></span></p>
                                                                <?php endif; ?>
                                                                 <?php if($detailss->varient_size != NULL): ?>
                                                                <p style="margin-bottom:0px !important"><b>size :&nbsp;</b><span style="color:grey"><?php echo e($detailss->varient_size); ?></span></p>
                                                                <?php endif; ?>
                                                                 <?php if($detailss->varient_unit != NULL && $detailss->varient_unit_value != NULL): ?>
                                                                <p style="margin-bottom:0px !important"><b><?php echo e($detailss->varient_unit_value); ?>&nbsp; <?php echo e($detailss->varient_unit); ?></b></p>
                                                                <?php endif; ?>
                                                        
                                                                </td>
                                                                <td>  <?php if($nextdayorders->order_type =='Subscribe'): ?>
                                                                 <?php if($detailss->subscription_price != NULL): ?>
                                                                <p><span style="color:grey"><?php echo e($detailss->subscription_price); ?></span></p>
                                                                <?php endif; ?>
                                                                <?php else: ?>
                                                                 <?php if($detailss->price != NULL): ?>
                                                                <p><span style="color:grey"><?php echo e($detailss->price); ?></span></p>
                                                                <?php endif; ?>
                                                                <?php endif; ?></td>
                                                                
                                                   
                            		          	  <?php endif; ?>
                                                 </tr>
                                                    <?php $i++; ?>
                                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                                  <?php else: ?>
                                                    <tr>
                                                      <td>No data found</td>
                                                    </tr>
                                                          <?php endif; ?>
                                                           
                                              </tbody>
                                            </table>
                                			<!--//form-->
                                		</div>
                                	</div>
                                </div>
                                
         <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>                       

             
      </div>
      <!-- End of Main Content -->

<?php $__env->stopSection(); ?>        
<?php echo $__env->make('vendor.layout.app', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>