<?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">Today 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>S.No</th>
                        <th>Product Name</th>
                        <th>Quantity</th>
                        <th>Price</th>
                        <th>Cityadmin</th>
                        <th>City</th>
                        <th>Delivery Date</th>
                        <th>Incentive</th>
                        <th>Order Type</th>
                        <th>User Id</th>
                        <th>Assign</th>
                        </tr>
                      </thead>
                      
                      <tbody>
                      <?php if(count($todayorder)>0): ?>
                                      <?php $i=1; ?>
                                      <?php $__currentLoopData = $todayorder; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $todayorder): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                      <?php $current=date('d-m-Y');
                                            if(strtotime($current)==strtotime($todayorder->delivery_date))
                                            {
                                      ?>
                                    <tr>
                                        <td><?php echo e($i); ?></td>
                                        <td><?php echo e($todayorder->product_name); ?></td>
                                        <td><?php echo e($todayorder->order_qty); ?></td>
                                         <td><?php echo e($todayorder->price); ?></td>
                                        <td><?php echo e($todayorder->cityadmin_name); ?></td>
                                         <td><?php echo e($todayorder->city_name); ?></td>
                                        <td><?php echo e($todayorder->delivery_date); ?></td>
                                        <td><?php echo e($todayorder->delivery_boy_incentive); ?></td>
                                        <td><?php echo e($todayorder->order_type); ?></td>
                                        <td><?php echo e($todayorder->user_id); ?></td>
                                       <td>
                            <?php if($todayorder->delivery_boy_id == "N/A"): ?>               
							<button type="button" class="btn btn-danger" data-toggle="modal" data-target="#exampleModal<?php echo e($todayorder->subs_id); ?>">Assign</button>
							
							 <?php else: ?>
							 <button type="button" class="btn btn-danger" data-toggle="modal" data-target="#exampleModal<?php echo e($todayorder->subs_id); ?>">Assigned/edit<span>
                							 (<?php echo e($todayorder->delivery_boy_name); ?>)</span></button>
							 <?php endif; ?>
                            </td>
                                        
                                    </tr>
                                    <div class="modal fade" id="exampleModal<?php echo e($todayorder->subs_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>
                                			<!--//form-->
                                			<form action="<?php echo e(route('assigned')); ?>" 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==$todayorder->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($todayorder->subs_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-->
                                		</div>
                                	</div>
                                </div>
                                    <?php } ?>
                                    <?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 -->

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



    


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