<html>
    <head>
        <!-- Required meta tags -->
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
        <!--  <script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false&libraries=places"></script> -->
        <!-- <script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyDMSKOGGZK0R6RuqpTTrdj3uTu_k2LOGiM&libraries=places&callback=initialize"></script> -->
         <script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyDMSKOGGZK0R6RuqpTTrdj3uTu_k2LOGiM&libraries=places"></script>
        
        <!-- Fav icon -->
        <link rel="icon" href="<?php echo e(url('emr_assets/img/favicon.png')); ?>" type="image/png" sizes="16x16"> 
        
        <!--Bootstrap icons-->
        <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.8.1/font/bootstrap-icons.css">
        
       <!--  <link rel="stylesheet" href="https://cdn.datatables.net/1.11.4/css/jquery.dataTables.min.css"> -->
       <link rel="stylesheet" href="https://cdn.datatables.net/1.13.1/css/dataTables.bootstrap5.min.css">
        <!-- Bootstrap -->
        <!-- CSS only -->
        <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-rbsA2VBKQhggwzxH7pPCaAqO46MgnOM80zW1RWuH61DGLwZJEdK2Kadq2F9CUG65" crossorigin="anonymous">
        
         <!-- Custom CSS -->
        <link rel="stylesheet" href="<?php echo e(url('emr_assets/css/style.css')); ?>">
        <style type="text/css">
            .lbls
            {
              float: left;text-align: ;font-weight: 500;height: 45px;
            }
            .lbls_span
            {
                float: left;height: 45px;
            }
            .col-lg-1
            {
                width: 2%;
            }
            .modal-content
            {
              width: 125%;
              margin-left: -10%;
            }

            .pac-target-input{
                z-index: 10000 !important;
                /*width: auto !important;*/
                position: initial !important;
                left: 0 !important;
                right: 0 !important;
                display: block !important;
            }
            /*.pac-container:empty{
                display: none !important;
            }*/
            .pac-container { z-index: 2000 !important;  }
        </style>

        <script src="https://cdn.jsdelivr.net/npm/sweetalert2@7.12.15/dist/sweetalert2.all.min.js"></script>  
        <link rel='stylesheet' href='https://cdn.jsdelivr.net/npm/sweetalert2@7.12.15/dist/sweetalert2.min.css'></link>  
        <title>Meddbot</title>
    </head>
    <body>
      
       <main>
           <?php echo $__env->make('district_hospital_new.side_menu', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
           <div class="content-section">
               <header>
                   <div class="header-details">
                       <button class="btn-primary togg-sidebar" ><i class="bi bi-list"></i>  </button>
                       <h4>Doctors</h4>
                   </div>
                   <div class="header-itms">
                       <ul>
                           <li>
                               <a href="#"><button class="btn-settings btn header-buttons" ><i class="bi bi-gear-fill"></i></button></a>
                           </li>
                           <li>
                               <a href="#"><button class="btn-settings btn header-buttons" ><i class="bi bi-bell-fill"></i></button></a>
                           </li>
                       </ul>
                       <div class="user-section">
                           <h5>DH</h5>
                          
                           <div class="dropdown">
                                  <button class=" btn-secondary dropdown-toggle user-profile" type="button" data-bs-toggle="dropdown" aria-expanded="false">
                                    <span class="" >A</span>
                                  </button>
                                  <ul class="dropdown-menu">
                                    <li><a class="dropdown-item" href="#">Action</a></li>
                                    <li><a class="dropdown-item" href="#">User Profile</a></li>
                                    <li><a class="dropdown-item" href="#">Logout</a></li>
                                  </ul>
                                </div>
                           
                           
                       </div>
                   </div>
               </header>
               <div class="main-section">
                   <div class="action-sec d-flex justify-content-between">
                       <div class="search">
                          <!--  <input type="text" placeholder="Search A Doctor" id="search_doctor" class="form-control" >
                           <button class="btn-primary search-hos" id="search_doctor_button"> Submit</button> -->
                       </div>
                       <div class="actions">
                           <a href="https://www.meddbot.com/district_hospital/doctors_approvals">
                               <button class="btn-primary add-new" data-bs-toggle="modal" data-bs-target="#" style="background: #0280b2;"> Approvals</button>
                           </a>
                           <button class="btn-primary add-new" data-bs-toggle="modal" data-bs-target="#exampleModal_assign" style="background: #4e5558;"> Assign</button>
                           <button class="btn-primary add-new" data-bs-toggle="modal" data-bs-target="#exampleModal"> Add new</button>
                       </div>
                       <!-- <div class="actions">
                           <button class="btn-primary add-new" data-bs-toggle="modal" data-bs-target="#"> Assign</button>
                       </div>
                       <div class="actions">
                           <button class="btn-primary add-new" data-bs-toggle="modal" data-bs-target="#exampleModal"> Add new</button>
                       </div> -->
                   </div>
                   <div class="medd-content shadow-sm p-4 mt-4" id="list_view">
                       
                       <div class="row align-items-center">
                           <div class="col-lg-8">
                               <h6 style="margin-bottom: 25px;">Doctors List</h6>
                           
                           </div>
                           <div class="col-lg-4">
                               <!-- <input type="text" style="    font-family: bootstrap-icons !important;" placeholder="&#xF52A; Search A Hospital" class="form-control rounded-5" > -->
                           </div>
                       </div>
                       

                       
                       <!-- <div class="table table-responsive"> -->
                           <!-- <table class="table mt-3 "> -->
                            <table id="example" class="table table-striped" style="width:100%">
                          <thead>
                            <tr>
                              <th scope="col" style="width:10%;" >SL No</th>
                              <th scope="col" style="width:15%;" >Clinic Name</th>
                             <!--  <th scope="col" style="width:7%;" >PHC/CHC</th> -->
                              <th scope="col" style="width:17%;" >Doctor Name</th>
                              <th scope="col" style="width:20%;" >Specialization</th>
                              <th scope="col" style="width:18%;">Contact Number</th>
                              <th scope="col" style="width:10%;">Email</th>
                              <th scope="col" style="width:10%;">Actions</th>
                            </tr>
                          </thead>
                          <tbody>
                            <?php $i=1;?>
                            <?php $__currentLoopData = $approved_doctors; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $doctor): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>

                        
                        
                            <tr>
                              <td><?php echo e($i); ?></td>
                              <td scope="row"><a href="#"><?php echo e($doctor->clinic_name); ?></a> </td>
                              <!-- <td> PHC</td> -->
                              <td><?php echo e($doctor->name); ?></td>
                              <td><?php echo e($doctor->specialisation); ?></td>
                              <td><?php echo e($doctor->contact_phone_no); ?></td>
                              <td><?php echo e($doctor->email); ?></td>
                              <td>
                                  <div class="action-buttons">
                                      <button class="edit" > <span><i class="bi bi-pencil-square"></i></span>Edit</button>
                                      <button class="delete" onclick="delete_doctor('<?php echo e($doctor->id); ?>');"> <span><i class="bi bi-trash3"></i></span>Delete</button>
                                  </div>
                                </td>
                            </tr>
                            <?php $i++;?>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                              
                              
                          </tbody>
                        </table>
                       <!-- </div> -->
                   </div>


                   <div class="medd-content shadow-sm p-4 mt-4" id="search_view" style="display:none;">
                       
                       <div class="row align-items-center">
                           <div class="col-lg-4" style="text-align:center ;margin-bottom: 40px;">
                               <h6>Doctor Details</h6>
                           
                           </div>
                           
                       </div>
                       
                       
                       
                       <div class="table table-responsive">
                           <div class="col-lg-2 lbls" >
                              Doctor Name 
                          </div>
                          <div class="col-lg-1 lbls" >: &nbsp;
                          </div>
                          <div class="col-lg-9 lbls_span">
                              <span id="name_view"></span>
                          </div>
                          <div class="col-lg-2 lbls">
                              Doctor Email 
                          </div>
                          <div class="col-lg-1 lbls" >: &nbsp;
                          </div>
                          <div class="col-lg-9 lbls_span">
                              <span id="email_view"></span>
                          </div>
                          <div class="col-lg-2 lbls">
                              Contact Number 
                          </div>
                          <div class="col-lg-1 lbls" >: &nbsp;
                          </div>
                          <div class="col-lg-9 lbls_span">
                              <span id="contact_number_view"></span>
                          </div>
                          
                          <div class="col-lg-2 lbls">
                              Specialisation
                          </div>
                          <div class="col-lg-1 lbls" >: &nbsp;
                          </div>
                          <div class="col-lg-9 lbls_span">
                              <span id="specialisation_view"></span>
                          </div>
                          <div class="col-lg-2 lbls">
                             Clinic Name
                          </div>
                          <div class="col-lg-1 lbls" >: &nbsp;
                          </div>
                          <div class="col-lg-9 lbls_span">
                              <span id="clinic_name_view"></span>
                          </div>
                          <div class="col-lg-2 lbls">
                            Registration Number
                          </div>
                          <div class="col-lg-1 lbls" >: &nbsp;
                          </div>
                          <div class="col-lg-9 lbls_span">
                              <span id="registration_number_view"></span>
                          </div>
                          
                       </div>
                   </div>
               </div>
               <div class="footer">
                   <span>Copyright © 2022, Meddbot</span>
               </div>
           </div>
        </main>
        
        
        
        


