<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.23/css/jquery.dataTables.css">
<!-- <link rel="stylesheet" href="https://cdn.datatables.net/1.10.23/css/dataTables.bootstrap4.min.css">  -->

<?php $__env->startSection('content'); ?>
<div class="common-content">
          <div class="page-content">
                <div class="page-heading">
                    <div class="headings">
                        <h6> Product Request</h6>
                    </div>
                </div>

                 <div class="hack1">
                                    <div class="hack2 hk3">
                                        <div class="tableBox wraper">
                <table id="example" class="table table-striped table-bordered" style="width:100%">
        <thead>
            <tr>
                <th>Id</th>
                <th>Buyer Name</th>
				<th>Product Name</th>
				<th>Department Name</th>
				<th>Action</th>
            </tr>
        </thead>
        <tbody>
        <?php $__currentLoopData = $requests; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key=>$products): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
            <tr>
                <td><?php echo e($key+1); ?></td>
				 <td><?php echo e(ucfirst($products->name)); ?></td>
                <td><?php echo e(ucfirst($products->product_name)); ?></td>
				 <td><?php echo e(ucfirst($products->dptname)); ?></td>
				<td>
				  <a href="<?php echo e(url('admin/existing_request_approve').'/'.$products->id); ?>" onclick="return confirm('Are you sure?')"><button class="btn">Approve</button></a>
                  <a href="<?php echo e(url('admin/existing_request_reject').'/'.$products->id); ?>" onclick="return confirm('Are you sure?')"><button class="btn" style="background-color:red">Reject</button></a>
                  <button class="btn editrequest" data-requestid="<?php echo e($products->id); ?>" data-pname="<?php echo e($products->product_name); ?>" data-dname="<?php echo e($products->department); ?>" >Edit</button>
				</td>
			</tr>

        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>

        </tbody>
        <!-- <tfoot>
            <tr>
                <th>Id</th>
                <th>Product Name</th>
                <th>Product Code</th>
                <th>Action</th>
            </tr>
        </tfoot> -->
    </table>
                                        </div>
                     </div>
              </div>

          </div>
		  
		  
	<!-- Button trigger modal -->


<!-- Modal -->
<div class="modal fade" id="exampleModal" 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">Edit Product Name</h5>
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
	   <form name="request_product_pop" id="request_product_pop" method="POST" action="<?php echo e(url('admin/edit_request_product')); ?>">
		  <div class="modal-body">
				<?php echo csrf_field(); ?>
				     <div class="row manufacturerlist manufacturerlist-rs">
						 <div class="col-lg-12 col-md-6 col-sm-12 col-xs-12">
							<div class="form-inputs">
							  <div class="form-group">
								 <label>Product Name</label>
								 <input id="request_product_name" name="request_product_name" value="" type="text" class="form-control">
								 <input id="request_product_id" name="request_product_id" value="" type="hidden" class="form-control">
							  </div>
							  </div>
							</div>
							 
					</div>
					<div class="row manufacturerlist manufacturerlist-rs">
						 <div class="col-lg-12 col-md-6 col-sm-12 col-xs-12">
							<div class="form-inputs">
							  <div class="form-group">
								 <label>Department Name</label>
								 <input id="request_department_name" name="request_department_name" value="" type="text" class="form-control">
								 
							  </div>
							  </div>
							</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 $__env->stopSection(); ?>
<?php $__env->startSection('scripts'); ?>
<!-- <script src = "https://code.jquery.com/jquery-3.5.1.js"></script>
<script src = "https://cdn.datatables.net/1.10.23/js/jquery.dataTables.min.js"></script>
<script src = "https://cdn.datatables.net/1.10.23/js/dataTables.bootstrap4.min.js"></script> -->
<script type="text/javascript" charset="utf8" src="https://cdn.datatables.net/1.10.23/js/jquery.dataTables.js"></script>
<script>
$(document).ready(function() {
 // executes when HTML-Document is loaded and DOM is ready
 $(".pageloader").show();
$(".pageloader").delay(200).fadeOut("slow");
});


$(document).on("click", ".editrequest", function () {
	
	$('#exampleModal').modal({backdrop: 'static', keyboard: false});
	var pname = $(this).attr('data-pname');
	var dname = $(this).attr('data-dname');
	var pid = $(this).attr('data-requestid');
    $("#request_product_name").val(pname);
	 $("#request_department_name").val(dname);
	$("#request_product_id").val(pid);
	
});

$("#request_product_pop").validate({

        rules: {
            "request_product_name": {
                required: true
               
            },
			"request_department_name": {
                required: true
               
            },
        },
        submitHandler: function(form, e) {
			
			form.submit();
          
        }
    });












$(document).ready(function() {
    $('#example').DataTable();
} );
</script>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.main_admin', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/meddbot/public_html/resources/views/admin/adminrequest.blade.php ENDPATH**/ ?>