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

<div class="row wrapper border-bottom white-bg page-heading">
                <div class="col-lg-10">
                    <h2>Order board</h2>
                    <ol class="breadcrumb">
                        <li>
                            <a href="index.html">Home</a>
                        </li>
                        
                        <li class="active">
                            <strong>Order board</strong>
                        </li>
                    </ol>
                </div>
                <div class="col-lg-2">

                </div>
            </div>

        <div class="wrapper wrapper-content  animated fadeInRight">
            <div class="row">
                <div class="col-lg-4">
                    <h3 class="comingOrder">New Orders</h3>
                    <div class="ibox">
                        <div class="ibox-content">
                            <ul class="sortable-list connectList agile-list" id="incomplete">
								<?php $__currentLoopData = $incomplete; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $order): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>

                                <li class="warning-element" id="<?php echo e($order->id); ?>" data-toggle="modal" data-target="#myModal">                                    
								<?php $__currentLoopData = $order->items; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
								<span class="orderPage-list"><?php echo e($item->product->name); ?>(<?php echo e(substr($item->size , 0, 1)); ?>)<span class="pull-right"> <?php echo e($item->quantity); ?></span></span><br>
								
								<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                <hr>
                                    <div class="agile-detail">
                                        <i class="fa fa-clock-o"></i> <?php echo e(time_elapsed_string($order->created_at)); ?>

                                    </div>
                                </li>
								<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                            </ul>
                        </div>
                    </div>
                </div>
                <div class="col-lg-4">
                    <h3 class="completeOrder">Completed</h3>
                    <div class="ibox">
                        <div class="ibox-content">
                             <ul class="sortable-list connectList agile-list" id="completed">
                                <?php $__currentLoopData = $completed; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $order): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>

                                <li class="success-element" id="<?php echo e($order->id); ?>" data-toggle="modal" data-target="#myModal">                                    
                                <?php $__currentLoopData = $order->items; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <span class="orderPage-list"><?php echo e($item->product->name); ?>(<?php echo e(substr($item->size , 0, 1)); ?>)<span class="pull-right"> <?php echo e($item->quantity); ?></span></span><br>
                                
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                <hr>
                                    <div class="agile-detail">
                                        <i class="fa fa-clock-o"></i> <?php echo e(time_elapsed_string($order->created_at)); ?>

                                    </div>
                                </li>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                            </ul>
                        </div>
                    </div>
                </div>
                <div class="col-lg-4">
                    <h3 class="cancelOrder">Cancelled</h3>
                    <div class="ibox">
                        <div class="ibox-content">

                            <ul class="sortable-list connectList agile-list" id="canceled">
                                <?php $__currentLoopData = $canceled; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $order): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>

                                <li class="danger-element" id="<?php echo e($order->id); ?>" data-toggle="modal" data-target="#myModal">                                    
                                <?php $__currentLoopData = $order->items; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <span class="orderPage-list"><?php echo e($item->product->name); ?>(<?php echo e(substr($item->size , 0, 1)); ?>)<span class="pull-right"> <?php echo e($item->quantity); ?></span></span><br>
                                
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                <hr>
                                    <div class="agile-detail">
                                        <i class="fa fa-clock-o"></i> <?php echo e(time_elapsed_string($order->created_at)); ?>

                                    </div>
                                </li>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                            </ul>
                        </div>
                    </div>
                </div>

            </div>
        </div>
        <div id="myModal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
          <h3 id="myModalLabel"> Order Detail </h3>
        </div>
        <div class="modal-body" >
                <div class="col-sm-8">
                        <div class="col-sm-12 form-group">
                            <label>Name : Jawad Waqas</label>                            
                        </div>
                        <div class="col-sm-12 form-group">
                            <label>Email : abc@example.com</label>
                        </div>
                        <div class="col-sm-12 form-group">
                            <label>Phone number : 092 0321 1234567</label>
                        </div>
                        <div class="col-sm-12 form-group">
                            <label>Address : 123 seventh sky fortune</label>
                        </div>
                </div>
                          
                <div class="col-sm-4 form-group">
                    <div class="col-sm-12 form-group">
                            <label>Name : Jawad Waqas</label>                            
                    </div>
                </div>
        <div class="modal-footer">
         
        </div>
      </div>
    </div>
  </div>
  </div>
		 <script src="<?php echo e(url('assets/js/jquery-ui-1.10.4.min.js')); ?>"></script>
		<script>
        $(document).ready(function(){

            $("#incomplete, #canceled, #completed").sortable({
                connectWith: ".connectList",
                update: function( event, ui ) {

                    var incomplete = $( "#incomplete" ).sortable( "toArray" );
					console.log(incomplete);
                    var canceled = $( "#canceled" ).sortable( "toArray" );
						console.log(canceled);
                    var completed = $( "#completed" ).sortable( "toArray" );
						console.log(completed);
					$.ajax({
						method: "POST",
						headers: {
								'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
						},
						url: "<?php echo url('orders/save'); ?>",
                        data: {
                            incomplete: incomplete,
                            canceled: canceled,
                            completed: completed
                        }
                    }).fail(function(jqXHR, textStatus, errorThrown){
                        $("active_msg").html("Unable to save active list order: " + errorThrown);
                        
                    });
                    
                    //$('.output').html("ToDo: " + window.JSON.stringify(todo) + "<br/>" + "In Progress: " + window.JSON.stringify(inprogress) + "<br/>" + "Completed: " + window.JSON.stringify(completed));
                }
            }).disableSelection();

        });
    </script>
    

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

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