<style>
   .select2-container--open .select2-dropdown {
    left: 0;
    top: 0px;
    border: 1px solid #000 !important;
}
    
    .select2-container--default.select2-container--focus .select2-selection--multiple {
    border: solid #00000057 1px;
    outline: 0;
    padding: 0px 10px;
}
    .select2-container--default.select2-container--focus .select2-selection--multiple {
    border: solid #00000063 1px !important;
/*            border-radius: 35px !important;*/
    }
    
    
    .select2-container--default .select2-selection--multiple {
    border-radius: 5px !important;
}
    .select2-container--default .select2-selection--multiple .select2-selection__choice {
    margin-bottom: 5px;
}
    
    .select2-container--default .select2-selection--multiple .select2-selection__choice {
        background-color: #01b4b7 !important;
    color: #fff;
}
    .select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
        color: #fff !important;
    background: #ff4444;
    border: 0;
}
   textarea.select2-search__field {
    display: none;
} 
    
    span.select2-selection.select2-selection--multiple {
    min-width: 180px;
    margin-top: 8px;
    min-height: 40px;
}
    
    
    span.select2-selection.select2-selection--multiple {
        -webkit-appearance: none;
  -moz-appearance: none;
  background: transparent;
  background-image: url(../../assetsnew/img/drp.svg);
  background-repeat: no-repeat;
  background-position-x: 95%;
  background-position-y: 13px;
  border: 1px solid #dfdfdf;
  border-radius: 2px;
  margin-right: 2rem;
  padding: 1rem;
  padding-right: 2rem;
}
</style>





<?php $__env->startSection('content'); ?>
<div class="common-content">
          <div class="page-content">
                <div class="page-heading">
                    <div class="headings">
                        <h6>REGISTER WITH BUYER</h6>
                    </div>
                </div>
                
              <div class="boxings">

            
                  
                  <?php if($addstatus==1){ ?>
                  
              <form method="POST" id="buyer_register" action="<?php echo e(url('vendors/register_buyer')); ?>">
              <?php echo csrf_field(); ?>
                  <div class="row">

                    <div class="p-3">
                        <div class="form-inputs">
                             <div class="form-group">
                                <label>Select Buyer Name</label>
                                <select name="buyer[]" id="buyer" class="form-control js-example-basic-multiple invoiceselect"   value="" required autocomplete="buyer" multiple autofocus >
                                    
                                <option value="">Select Buyer</option>
                                <?php $__currentLoopData = $buyers; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $buyer): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <option value="<?php echo e($buyer->id); ?>"><?php echo e($buyer->name); ?></option>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                </select>
                              </div>
                        </div>
                      </div>
                     <!-- <div class="col-lg-3 col-md-6 col-sm-12 col-xs-12">
                        <div class="form-inputs">
                             <div class="form-group">
                                <label>Email</label>
                                <input  type="text" class="form-control"  id="email" value="" readonly>
                              </div>
                        </div>
                      </div>
                      <div class="col-lg-3 col-md-6 col-sm-12 col-xs-12">
                        <div class="form-inputs">
                             <div class="form-group">
                                <label>Contact Number</label>
                                <input  type="text" class="form-control" id="phone_no"  value="" readonly>
                              </div>
                        </div>
                      </div>   -->
                  </div>
                  <div class="row">
                     <div class="col-12">
                        <div class="green-button green-button2">
                            <button id="create">Register with Buyer</button>
                         </div>
                     </div>
                  </div>
                  </form>



                <div class="page-heading">
                    <div class="headings">
                      <!--  <h6>Registred Buyers</h6>-->
                    </div>
                </div>

                 <div class="tableBox hideshadow" style="padding-top: 15px;">    
                  
               <?php if(count($buyerslist) > 0){ ?>
                <table id="example" class="table table-striped table-bordered" style="width:100%">
                    <thead>
                        <tr>
                            <th>Id</th>
                            <th>Buyer Name</th>
                            <th>Email Id</th>
                            <th>Phone No</th>
                            <th>Status</th>
                        </tr>
                    </thead>
                    <tbody>
                    <?php $__currentLoopData = $buyerslist; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key=>$buyers): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <tr>
                            <td><?php echo e($key+1); ?></td>
                            <td><?php echo e($buyers->name); ?></td>
                            <td><?php echo e($buyers->email); ?></td>
                            <td><?php echo e($buyers->phone_no); ?></td>
                            <td><?php if($buyers->approved_status == '1'): ?> <span class="tabBt btn-outline-success">Approved</span> <?php elseif($buyers->approved_status == '0'): ?> <span class="tabBt btn-outline-warning">Pending</span>  <?php elseif($buyers->approved_status == '2'): ?> <span class="tabBt btn-outline-danger">Rejected</span> <?php endif; ?></td>
                        </tr>

                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    </tbody>
                </table>
                     
				<?php }else{ ?>
                        <div class="wraper">
                            <div class="product-display">
                                <ul>
                                    <li>
                                        <div class="details">
                                            <div>
                                                <h6>
                                                No Datas available
                                                </h6>
                                            </div>


                                        </div>
                                    </li>


                                </ul>
                            </div>
                        </div>
				<?php } ?>
 
                 </div>
                  
                <?php }else{ ?>
                        <div class="wraper">
                            <div class="product-display">
                                <ul>
                                    <li>
                                        <div class="details">
                                            <div>
                                                <h6>
                                                Your Account is not Activated. Please register with manufacturer
                                                </h6>
                                            </div>


                                        </div>
                                    </li>


                                </ul>
                            </div>
                        </div>
                 <?php } ?>  
                </div> <!-- boxings End -->

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


<?php $__env->startSection('scripts'); ?>
<script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/js/select2.min.js"></script>
<script type="text/javascript" charset="utf8" src="https://cdn.datatables.net/1.10.23/js/jquery.dataTables.js"></script>

<script type="text/javascript">
$(".js-example-basic-multiple").select2({
  placeholder: "Select a Buyer"
});
</script>
<script>
  $('#buyer').on('change', function() {
      var buyerid = this.value;
      var APP_URL = <?php echo json_encode(url('/getbuyerdetails')); ?> ;
      var saveData = $.ajax({
            type: 'GET',
            url: APP_URL+'/'+buyerid,
            data: { buyerid: buyerid, _token: '<?php echo e(csrf_token()); ?>' },
            dataType: "text",
            success: function(resultData) {

              var res = JSON.parse(resultData);
              $('#phone_no').val(res.phone_no);
              $('#email').val(res.email);
              console.log(res);
            }
            });

    });
</script>
<script>
<?php if(Session::has('message')): ?>
      swal({
        title: "",
        text: "<?php echo e(Session::get('message')); ?>",
        type: "success",
        showCancelButton: false,
        dangerMode: false,
        confirmButtonText: 'OK',

    });
<?php endif; ?>
<?php if(Session::has('errormessage')): ?>
      swal({
        title: "",
        text: "<?php echo e(Session::get('errormessage')); ?>",
        type: "error",
        showCancelButton: false,
        dangerMode: true,
        confirmButtonText: 'OK',

    });
<?php endif; ?>
</script>
<script>
$(document).ready(function() {
    $('#example').DataTable();
} );
</script>
<script>
$("#create").click(function(){
   // alert("bbbb");
	$("#buyer_register").validate({
        rules: {

			"buyer": {
                required: true

            },
        },
        submitHandler: function(form, e) {
             $(".pageloader").show();
            $(".pageloader").delay(5000).fadeOut("slow");
		   form.submit();
        }
    });
});
$(function(){
    $('#buyer_register').on('submit', function(event){
        event.preventDefault();

    });
});

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

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