<!-- 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 Doctors</h1>
        <button type="button" 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-12" style="margin-top: 30px;padding-left: 25px;">
                <input  type="checkbox" id="d_hospital" name="" style="margin-right: 15px;width: 0px;">
            </div> 

            <div class="col-lg-4">
                <input type="text" class="form-control custom-fields mt-3" id="name" placeholder="Doctor Name *">
            </div> 
            <div class="col-lg-4">
                <input type="text" class="form-control custom-fields mt-3" id="doctor_id" placeholder="Registration No *">
            </div>
            <div class="col-lg-4">
                <select class="form-control custom-fields mt-3" id="Clinic">
                    <option value="" >Clinic Name</option>
                    <?php $__currentLoopData = $clinics; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $clinic): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                                        <option value="<?php echo e($clinic->id); ?>"><?php echo e($clinic->name); ?></option>
                                                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                </select>
            </div> 
            <div class="col-lg-4">
                <input type="text" class="form-control custom-fields mt-3" id="Pincode" maxlength="6" placeholder="Pincode *" >
            </div>
            <div class="col-lg-4">
                <input type="text" class="form-control custom-fields mt-3" id="Qualification" placeholder="Qualification *" >
            </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">
                <select class="form-control custom-fields mt-3" id="Specialisation">
                    <option value="">Specialization *</option>
                    
                                                                    <?php $__currentLoopData = $specialisation; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $specialisations): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                                        <option value="<?php echo e($specialisations->name); ?>"><?php echo e($specialisations->name); ?></option>
                                                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                </select>
            </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="text" class="form-control custom-fields mt-3" id="Contact_number" maxlength="10" placeholder="Contact Number *">
            </div> 
           <div class="col-lg-4">
                <input type="text" class="form-control custom-fields mt-3" id="Username" placeholder="Username">
            </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-8">
               <input id="searchTextField" type="text"  class="form-control custom-fields mt-3" name="searchTextField" placeholder="Location">
            </div> 
            <div class="col-lg-12">
            <form id="image-upload-form" action="upload.php" method="post">
             <!--  <div id="targetLayer">Image Preview</div> -->
             <input type="hidden" id="user_token" name="_token" value="<?php echo e(csrf_token()); ?>">
              <div style="float: right;
    margin-top: 25px;">
                Upload Profile Image
                <input name="userImage" id="userImage" type="file" class="inputFile" />
              </div>
              <!-- <div>
                <input type="submit" value="Upload" class="btn-upload" />
              </div> -->
            </form>
            <input type="hidden" id="cityLat" name="">
            <input type="hidden" id="cityLng" name="">
          </div>
            




       </div>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-primary save-button" id="save_doctor">Save Now</button>
      </div>
    </div>
  </div>
