<html>
    <head>
        <!-- Required meta tags -->
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
        
        
        <!-- 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')); ?>">
        
        <title>Meddbot</title>
    </head>
    <body>
      
       <main>
           <div class="sidebar">
               <div class="logo-section">
                   <img src="<?php echo e(url('emr_assets/img/logo.png')); ?>">
               </div>
               <div class="menu">
                   <ul>
                       <li>
                          <a class=" nav-link active " data-bs-toggle="collapse" href="#collapseExample" role="button" aria-expanded="false" aria-controls="collapseExample">
                            <img src="<?php echo e(url('emr_assets/img/hospital-icon.svg')); ?>">
                              <span> Hospitals</span>
                          </a>

                        <div class="collapse show" id="collapseExample">
                           <ul class="sub-menu" >
                               <li> <a  href="<?php echo e(url('/api/district_hospital/dashboard')); ?>"><i class="bi bi-dash-lg"></i> PHC / CHC</a> </li>
                               <li> <a class="active" href="<?php echo e(url('/api/district_hospital/doctors')); ?>"><i class="bi bi-dash-lg"></i> Doctors</a> </li>
                               <li> <a href="<?php echo e(url('/api/district_hospital/medicines')); ?>"><i class="bi bi-dash-lg"></i> Medicines</a> </li>
                               <li> <a href="<?php echo e(url('/api/district_hospital/labs')); ?>"><i class="bi bi-dash-lg"></i> Labs</a> </li>
                            </ul>
                        </div>
                       </li>
                       <li>
                           <a href="#" class="nav-link" >
                                <img src="<?php echo e(url('emr_assets/img/notifications-icon.svg')); ?>">
                              <span>Notifications</span>
                           </a>
                       </li>
                       <li>
                           <a href="#" class="nav-link" >
                                <img src="<?php echo e(url('emr_assets/img/pharmacy-icon.svg')); ?>">
                              <span>Pharmacy</span>
                           </a>
                       </li>
                       <li>
                           <a href="#" class="nav-link" >
                                <img src="<?php echo e(url('emr_assets/img/request-icon.svg')); ?>">
                              <span>Requests</span>
                           </a>
                       </li>
                   </ul>
               </div>
           </div>
           <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">
                    <!-- <form method="GET" action="<?php echo e(url('district_hospital/search_hospital')); ?>" enctype="multipart/form-data"> -->
                       <!--  <?php echo csrf_field(); ?> -->
                       <div class="search">
                        
                               <!-- <select class="form-control custom-fields mt-3" id="assign_clinic">
                                        <option value="">Select Clinic</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>
                       <!-- </form> -->
                       <div class="actions">
                           <a href="https://www.meddbot.com/api/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_dont"><a style="color: white;" href="https://www.meddbot.com/api/district_hospital/doctors">Doctors List</a></button>
                       </div>
                   </div>
                   <div class="medd-content shadow-sm p-4 mt-4">
                    <div class="col-lg-12">
                     <h6 style="width: 50%;float: left;"><a href="https://www.meddbot.com/api/district_hospital/doctors_approvals">Approvals</a></h6>
                      <h6 style="text-align: right;"><a href="https://www.meddbot.com/api/district_hospital/doctors_rejected">Rejected List</a></h6></div>
                       
                       
                       <div class="row g-3 align-items-center mt-2">

                        <?php $__currentLoopData = $un_approved_doctors; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $un_approved_doctor): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <div class="col-lg-3">
                                   <div class="dr-request d-flex  flex-column ">
                                       <div class="dr-details d-flex align-items-center">
                                           <span class="thumb" >D</span>
                                           <div>
                                               <h5><?php echo e($un_approved_doctor->name); ?></h5>
                                               <p><?php echo e($un_approved_doctor->clinic_name); ?></p>
                                           </div>
                                       </div>
                                       <div class="req-buttons d-flex justify-content-between">
                                           <button class="btn approve btn-success" onclick="approve_doctor('<?php echo e($un_approved_doctor->id); ?>');" >Accept</button>
                                           <button class="btn reject btn-danger "  onclick="reject_doctor('<?php echo e($un_approved_doctor->id); ?>');" >Reject</button>
                                       </div>
                                   </div>
                               </div>
                                                                        
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                           
                           
                           
                       </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;">Self
            </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="Doctor ID *">
            </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->name); ?>"><?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="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="">Specialisation *</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" 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="text" class="form-control custom-fields mt-3" id="Password" placeholder="Password *">
            </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>
                    
                                                                    <?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>

