<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')); ?>">
        <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%;
            }
        </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>
           <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  " id="first"  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 " 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  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>
                               <!-- <li> <a href="<?php echo e(url('/api/district_hospital/lab_test_request')); ?>"><i class="bi bi-dash-lg"></i> Lab Test Request</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 class=" nav-link active " id="second" data-bs-toggle="collapse" href="#collapseExample_1" role="button" aria-expanded="false" aria-controls="collapseExample">
                            <img src="<?php echo e(url('emr_assets/img/pharmacy-icon.svg')); ?>">
                              <span>Pharmacy</span>
                          </a>
                          <div class="collapse show" id="collapseExample_1">
                           <ul class="sub-menu" >
                               <li> <a class="active" href="<?php echo e(url('/api/district_hospital/pharmacy')); ?>"><i class="bi bi-dash-lg"></i>Pharmacy List</a> </li>
                               <li> <a  href="<?php echo e(url('/api/district_hospital/pharmacy_med_list')); ?>"><i class="bi bi-dash-lg"></i>Medicine Dispatch</a> </li>
                               <li> <a   href="<?php echo e(url('/api/district_hospital/pharmacy_med_list_low')); ?>"><i class="bi bi-dash-lg"></i>Stock Report</a> </li>
                               <li> <a   href="<?php echo e(url('/api/district_hospital/medicine_request_list')); ?>"><i class="bi bi-dash-lg"></i> Medicine Request List</a> </li>
                               <li> <a   href="<?php echo e(url('/api/district_hospital/others_request_list')); ?>"><i class="bi bi-dash-lg"></i> Other Request List</a> </li>
                            </ul>
                        </div>
                           <!-- <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>Pharmacy</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 Pharmacy" 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/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"> 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;">Pharmacy 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%;" >Pharmacy Name</th>
                             <!--  <th scope="col" style="width:7%;" >PHC/CHC</th> -->
                              <th scope="col" style="width:17%;" >Clinic Name</th>
                              <th scope="col" style="width:20%;" >Email</th>
                              <th scope="col" style="width:18%;">User Name</th>
                              <th scope="col" style="width:10%;">Actions</th>
                            </tr>
                          </thead>
                          <tbody>
                            <?php $i=1;?>
                            <?php $__currentLoopData = $details; $__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->name); ?></a> </td>
                              <!-- <td> PHC</td> -->
                              <td><?php echo e($doctor->clinic_name); ?></td>
                              <td><?php echo e($doctor->email); ?></td>
                              <td><?php echo e($doctor->user_name); ?></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_pharmacy('<?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 Pharmacy</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="Pharmacy Name *">
            </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="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>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-primary save-button" id="save_pharmacy">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>
                    
                </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>
                    
                                                                   
                </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="text" id="DC_hospital" value=''>   
        
        
        
        
       <!-- 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();
        });
        </script>

<script type="text/javascript">
    $("#assign_doctor_submit").click(function()
    {
        var baseurl='https://www.meddbot.com/api/district_hospital/';
        var assign_doctor_id=$("#assign_doctor").val();
        var assign_clinic_id=$("#assign_clinic").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
                    
                  }

             $.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_pharmacy").click(function()
    {
        var baseurl='https://www.meddbot.com/api/district_hospital/';
        //swal();

        
        var name=$("#name").val();
       
        var Clinic=$("#Clinic").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();
        //swal(doctor_type);
        if(name=='')
        {
            swal('Please Enter Pharmacy Name');
            return false;
        }
        
        if(email=='')
        {
            swal('Please Enter Pharmacy 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 Pharmacy 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(Clinic=='')
        {
            

                swal('Please Enter Clinic Name');
            
        }
        else
        {
            
            
        var data = {

                     name      :name,
                     Clinic : Clinic,
                     Email : email,
                     Contact_number : Contact_number,
                     Username : Username,
                     Password : Password,
                  }

             $.ajax({url:baseurl+'add_Pharmacy',
                            type:"POST",
                            data:data,
                            success: function (res) {
                              //swal(res);
                                if(res==0)
                                {
                                    swal('Pharmacy Added Successfully!!');
                                    location.reload();
                                }
                                else
                                {
                                    swal('Pharmacy Credentials Exist!!');
                                }
                                     
                                console.log(res);
                                window.setTimeout(function(){ 
                                    location.reload();
                                } ,3000);
                                
                            }
                        });
         }
    });

    function delete_pharmacy(id)
    {
       // swal(id);
        var baseurl='https://www.meddbot.com/api/district_hospital/';
        let text = "Are you sure to delete Pharmacy!";
          if (confirm(text) == true) 
          {
            var data = {

                     id      :id
                  }

             $.ajax({url:baseurl+'delete_pharmacy',
                            type:"POST",
                            data:data,
                            success: function (res) {
                                if(res!='')
                                {
                                    swal('Pharmacy 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/api/district_hospital/';
        var search_doctor=$("#search_doctor").val();
        //swal(search_hospital);
        if(search_doctor=='')
        {
            swal('Please Enter Pharmacy Name')
        }
        else
        {
            var data = {

                     search_doctor      :search_doctor
                  }

             $.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/pharmacy_list.blade.php ENDPATH**/ ?>