</div> 




<div class="modal fade" id="exampleModal_assign" 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">Assign</h1>
        <button type="button" 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-5">
                <select class="form-control custom-fields mt-3" id="assign_doctor">
                    <option value="" >Select Doctor</option>
                    <?php $__currentLoopData = $approved_doctors; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $doctor): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                                        <option value="<?php echo e($doctor->id); ?>"><?php echo e($doctor->name); ?></option>
                                                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                </select>
            </div> 
            
            <div class="col-lg-7">
                <select class="form-control custom-fields mt-3" id="assign_clinic">
                    <option value="">Select Clinic</option>
                    <option value="8">DH</option>
                    
                                                                    <?php $__currentLoopData = $clinics; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $clinic): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                                        <option value="<?php echo e($clinic->id); ?>"><?php echo e($clinic->name); ?></option>
                                                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                </select>
            </div> 
          
       </div>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-primary save-button" id="assign_doctor_submit">ASSIGN NOW</button>
      </div>
    </div>
  </div>
</div> 
        
        
        
     <input type="hidden" id="DC_hospital" value=''>   
        <input type="text" id="imagename">
        
        
        
       <!-- JS Start -->

       <!-- jq 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>

      <!-- bootstrap script --> 
      <!-- JavaScript Bundle with Popper -->
      <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>

      <!-- fontawesome script -->   
      <script src="https://kit.fontawesome.com/c026154490.js" crossorigin="anonymous"></script>  

      <script src="https://cdn.datatables.net/1.13.1/js/jquery.dataTables.min.js" crossorigin="anonymous"></script>  
      <script src="https://cdn.datatables.net/1.13.1/js/dataTables.bootstrap5.min.js" crossorigin="anonymous"></script>  

      <script src="<?php echo e(url('emr_assets/js/myjs.js')); ?>"></script>  
      
        
      

     
    </body>
