<style>
.percircle.big {
    font-size: 141px !important;
}
.percircle {
    position: relative;
    width: 140px !important;
    height: 140px !important;
}    
  
</style>


<?php $__env->startSection('content'); ?>

<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-rbsA2VBKQhggwzxH7pPCaAqO46MgnOM80zW1RWuH61DGLwZJEdK2Kadq2F9CUG65" crossorigin="anonymous">




      <div class="common-content">
          <div class="page-content">
                <div class="page-heading">
                    <div class="headings">
                        <h6>Lab</h6>
                    </div>
                </div>
              
                <div class="dashboard-cnts">
                    <div class="row">
                        <div class="col-12 blink">
                            <div class="bid-stats buyers">
                                     <?php 
                            
                            
                            if(!empty($userdata->name)){
                                $val2 = '1';
                            }else{
                                $val2 = '0';
                            }
                            
                            if(!empty($userdata->email)){
                                $val3 = '1';
                            }else{
                                $val3 = '0';
                            }
                            
                            if(!empty($userdata->phone_no)){
                                $val4 = '1';
                            }else{
                                $val4 = '0';
                            }
                            
                            
                            if(!empty($userdata->address)){
                                $val5 = '1';
                            }else{
                                $val5 = '0';
                            }
                            
                            
                            if(!empty($userdata->state)){
                                $val6 = '1';
                            }else{
                                $val6 = '0';
                            }
                            
                            if(!empty($userdata->city)){
                                $val7 = '1';
                            }else{
                                $val7 = '0';
                            }
                            
                            if(!empty($userdata->zipcode)){
                                $val8 = '1';
                            }else{
                                $val8 = '0';
                            }
                            
                            if(!empty($userdata->contact_name)){
                                $val9 = '1';
                            }else{
                                $val9 = '0';
                            }
                            
                            if(!empty($userdata->contact_phone_no)){
                                $val10 = '1';
                            }else{
                                $val10 = '0';
                            }
                            
                            if((Auth::user()->user_type == '1')||(Auth::user()->user_type == '5')||(Auth::user()->user_type == '6')||(Auth::user()->user_type == '4')){
                                if(!empty($userdata->buyer_type)){
                                $val11 = '1';
                                }else{
                                    $val11 = '0';
                                }
                             }elseif(Auth::user()->user_type == '2'){
                                if(!empty($userdata->vendor_type)){
                                $val11 = '1';
                                }else{
                                    $val11 = '0';
                                }
                             }
                             
                             if(!empty($userdata->description)){
                                $val12 = '1';
                                }else{
                                    $val12 = '0';
                                }
                             
                             $total = round(($val2+$val3+$val4+$val5+$val6+$val7+$val8+$val9+$val10+$val11+$val12)*100/11);
                             
                            //print_r($total);
                            
                            ?>
                           
                                
                                <div class="row">
                                    <div class="col-md-6">
                                        
                                        <div class="grid-box  comp-st4" style="min-height: 125px;">
                                            <div class="box-icon">
                                                <img src="<?php echo e(url('assets/images/buy-d7.png')); ?>">
                                            </div>
                                            <div class="boxvalue-head" style="text-align: center;">
                                                
                                                <?php
                                                if(!empty($details[0]))
                                                {
                                                   ?>
                                                   Lab Exist <br>
                                                   <?php 
                                                }
                                                else
                                                {
                                                    ?>
                                                   Lab Not Exist <br>
                                                   <?php 
                                                } 
                                                $i=1;
                                                //print_r($details);?>
                            <?php $__currentLoopData = $details; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $doctor): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>

                        
                        
                           
                              Lab Name: <?php echo e($doctor->name); ?> <br>
                              Lab Location: <?php echo e($doctor->location); ?> <br>
                              Contact Number:<?php echo e($doctor->contact_no); ?> <br>
                             Email :<?php echo e($doctor->email); ?><br>
                             Certification: <?php echo e($doctor->certification); ?><br>
                              Working Hours: <?php echo e($doctor->workinghours); ?>

                              
                            <?php $i++;?>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                            </div>
                                            <div class="box-value "></div>
                                        </div>
                                   
                                    </div>
                                    <div class="col-md-6">
                                     
                                        <div class="grid-box  comp-st5" style="min-height: 125px;" onclick="load_popup()" data-bs-toggle="modal" data-bs-target="#exampleModal">
                                            <div class="box-icon">
                                                <img src="<?php echo e(url('assets/images/buy-d8.png')); ?>">
                                            </div>
                                            
                                            <div class="boxvalue-head" style="text-align: center;"  data-bs-toggle="modal" data-bs-target="#exampleModal">
                                                Add New 
                                            </div>
                                            <div class="box-value"></div>
                                        </div>
                                      
                                    </div>
                                    
                                </div>



                                <!-- Modal -->
