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


                <div class="page-heading">
                    <div class="headings">
                        <!--<h6>REGISTERED MANUFACTURERS</h6>-->
                    </div>
                </div>
                    
               <div class="tableBox hideshadow" style="padding-top: 15px;"> 
                <?php if(count($vendorlist) > 0){ ?>

                <div class="hack1">
                    <div class="hack2">
                        <table id="example" class="table table-striped table-bordered" style="width:100%">
                        <thead>
                            <tr>
                                <th>Id</th>
                                <th>Manufacturer Name</th>
                                <th>Email Id</th>
                                <th>Contact Person Name</th>
                                <th>Contact Person Mobile No</th>
                                <th>GST No</th>
                                <th>Status</th>
                                <th>MAF Document</th>
                            </tr>
                        </thead>
                        <tbody>
                        <?php $__currentLoopData = $vendorlist; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key=>$vendors): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <?php //print_r($vendors);die; ?>
                            <tr>
                                <td><?php echo e($key+1); ?></td>
                                <td><?php echo e($vendors->name); ?></td>
                                <td><?php echo e($vendors->email); ?></td>
                                <td><?php echo e($vendors->contact_name); ?></td>
                                <td><?php echo e($vendors->contact_phone_no); ?></td>
                                <td><?php echo e($vendors->gst_no); ?></td>
                                <td><?php if($vendors->dealstatus == '1'): ?><span class="tabBt btn-outline-success">Approved</span> <?php elseif($vendors->dealstatus == '0'): ?> <span class="tabBt btn-outline-warning">Pending</span> <?php elseif($vendors->dealstatus == '2'): ?> <span class="tabBt btn-outline-danger">Rejected</span> <?php endif; ?></td>
                                <td>
                                    <?php if($vendors->manu_doc!=''): ?>
                                       <a target="_blank" class="eye" href="https://www.meddbot.com/product_files/<?php echo e($vendors->manu_doc); ?>"><i class="fa fa-eye" aria-hidden="true"></i> View</a>
                                    <?php endif; ?>
                                    <?php if($vendors->company_profile!=''): ?>
                                       <a target="_blank" class="eye" href="https://www.meddbot.com/product_files/<?php echo e($vendors->company_profile); ?>"><i class="fa fa-eye" aria-hidden="true"></i> View</a>
                                    <?php endif; ?>
                                    <?php if($vendors->mf_doc!=''): ?>
                                       <a target="_blank" class="eye" href="https://www.meddbot.com/product_files/<?php echo e($vendors->mf_doc); ?>"><i class="fa fa-eye" aria-hidden="true"></i> View</a>
                                    <?php endif; ?>
                                </td>

                            </tr>

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



                        </tbody>
               </table>
                    </div>
                   </div>
                <?php }else{ ?>
                     <div class="col-lg-12 col-md-6 col-sm-12 col-xs-12">
                                        <div class="product-display">
                                            <ul>
                                                <li>
                                                    <div class="details">
                                                        <div>
                                                            <h6>
                                                            No Data available
                                                            </h6>
                                                        </div>


                                                    </div>
                                                </li>


                                            </ul>
                                        </div>
                                    </div>



              <?php } ?>
                    
              </div>        

          </div>


</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 Manufacturer"
});
</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>

jQuery.validator.addMethod("nameval", function(value, element) {
    //test user value with the regex
    return this.optional(element) || /^[a-zA-Z\s]+$/.test(value);
  }, "Enter only Albhabets");

$("#create").click(function(){
    //alert("bbbb");
	$("#buyer_register").validate({
        rules: {

			
            "email": {
                required: true
            },
            "name": {
                required: true,
                nameval:true
            },
            "contact_name": {
                required: true,
                nameval:true
            },
            "contact_phone_no": {
                required: true
            },
            "document": {
                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>
<script>
    $(document).ready(function() {
   $('#gst_no').focusout(function() {
        var gst_no = $('#gst_no').val();
        if($('#gst_no').val() != ""){
                var gst_no = $('#gst_no').val();
                var APP_URL = <?php echo json_encode(url('/getmanufacturedetails')); ?> ;
                var saveData = $.ajax({
                    type: 'GET',
                    url: APP_URL+'/'+gst_no,
                    data: { gst_no: gst_no, _token: '<?php echo e(csrf_token()); ?>' },
                    dataType: "text",
                        success: function(resultData) {
                            //console.log(resultData);
                            var res = JSON.parse(resultData);
                            //alert(res);
                            if(res !== null && res !== ''){
                                if(res.user_type == '1'){
                                    alert('This Gst No is already registered as a buyer.You cannot add as a Manufacturer');
                                }else if(res.user_type == '2'){
                                    alert('This Gst No is already registered as a Vendor.You cannot add as a Manufacturer');
                                }else{
                                    $('#email').val('');
                                    $('#name').val('');
                                    $('#address').val('');
                                    $('#zipcode').val('');
                                    $('#contact_name').val('');
                                    $('#contact_phone_no').val('');
                                    //console.log(res);
                                    var email = res.email;
                                    var name = res.name;
                                    var address = res.address;
                                    var zipcode = res.zipcode;
                                    $('#email').val(email);
                                    $('#name').val(name);
                                    $('#address').val(address);
                                    $('#zipcode').val(zipcode);
                                    $('#contact_name').val(res.contact_name);
                                    $('#contact_phone_no').val(res.contact_phone_no);
                                }

                            }else{
                                //alert(' NULL')
                                 $('#email').val('');
                                $('#name').val('');
                                $('#address').val('');
                                $('#zipcode').val('');
                                $('#contact_name').val('');
                                $('#contact_phone_no').val('');

                                    var APP_URL = <?php echo json_encode(url('/getgstdetails')); ?> ;
                                    var saveData = $.ajax({
                                        type: 'GET',
                                        url: APP_URL+'/'+gst_no,
                                        data: { gst_no: gst_no, _token: '<?php echo e(csrf_token()); ?>' },
                                        dataType: "text",
                                            success: function(resultData) {
                                            var res = JSON.parse(resultData);
                                            console.log(res);
                                            var name= res.taxpayerInfo.lgnm;
                                            console.log(name);
                                            var dno = res.taxpayerInfo.pradr.addr.bno;
                                            var bnm = res.taxpayerInfo.pradr.addr.bnm;
                                            var st = res.taxpayerInfo.pradr.addr.st;
                                            var loc = res.taxpayerInfo.pradr.addr.loc;
                                            var dst = res.taxpayerInfo.pradr.addr.dst;
                                            var stcd = res.taxpayerInfo.pradr.addr.stcd;
                                            var pncd = res.taxpayerInfo.pradr.addr.pncd;
                                            var address =dno+','+bnm+','+st+','+loc+','+dst+','+stcd+','+pncd;
                                            $('#name').val(name);
                                            $('#address').val(address);
                                            $('#zipcode').val(pncd);
                                        }
                                    });

                            }


                    }
                });
                $(".pageloader").show();
                $(".pageloader").delay(5000).fadeOut("slow");
        }
    });
});
</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/manufacturerlist.blade.php ENDPATH**/ ?>