</html>
<script>
        $(document).ready(function () 
        {
            $('#example').DataTable();
        });

        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);
        //  alert(autocomplete);
            google.maps.event.addListener(autocomplete, 'place_changed', function () {
                var place = autocomplete.getPlace();
                // alert('sec');
                // alert(place.name);
                // alert(place.geometry.location.lat());
                // alert(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);


        </script>

<script type="text/javascript">
    $("#assign_doctor_submit").click(function()
    {
        var baseurl='https://www.meddbot.com/district_hospital/';
        var assign_doctor_id=$("#assign_doctor").val();
        var assign_clinic_id=$("#assign_clinic").val();
        var user_token=$("#user_token").val();
        if(assign_doctor_id=='')
        {
            swal('Please Select Doctor');
            return false;
        }
        if(assign_clinic_id=='')
        {
            swal('Please Select Clinic');
            return false;
        }
        else
        {
            var data = {

                     assign_doctor_id      :assign_doctor_id,
                     assign_clinic_id   :assign_clinic_id,
                     _token   :user_token
                    
                  }

             $.ajax({url:baseurl+'assign_doctors',
                            type:"POST",
                            data:data,
                            success: function (res) {
                                console.log(res);
                                if(res=='Assigned')
                                {
                                    swal('Doctor Assigned Successfully !!');
                                }
                                else
                                {
                                    swal('Doctor Already Assigned !!');
                                }


                                     
                                console.log(res);
                                //location.reload();
                                window.setTimeout(function(){ 
                                    location.reload();
                                } ,3000);
                            }
                        });
        }

    });

    $("#save_doctor").click(function()
    {
        var baseurl='https://www.meddbot.com/district_hospital/';
        var user_token=$("#user_token").val();
        //alert();

        $.ajax({
              url:baseurl+'single_image_upload',
          type: "POST",
          data:  new FormData(document.getElementById("image-upload-form")),
          contentType: false,
              cache: false,
          processData: false,
          success: function(data)
            {
             // console.log(data.name);
              console.log(data);
              var result = data.slice(1);

              var imagename = result.substring(0, result.length-1);
              console.log(imagename);
              $("#imagename").val(imagename);
            //$("#targetLayer").html(data);
            },
            error: function(data)
            {
              console.log("error");
                  console.log(data);
            }
         });

        

        if ($('#d_hospital').is(':checked'))
        {
           //alert('checked');
           var doctor_type='District_hospital';
           $("#DC_hospital").val('District Hospital');
        }else{
           //alert('not checked');
           //var doctor_type='other_hospital';
           $("#DC_hospital").val('other_hospital');
        }

        var name=$("#name").val();
        var doctor_id=$("#doctor_id").val();
        var Clinic=$("#Clinic").val();
        var Qualification=$("#Qualification").val();
        var Pincode=$("#Pincode").val();
        var Specialisation=$("#Specialisation").val();
        var email=$("#Email").val();
        var Contact_number=$("#Contact_number").val();
        var Username=$("#Username").val();
        var Password=$("#Password").val();
        var phoneno = /^\d{10}$/;
        var indexWith=email.indexOf("@");
        var indexWithDot=email.lastIndexOf(".");
        var doctor_type=$("#DC_hospital").val();
        var locattion=$("#searchTextField").val();
        var cityLat=$("#cityLat").val();
        var cityLng=$("#cityLng").val();
        
        
        //alert(doctor_type);
        if(name=='')
        {
            swal('Please Enter Doctor Name');
            return false;
        }
        if(doctor_id=='')
        {
            swal('Please Enter Doctor Registration No');
            return false;
        }
        if(Pincode=='')
        {
            swal('Please Enter Pincode');
            return false;
        }
       
        if (Pincode.length != 6) 
        {
            swal("Your Pincode needs six Digits");
            return false;
        }
        if(Qualification=='')
        {
            swal('Please Enter Doctor Qualification');
            return false;
        }
        if(Specialisation=='')
        {
            swal('Please Enter Doctor Specialisation');
            return false;
        }
        if(email=='')
        {
            swal('Please Enter Doctor Email');
            return false;
        }
        if(indexWith<1 || indexWithDot<indexWith+2 || indexWithDot+2>=email.length)
        {
            swal("Please make sure email address contains @ and .com");
            return false;
        }
        if(Contact_number=='')
        {
            swal('Please Enter Doctor Contact Number');
            return false;
        }
        if(!Contact_number.match(phoneno))
        {
                swal("invalid Contact Number");
                return false;
        }
        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;
        }
        if(doctor_type=='other_hospital' && Clinic=='')
        {
            

                swal('Please Enter Clinic Name');
            
        }
        else
        {
            var DC_hospital=$("#DC_hospital").val();
            //alert(DC_hospital);
            if(DC_hospital=='other_hospital')
            {
                var Clinic_name=Clinic;
            }
            else
            {
                var Clinic_name=DC_hospital;
            }
            //alert(Clinic_name);



              $.ajax({
              url:baseurl+'single_image_upload',
          type: "POST",
          data:  new FormData(document.getElementById("image-upload-form")),
          contentType: false,
              cache: false,
          processData: false,
          success: function(data)
            {
             // console.log(data.name);
              console.log(data);
              var result = data.slice(1);

              var imagename = result.substring(0, result.length-1);
              console.log(imagename);
              $("#imagename").val(imagename);
              var imagename=$("#imagename").val();

               var data = {

                     name      :name,
                     doctor_id   :doctor_id,
                     Clinic : Clinic_name,
                     Qualification : Qualification,
                     Specialisation : Specialisation,
                     Email : email,
                     Pincode:Pincode,
                     Contact_number : Contact_number,
                     Username : Username,
                     Password : Password,
                     doctor_type : doctor_type,
                     imagename:imagename,
                     locattion:locattion,
                     latitude:cityLat,
                     longitude:cityLng,
                     _token   :user_token
                  }

             $.ajax({url:baseurl+'add_doctors',
                            type:"POST",
                            data:data,
                            success: function (res) {
                              //alert(res);
                                if(res==0)
                                {
                                    //swal('Doctor Added Successfully!!');
                                    swal({
                                 title: "Success!",
                                 text: "Doctor Added Successfully!!",
                                 type: "success",
                                 timer: 4000,
                                 // showConfirmButton: false
                                 });
                                    window.setTimeout(function(){ 
                                    location.reload();
                                } ,3000);
                                    //location.reload();
                                }
                                if(res==3)
                                {
                                    swal('UserName Already Exist!!');
                                }
                                if(res==2)
                                {
                                    swal('Contact Number Already Exist!!');
                                }
                                
                                if(res==1)
                                {
                                    swal('Email Already Exist!!');
                                }
                                
                                // location.reload();     
                                // console.log(res);
                                // location.reload();
                            }

                        });
            //$("#targetLayer").html(data);
            },
            error: function(data)
            {
              console.log("error");
                  console.log(data);
                  //location.reload();
                  window.setTimeout(function(){ 
                                    location.reload();
                                } ,3000);
            }
            
         });


            
       
         }
    });

    function delete_doctor(id)
    {
       // alert(id);
        var baseurl='https://www.meddbot.com/district_hospital/';
        let text = "Are you sure to delete Doctor!";
        var user_token=$("#user_token").val();
          if (confirm(text) == true) 
          {
            var data = {

                     id      :id,
                     _token   :user_token
                  }

             $.ajax({url:baseurl+'delete_doctor',
                            type:"POST",
                            data:data,
                            success: function (res) {
                                if(res!='')
                                {
                                    swal('Doctor Deleted!!');
                                }
                                
                                console.log(res);
                               // location.reload();
                               window.setTimeout(function(){ 
                                    location.reload();
                                } ,3000);
                                console.log(res);
                                
                            }
                        });  
          } 
          else 
          {
            
          }
    }
    $("#search_doctor_button").click(function()
    {
        
        var baseurl='https://www.meddbot.com/district_hospital/';
        var search_doctor=$("#search_doctor").val();
        var user_token=$("#user_token").val();
        //alert(search_hospital);
        if(search_doctor=='')
        {
            swal('Please Enter Doctor Name')
        }
        else
        {
            var data = {

                     search_doctor      :search_doctor,
                     _token   :user_token
                  }

             $.ajax({url:baseurl+'search_doctor',
                            type:"POST",
                            data:data,
                            success: function (res) {
                                
                                if(res!='')
                                {
                                    res1=JSON.parse(res);
                                    
                                    var registration_number= res1['search_doctor']['0'].registration_number;
                                    $("#registration_number_view").html(registration_number);
                                    var contact_number= res1['search_doctor']['0'].contact_phone_no;
                                    $("#contact_number_view").html(contact_number);
                                    var email= res1['search_doctor']['0'].email;
                                    $("#email_view").html(email);
                                    var name= res1['search_doctor']['0'].name;
                                    $("#name_view").html(name);
                                    var clinic_name= res1['search_doctor']['0'].clinic_name;
                                    $("#clinic_name_view").html(clinic_name);
                                    var specialisation= res1['search_doctor']['0'].specialisation;
                                    $("#specialisation_view").html(specialisation);
                                    $("#list_view").hide();
                                    $("#search_view").show();
                                }
                                
                                
                                
                            }
                        });
        }
        
    })
    $("#first").click(function()
    {
      $('#first').addClass('active');
      $('#collapseExample').addClass('show');
      $('#second').removeClass('active');
      $('#collapseExample_1').removeClass('show');
    });
    $("#second").click(function()
    {
      $('#second').addClass('active');
      $('#collapseExample_1').addClass('show');
      $('#first').removeClass('active');
      $('#collapseExample').removeClass('show');
    })
</script><?php /**PATH /home/meddbot/public_html/resources/views/district_hospital_new/doctors_list.blade.php ENDPATH**/ ?>