<div class="modal fade" id="exampleModal" data-bs-backdrop="static" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
  <div class="modal-dialog modal-lg">
    <div class="modal-content">
      <div class="modal-header">
        <h1 class="modal-title fs-5" id="exampleModalLabel">Add Lab</h1>
        <button type="button" onclick="hide_popup()" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
      </div>
      <div class="modal-body addnew">
       <div class="row mb-3">
            <div class="col-lg-4">
                <input type="text" class="form-control custom-fields mt-3" id="name" placeholder="Name">
            </div> 
            <div class="col-lg-8">
               <input id="searchTextField" type="text"  class="form-control custom-fields mt-3" name="searchTextField" placeholder="Address">
                <!-- <input type="text" class="form-control custom-fields mt-3" id="address" placeholder="Address"> -->
            </div>
            <div class="col-lg-4">
                <select class="form-control custom-fields mt-3" id="Clinic">
                    <option value="" >Clinic Name</option>
                   
                                                                        <option value="<?php echo e($userid); ?>"><?php echo e($user_name); ?></option>
                                                                    
                </select>
            </div> 
            <div class="col-lg-4">
                <input type="text" class="form-control custom-fields mt-3" id="contact_no" maxlength="10" placeholder="Contact No">
            </div>
           <!-- <div class="col-lg-4">
                <input type="text" class="form-control custom-fields mt-3" id="Specialisation" placeholder="Specialisation">
            </div> -->
            
            <div class="col-lg-4">
                <input type="text" class="form-control custom-fields mt-3" id="Email" placeholder="Email">
            </div> 
            <div class="col-lg-4">
                <input type="password" class="form-control custom-fields mt-3" id="Password" placeholder="Password *">
            </div> 
            <div class="col-lg-4">
                <input type="text" class="form-control custom-fields mt-3" id="certification" placeholder="Certification">
            </div> 
           <div class="col-lg-4">
                <input type="text" class="form-control custom-fields mt-3" id="workinghours" placeholder="Working Hours">
            </div>

            
            
            <input type="hidden" id="cityLat" name="">
            <input type="hidden" id="cityLng" name="">
            
       </div>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-primary save-button" id="save_lab">Save Now</button>
      </div>
    </div>
  </div>
</div> 


<?php $__env->stopSection(); ?>
<?php $__env->startSection('scripts'); ?>

<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyDMSKOGGZK0R6RuqpTTrdj3uTu_k2LOGiM&libraries=places"></script>

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js" integrity="sha512-894YE6QWD5I59HgZOGReFYm4dnWc1Qt5NtvYSaNcOP+u1T9qYdvdihz0PPSiiqn/+/3e7Jo4EaG7TubfWGUrMQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>

<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-kenU1KFdBIe4zVF0s0G1M5b4hcpxyD9F7jL+jjXkk+Q2h455rYXK/7HAuoJl+0I4" crossorigin="anonymous"></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; ?>

function load_popup()
{
    
    $('#exampleModal').modal({show:true});
}

function hide_popup()
{
    
    $('#exampleModal').modal({show:false});
}

</script>
          
          
 
<script type="text/javascript">

    function initialize() {
  // var input = document.getElementById('searchTextField');
  // new google.maps.places.Autocomplete(input);

  var input = document.getElementById('searchTextField');
          var autocomplete = new google.maps.places.Autocomplete(input);
        //  swal(autocomplete);
            google.maps.event.addListener(autocomplete, 'place_changed', function () {
                var place = autocomplete.getPlace();
                // swal('sec');
                // swal(place.name);
                // swal(place.geometry.location.lat());
                // swal(place.geometry.location.lng());
                $("#cityLat").val(place.geometry.location.lat());
                $("#cityLng").val(place.geometry.location.lng());
               // document.getElementById('city2').value = place.name;
               // document.getElementById('cityLat').value = place.geometry.location.lat();
                //document.getElementById('cityLng').value = place.geometry.location.lng();
            });


}

google.maps.event.addDomListener(window, 'load', initialize);

    $("#save_lab").click(function()
    {
        var baseurl='https://www.meddbot.com/district_hospital/';
        var user_token=$(".token_user").val();
        //swal();
        var name=$("#name").val();
        var locattion=$("#searchTextField").val();
        var contact_no=$("#contact_no").val();
        var Email=$("#Email").val();
        var Password=$("#Password").val();
        var certification=$("#certification").val();
        var workinghours=$("#workinghours").val();
        var cityLat=$("#cityLat").val();
        var cityLng=$("#cityLng").val();
        var Clinic=$("#Clinic").val();
        if (Password.length < 6) 
        {
            swal("Your password needs a minimum of six characters");
            return false;
        }
        if (Password.search(/[a-z]/) == -1)
        {
            swal("Your password needs a lower case letter");
            return false;
        }
        if (Password.search(/[A-Z]/) == -1) 
        {
            swal("Your password needs an uppser case letter");
            return false;
        }
        if(Password.search (/[0-9]/) == -1) 
        {
            swal("Your password needs a number");
            return false;
        }
        else
        {
          var data = {

                     name      :name,
                     locattion   :locattion,
                     contact_no : contact_no,
                     Email : Email,
                     Password:Password,
                     certification : certification,
                     workinghours : workinghours,
                     cityLat : cityLat,
                     cityLng : cityLng,
                     Clinic : Clinic,
                     _token   :user_token
                    
                  }

             $.ajax({url:baseurl+'add_lab_save_new_buyer',
                            type:"POST",
                            data:data,
                            success: function (res) {
                                if(res=='Email Exist')
                                {
                                  swal('Email Exist');
                                }
                                if(res=='in')
                                {
                                    swal('Lab Successfully Saved!!');
                                    window.setTimeout(function(){ 
                                    location.reload();
                                } ,3000);
                                }
                                if(res=='out')
                                {
                                    swal('Lab Exist for this Clinic!!');
                                }
                                
                                console.log(res);
                                
                            }
                        });
        }
       // swal(name);

        
    });


    
</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/buyers/labs.blade.php ENDPATH**/ ?>