<style>
    @media  screen {
  #printSection {
      display: none;
  }
}

@media  print {
  body * {
    visibility:hidden;
  }
  #printSection, #printSection * {
    visibility:visible;
  }
  #printSection {
    position:absolute;
    left:0;
    top:0;
  }
}

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

          <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"><?php echo e(__('messages.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="example2" width="100%" cellspacing="0">
                      <thead>
                        <tr>
                        <th><?php echo e(__('messages.s_n')); ?></th>
                        <th><?php echo e(__('messages.Cart_Id')); ?></th>
                        <th><?php echo e(__('messages.Total_Price')); ?></th>
                        <th><?php echo e(__('messages.Products_Price')); ?></th>
                        <th><?php echo e(__('messages.Delivery_charge')); ?></th>
                        <th><?php echo e(__('messages.Delivery_Date')); ?></th>
                        <th><?php echo e(__('messages.User_Name')); ?></th>
                        <th><?php echo e(__('messages.Details')); ?></th>
                        <th><?php echo e(__('messages.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_id); ?></td>
                                        <td><?php echo e($nextdayorders->total_price); ?></td>
                                         <td><?php echo e($nextdayorders->total_products_mrp); ?></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_id); ?>">Details</button></td>
                                       <td>
                            <?php if($nextdayorders->dboy_id == "0"): ?>               
							<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>
							 <?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>
                                                <input type="hidden" name="order_id" value="<?php echo e($nextdayorders->order_id); ?>">
                                                <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="subs_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><?php echo e(__('messages.No_data_found')); ?></td>
                                    </tr>
                                  <?php endif; ?>
                                   
                      </tbody>
                    </table>
                  </div>
                </div>
              </div>

          </div>

        </div>
        <!-- /.container-fluid -->
<!--/////////details model//////////-->
<?php $__currentLoopData = $nextdayorder; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $nextdayorders): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>

 <div id="printThis">
<div class="modal fade" id="exampleModal1<?php echo e($nextdayorders->order_id); ?>" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
    <div class="container">
     
    	<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>
        <div class="material-datatables">
              <form role="form" method="post" action="" >
            <table id="datatables" class="table table-striped table-no-bordered table-hover" cellspacing="0" width="100%" style="width:100%" data-background-color="purple">

                
                <tbody>
                    <tr>
                        <td colspan="3">
                            <table class="table">
                                <tr>
                                    <td valign="top" style="width:50%">
                                    <strong> Order Id : </strong> <?php echo e($nextdayorders->cart_id); ?>

                                    <br />

                                    <strong>  Delivery Date : </strong><?php echo e($nextdayorders->delivery_date); ?>

                                    <br />
                                    <strong>  Time Slot : </strong><?php echo e($nextdayorders->time_slot); ?>

                                    <br />
                                    </td>
                                    <td  style="width:50%" align="right">
                                        <strong> Delivery Details </strong><br />
                                        <strong>Customer name : </strong><?php echo e($nextdayorders->user_name); ?><br/>
                                        <strong>Contact : </strong><?php echo e($nextdayorders->user_number); ?><br/> 
                                        <strong>Address : </strong> <?php echo e($nextdayorders->address); ?><br />
                                     </td>
                                    
                                </tr>
                            </table>
                        </td>
                    </tr>

                    <tr>
                        <th>Product Name</th>
                        <th>Qty</th>
                        <th>Total Price</th>
                    </tr>
                    <?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->cart_id): ?>
                         <td><?php echo e($detailss->product_name); ?>(<?php echo e($detailss->quantity); ?><?php echo e($detailss->unit); ?>)
                            </td>
                            <td><?php echo e($detailss->qty); ?></td>
                            <td> 
                            <p><span style="color:grey"><?php echo e($detailss->price); ?></span></p>
                           </td>
    		          	  <?php endif; ?>
                         </tr>
                            <?php $i++; ?>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                          <?php else: ?>
                            <tr>
                              <td>No data found</td>
                            </tr>
                                  <?php endif; ?>
                   
                   
                    <tr>
                        <td colspan="2"><strong class="pull-right">Products Price : </strong></td>
                         <td >
                            <strong class=""><?php echo e($nextdayorders->price_without_delivery); ?></strong>
                        </td>
                    </tr><tr>
                        <td colspan="2"><strong class="pull-right">Delivery Charge : </strong></td>
                         <td >
                            <strong class="">+<?php echo e($nextdayorders->delivery_charge); ?></strong>
                        </td>
                    </tr><?php if($nextdayorders->paid_by_wallet > 0): ?>
                    <tr>    
                        <td colspan="2"><strong class="pull-right">Paid By Wallet : </strong></td>
                         <td >
                            <strong class="">-<?php echo e($nextdayorders->paid_by_wallet); ?></strong>
                        </td>
                    </tr><?php endif; ?>
                    <?php if($nextdayorders->coupon_discount > 0): ?>
                    <tr>    
                        <td colspan="2"><strong class="pull-right">Coupon Discount : </strong></td>
                         <td >
                            <strong class="">-<?php echo e($nextdayorders->coupon_discount); ?></strong>
                        </td>
                    </tr>
                    <?php endif; ?>
                    <tr>
                        <td colspan="2"><strong class="pull-right">Net Total(Payable) :</strong></td>
                        <td><?php echo e($nextdayorders->rem_price); ?></td>
                    </tr>
                </tbody>
            </table>
            </form>
        </div>
         <div class="modal-footer">
       <button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
      <button id="btnPrint" type="button" class="btn btn-default">Print</button>
      </div>
    </div>
    
    <!-- end content-->
</div></div>
                            <!--  end card  -->
	
		</div>
	</div>
</div>

                                
         <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>                       
                                
      </div>
      <!-- End of Main Content -->

<script>
    document.getElementById("btnPrint").onclick = function () {
    printElement(document.getElementById("printThis"));
}

function printElement(elem) {
    var domClone = elem.cloneNode(true);
    
    var $printSection = document.getElementById("printSection");
    
    if (!$printSection) {
        var $printSection = document.createElement("div");
        $printSection.id = "printSection";
        document.body.appendChild($printSection);
    }
    
    $printSection.innerHTML = "";
    $printSection.appendChild(domClone);
    window.print();
}
</script>

    


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