<?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">All Products</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">All Products</li>
            </ol>
          </div>
        </div>
      </div>
    </div>
   
    <section class="content">
      <div class="container-fluid">
      <div class="card">
        <div class="card-body">


<div class="container grid-container">
  <div class="row">

  <?php $__currentLoopData = $product; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $data): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
    <div class="col-12 col-md-6 col-lg-3">
      <div class="card card2">
        <?php $__currentLoopData = $getstock; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $sdata): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
            <?php if($sdata->id == $data->pro_id): ?>
            <a target="_blank" href="productdescription/<?php echo e($data->pro_id); ?>">
            <img class="card-img-top" style="height:250px" src="<?php echo e(env('BACKEND_URL') . "storage/$sdata->image"); ?>" alt="Card image cap">
            </a>
            <hr>
            <?php break; ?>;
            <?php endif; ?>
        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
        <div class="card-body1" style="text-align: center;">
        <h6 class="card-title1" style="text-align: center;"><a target="_blank" href="productdescription/<?php echo e($data->pro_id); ?>"><?php echo e($data->pro_name); ?></a></h6>
          <p class="card-text">
         <b>Product ID - <?php echo e($data->id); ?></b> <br>
          Selling Price -  Rs. <?php echo e($data->sell_price); ?> <br>
          
          Stock - 
            <?php $__currentLoopData = $getstock; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $sdata): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                <?php if($sdata->id == $data->pro_id): ?>
                <?php echo e($sdata->stock); ?>

                <?php break; ?>;
                <?php endif; ?>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?><br>
           <a style="color:green;"> Dropshiping Price - Rs. <?php echo e($data->cost); ?> </a>
          </p>
          </p>
        </div>
      </div>
    </div>
  <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>

  </div>
  
</div>















          <!-- <div class="row">
            <div class="col-md-12">
            <table id="example1" class="table table-bordered" style="width:100%">
                <thead>
                    <tr>
                        <th>Id</th>
                        <th>Product Name</th>
                        <th>Sell Price</th>
                        <th>Cost</th>
                        <th>Stock</th>
                        <th>Action</th>
                    </tr>
                </thead>
                <tbody>
                <?php $__currentLoopData = $product; $__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->pro_name); ?></td>
                        <td><?php echo e($data->sell_price); ?></td>
                        <td><?php echo e($data->cost); ?></td>                
                        <td>
                        <?php $__currentLoopData = $getstock; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $sdata): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <?php if($sdata->id == $data->pro_id): ?>
                            <?php echo e($sdata->stock); ?>

                            <?php break; ?>;
                            <?php endif; ?>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        </td>                
                        <td class="text-center"> 
                        <button type="button" data-id="<?php echo e($data->id); ?>'" data-price="<?php echo e($data->sell_price); ?>"  class="btn btn-warning btn-xs" data-toggle="modal" data-target="#editordermodelphone">Edit</button>                          
                            <a data-id="<?php echo e($data->id); ?>" class="btn btn-primary btn-xs" target="_blank" href="productdetails/<?php echo e($data->pro_id); ?>">View Details</a>
                        </td>      
              
                    </tr>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?> 
                </tbody>
                <tfoot>
                    <tr>
                        <th>Id</th>
                        <th>Product Name</th>
                        <th>Sell Price</th>
                        <th>Cost</th>
                        <th>Stock</th>
                        <th>Action</th>
                    </tr>
                </tfoot>
            </table>
            
            </div>
          </div> -->



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

<style>
.card {
	 margin-bottom: 1rem;
}
.card2 {
     height: 420px;
}
 .list-view .row > [class*='col-'] {
	 max-width: 100%;
	 flex: 0 0 100%;
}
 .list-view .card {
	 flex-direction: row;
}

 .list-view .card > .card-img-top{
     height: 400px;
     width:400px;
}
 .list-view .card .card-body .card-cart {
	 display: inline-block;
   text-align: center;

}


</style>

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

<script>
$('#editordermodelphone').on('show.bs.modal', function (event) {

var button = $(event.relatedTarget) // Button that triggered the modal

var id = button.data('id') 
var price = button.data('price') 

var modal = $(this)
//   modal.find('.modal-title').text('New message to ' + recipient)
modal.find('.modal-body #id').val(id)
modal.find('.modal-body #price').val(price)

})


$('#myform').on('submit', function(event){
    let ele = this;
        event.preventDefault();
        var form_data = $(this).serialize();
        $.ajax({
            url:"/resellersellup",
            method:"POST",
            data:form_data,
            dataType:"json",      
            success: function (result, code, ex) {
                // swal("Done!", "It was successfully!", "success");
                $("#editordermodelphone").modal('hide');  
                location.reload();
            },
            error: function (jqXHR, textStatus, errorThrown) {
                swal("Warning", "Unable to Process your request", "error");
            },
            
        })
    });



$(function () {
    $("#example1").DataTable({
      "responsive": true, "lengthChange": true, "autoWidth": false,"order": [[ 0, "asc" ]],
      "buttons": [ "colvis", "excel"]
    }).buttons().container().appendTo('#example1_wrapper .col-md-6:eq(0)');
  });
</script>

