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

  
  <div class="content-wrapper">
    <div class="content-header">
      <div class="container-fluid">
        <div class="row mb-2">
          <div class="col-sm-6">
            <h1 class="m-0">Supplier Payments</h1>
          </div>
          <div class="col-sm-6">
            <ol class="breadcrumb float-sm-right">
              <li class="breadcrumb-item"><a href="/home">Home</a></li>
              <li class="breadcrumb-item active">Supplier Payments</li>
            </ol>
          </div>
        </div>
      </div>
    </div>
   
    <section class="content">
      <div class="container-fluid">




      <div class="card">
        <div class="card-body">
        <form class="form-horizontal" method="POST" action="/storepickupfilter">
          <?php echo e(csrf_field()); ?>


        <div class="row">
            <div class="col-md-3">
                <div class="form-group">
                <label>Date Range</label>
                <div class="input-group">
                    <div class="input-group-prepend">
                    <span class="input-group-text">
                        <i class="far fa-calendar-alt"></i>
                    </span>
                    </div>
                    <input type="text" class="form-control float-right" id="reservation" value="<?php echo e($today); ?>" name="daterange">
                </div>
                </div>

            </div>
            <div class="col-md-1" style="padding-top:32px;">
                <button type="submit" class="btn btn-primary btn-block">Filter</button>
            </div>
        </div>
        </form>

                <table id="example12" class="table table-bordered" style="width:100%; font-size:13px;">
                    <thead>
                        <tr>
                            <th>Id</th>
                            <th>Name</th>
                            <th>Address</th>
                            <th>Phone</th>
                            <th>Product</th>
                            <th>COD</th>
                            <th>Action</th>
                        </tr>
                    </thead>
                    <tbody>
                    <?php $__currentLoopData = $item; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $data): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <tr>
                            <td><?php echo e($data->id); ?></td>
                            <td><?php echo e($data->name); ?></td>
                            <td><?php echo e($data->address); ?></td>
                            <td><?php echo e($data->phone); ?></td>
                            <td><?php $__currentLoopData = $data->cus_or; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $itemdata): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                    <?php echo e($itemdata->orders->name); ?>,
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?> 
                            </td>
                            <td><?php echo e($data->cod); ?></td>
                            <td class="text-center">           
                            <?php if($data->status == 18): ?>
                            <button type="button" class="btn btn-success btn-xs" data-id="<?php echo e($data->id); ?>" data-cod="<?php echo e($data->cod); ?>" data-toggle="modal" data-target="#paymodel">Pay</button>                 
                            <?php endif; ?>
                                <a data-id="<?php echo e($data->id); ?>" target="_blank" class="btn btn-primary btn-xs" href="viewallorders/<?php echo e($data->id); ?>">View</a>
                            </td>
                            
                        </tr>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?> 
                    </tbody>
                </table>

        </div>
      </div>







      </div>
    </section>
  </div>
 



<div class="modal fade" id="paymodel" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
  <div class="modal-dialog modal-dialog-centered" role="document">
      <div class="modal-content">
      <div class="modal-header">
          <h5 class="modal-title" id="exampleModalLongTitle">Change Paid Status</h5>
          <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
          </button>
      </div>
      <form class="form-horizontal" method="POST" action="/storepaymentrecive">
          <?php echo e(csrf_field()); ?>

      <div class="modal-body"> 
          <input type="hidden" name="id" id="id">    
          <input type="hidden" name="cod" id="cod">    

            <div class="form-group">
                <label>Select Bank</label>
                <select class="form-control" name="bank" id="bank" style="width: 100%;" required>
                    <option value="" selected="selected" disabled>Select</option>
                    <?php $__currentLoopData = $supdata; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $supdatadata): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <option value="<?php echo e($supdatadata->id); ?>"><?php echo e($supdatadata->accountname); ?> - <?php echo e($supdatadata->bank); ?></option>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                </select>
            </div>

            <div class="form-group">
                <label for="">Paid Status</label>
                <div class="form-check">
                    <input class="form-check-input" type="checkbox" name="paidstatus" value="" id="flexCheckChecked">
                    <label class="form-check-label" for="flexCheckChecked">Paid</label>
                </div>
            </div>
      </div>
      <div class="modal-footer">
          <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
          <button type="submit" class="btn btn-primary">Save changes</button>
      </div>
      </form>
      </div>
  </div>
</div>
  <?php echo $__env->make('dashboard.include.footer', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>;


<script>
$(function () {
    $('.select2').select2()
})

$('#reservationdate').datetimepicker({
format: 'YYYY-MM-DD HH:mm:ss'
});
$('#reservationdate2').datetimepicker({
format: 'YYYY-MM-DD HH:mm:ss'
});




$(function () {
    $("#example12").DataTable({
      "responsive": true, "autoWidth": false,"order": [[ 0, "desc" ]],
    }).buttons().container().appendTo('#example1_wrapper .col-md-6:eq(0)');
  });



$('#paymodel').on('show.bs.modal', function (event) {

var button = $(event.relatedTarget) // Button that triggered the modal
var recipient = button.data('id') 
var cod = button.data('cod') 


var modal = $(this)
modal.find('.modal-body #id').val(recipient)
modal.find('.modal-body #cod').val(cod)

})

</script>
 
<script>


    $('#reservation').daterangepicker({
        locale: {
            format: 'YYYY/MM/DD'
        }
    });




<?php if(session('success')): ?>
        // swal("Success!","<?php echo e(session('success')); ?>","success");
        toastr.success('Your work has been successfully!')

<?php endif; ?>
<?php if(session('error')): ?>
    swal({
            title: "Error!",
            text: "<?php echo e(session('error')); ?>",
            icon: "error",
            button: "OK",
        });
<?php endif; ?>
</script>