<div class="modal fade" id="exampleModal_reject" 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">Reject</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">
                <label>Reason</label>
                <input type="text" id="reject_reason" style="width:100%;height: 45px;border: 1px solid #ccc;margin-top: 10px;">
            </div> 
            
            <input type="hidden" id="reject_id">
          
       </div>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-primary save-button" id="reject_doctor_submit">REJECT NOW</button>
      </div>
    </div>
  </div>
</div>

        
        
        
        
        
        
        
        
       <!-- 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>  
      
        
      <script>
          $(document).ready(function () {
    $('#example').DataTable();
});
        </script>

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

    function reject_doctor(id)
    {
       $("#reject_id").val(id);
       $('#exampleModal_reject').modal('show');

    }

    $("#reject_doctor_submit").click(function()
    {
        var baseurl='https://www.meddbot.com/api/district_hospital/';
        let text = "Are you sure to Reject Doctor!";
          if (confirm(text) == true) 
          {
            var id=$("#reject_id").val();
            var reject_reason=$("#reject_reason").val();
            if(reject_reason=='')
            {
                alert("Please Enter Reason");
            }
            else
            {
               var data = {

                     id      :id,
                     reject_reason : reject_reason
                  }

             $.ajax({url:baseurl+'reject_doctor',
                            type:"POST",
                            data:data,
                            success: function (res) {
                                if(res!='')
                                {
                                    alert('Doctor Rejected !!');
                                }
                                
                                console.log(res);
                                location.reload();
                                console.log(res);
                                
                            }
                        });   
            }
            
          } 
          else 
          {
            
          }
    })

    

    function approve_doctor(id)
    {
       // alert(id);
        var baseurl='https://www.meddbot.com/api/district_hospital/';
        let text = "Are you sure to Approve Doctor!";
          if (confirm(text) == true) 
          {
            var data = {

                     id      :id
                  }

             $.ajax({url:baseurl+'approve_doctor',
                            type:"POST",
                            data:data,
                            success: function (res) {
                                if(res!='')
                                {
                                    alert('Doctor Approved !!');
                                }
                                
                                console.log(res);
                                location.reload();
                                console.log(res);
                                
                            }
                        });  
          } 
          else 
          {
            
          }
    }

    $("#save_hospital").click(function()
    {
        var baseurl='https://www.meddbot.com/api/district_hospital/';
        
        var Establishment_name=$("#Establishment_name").val();
        var Address=$("#Address").val();
        var State=$("#State").val();
        var City=$("#City").val();
        var Pincode=$("#Pincode").val();
        var Contact_name=$("#Contact_name").val();
        var Contact_number=$("#Contact_number").val();
        var email=$("#email").val();
        var Password=$("#Password").val();

        var indexWith=email.indexOf("@");
        var indexWithDot=email.lastIndexOf(".");

        var phoneno = /^\d{10}$/;
        var pincode_digit = /^\d{6}$/;

        if(Establishment_name=='')
        {
            alert('Please Enter Establishment Name');
            return false;
        }
        if(Address=='')
        {
            alert('Please Enter Address');
            return false;
        }
        if(State=='')
        {
            alert('Please Enter State');
            return false;
        }
        if(City=='')
        {
            alert('Please Enter City');
            return false;
        }
        if(Pincode=='')
        {
            alert('Please Enter Pincode');
            return false;
        }
        if(!Pincode.match(pincode_digit))
        {
                alert("invalid Pincode");
                return false;
        }
        if(Contact_name=='')
        {
            alert('Please Enter Contact Name');
            return false;
        }
        if(Contact_number=='')
        {
            alert('Please Enter Contact Number');
            return false;
        }
        if(!Contact_number.match(phoneno))
        {
                alert("invalid Contact Number");
                return false;
        }
        if(email=='')
        {
            alert('Please Enter Email');
            return false;
        }
        if(indexWith<1 || indexWithDot<indexWith+2 || indexWithDot+2>=email.length)
        {
            alert("Please make sure email address contains @ and .com");
            return false;
        }
        if (Password.length < 6) 
        {
            alert("Your password needs a minimum of six characters");
            return false;
        }
        if (Password.search(/[a-z]/) == -1)
        {
            alert("Your password needs a lower case letter");
            return false;
        }
        if (Password.search(/[A-Z]/) == -1) 
        {
            alert("Your password needs an uppser case letter");
            return false;
        }
        if(Password.search (/[0-9]/) == -1) 
        {
            alert("Your password needs a number");
            return false;
        }
        else
        {
          var data = {

                     Establishment_name      :Establishment_name,
                     Address   :Address,
                     State : State,
                     City : City,
                     Pincode : Pincode,
                     Contact_name : Contact_name,
                     Contact_number : Contact_number,
                     email : email,
                     Password : Password
                  }

             $.ajax({url:baseurl+'add_hospitals',
                            type:"POST",
                            data:data,
                            success: function (res) {
                                if(res!='')
                                {
                                    alert('Record Saved!!');
                                }
                                
                                console.log(res);
                                location.reload();
                                console.log(res);
                                
                            }
                        });  
        }
        

        
    });


    const validateEmail = (email) => 
    {
      return email.match(
        /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
      );
    };

    // $("#country").change(function()
    // {
    //         var country_id=$("#country").val();
    //         alert(country_id);

    //         var baseurl='https://www.meddbot.com/api/district_hospital/';
        
       
    //         var data = 
    //             {
    //                  country_id : country_id
    //             }

    //             $.ajax({url:baseurl+'find_state',
    //                         type:"POST",
    //                         data:data,
    //                         success: function (res) 
    //                         {
    //                             if(res!='')
    //                             {
    //                                $.each( res, function( key, value ) 
    //                                {
    //                                   alert( key + ": " + value );
    //                                }); 
    //                             }
                                
    //                             console.log(res);
                                
                                
    //                         }
    //                 });
    // });

    $("#State").change(function()
    {
            var state_id=$("#State").val();
            //alert(state_id);

            var baseurl='https://www.meddbot.com/api/district_hospital/';
        
       
            var data = 
                {
                     state_id : state_id
                }

                $.ajax({url:baseurl+'find_district',
                            type:"POST",
                            data:data,
                            success: function (res) 
                            {
                                if(res!='')
                                {
                                   $.each( res, function( key, value ) 
                                   {
                                      alert( key + ": " + value );
                                   }); 
                                }
                                
                                console.log(res);
                                
                                
                            }
                    });
    });
    function delete_hospital(id)
    {
       // alert(id);
        var baseurl='https://www.meddbot.com/api/district_hospital/';
        let text = "Are you sure to delete Hospital!";
          if (confirm(text) == true) 
          {
            var data = {

                     id      :id
                  }

             $.ajax({url:baseurl+'delete_hospitals',
                            type:"POST",
                            data:data,
                            success: function (res) {
                                if(res!='')
                                {
                                    alert('Hospital Deleted!!');
                                }
                                
                                console.log(res);
                                location.reload();
                                console.log(res);
                                
                            }
                        });  
          } 
          else 
          {
            
          }
    }
    $("#search_hospital_button").click(function()
    {
        alert(search_hospital);
        var baseurl='https://www.meddbot.com/api/district_hospital/';
        var search_hospital=$("#search_hospital").val();
        var data = {

                     search_hospital      :search_hospital
                  }

             $.ajax({url:baseurl+'search_hospital',
                            type:"POST",
                            data:data,
                            success: function (res) {
                                if(res!='')
                                {
                                    //alert('Hospital Deleted!!');
                                }
                                
                                // console.log(res);
                                // location.reload();
                                // console.log(res);
                                
                            }
                        });
    })
</script><?php /**PATH /home/meddbot/public_html/resources/views/district_hospital/doctors_approvals.blade.php ENDPATH**/ ?>