<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>
           <?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>Pharmacy Medicines</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">
                <input type="hidden" id="user_token" name="_token" value="<?php echo e(csrf_token()); ?>">
                   <div class="action-sec d-flex justify-content-between">
                       <div class="search">
                           <select class="form-control custom-fields mt-3" id="phar_id">
                              <option value="" >Select Pharmacy</option>
                              <option value="0" >ALL</option>
                              <?php $__currentLoopData = $pharmacy_list; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $pharmacy): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                              <option value="<?php echo e($pharmacy->id); ?>" ><?php echo e($pharmacy->name); ?></option>
                              <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                              
                          </select>
                          <?php
                          {
                            //echo $pharmacy_name;
                            if(isset($pharmacy_name))
                            ?>
                              <input id="approve_all_select_pharmacy" style="border: none;
    background: #d8e1e108;
    margin-top: 15px;
    margin-left: 30px;" type="text" value="<?php echo e($pharmacy_name); ?>">
                            <?
                          }
                          ?>
                           <!-- <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;">Medicine Request 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" > -->
                               <label style="margin-left: 40%;">All</label>
                              <input type="checkbox" onchange="checkAll(this)" name="chk_all" id="dispatched_markall" > 
                               <button style="float: right;" id="approve_all"  class="btn-primary add-new" >APPROVAL</button>
                           </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</th>
                              <th scope="col" style="width:15%;" >Medicine Name</th>
                              <th scope="col" style="width:10%;">Request</th>
                              <th scope="col" style="width:15%;">Dispatched quantity</th>
                              <th scope="col" style="width:15%;" >Request Date</th>
                              <th scope="col" style="width:20%;"> 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->pharmacy_name); ?></a> </td>
                              <td><?php echo e($doctor->medicine_name); ?></td>
                              <td><?php echo e($doctor->request_count); ?></td>
                              <td><input type="text" id="dispatched_quantity_<?php echo e($doctor->id); ?>" value="<?php echo e($doctor->request_count); ?>"></td>
                              <td><?php echo e($doctor->created_at); ?></td>
                              <td>
                                  <div class="action-buttons">
                                    <input type="checkbox" name="foo" id="dispatched_<?php echo e($doctor->id); ?>">
                                      <button style="background: #52cb4d;
    border-radius: 5px;
    height: 30px;
    margin-left: 10px;
" onclick="approve_med_request('<?php echo e($doctor->pharmacy_id); ?>','<?php echo e($doctor->id); ?>','<?php echo e($doctor->request_count); ?>' )" > Approve</button>
                                      
                                  </div>
                                </td>
                            </tr>
                            <?php $i++;?>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                             
                              
                          </tbody>

                        </table>

                       <!-- </div> -->
                   </div>

                   <input type="text" id="pharmacy_id" value="<?php echo e($pharmacy_id); ?>">
                   <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 Medicines</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="Medicine Name *">
            </div> 

            <div class="col-lg-4">
                <input type="text" class="form-control custom-fields mt-3" id="name" placeholder="Qty *">
            </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">
                <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>
                    
                                                                   
                </select>
            </div>  -->
            <div class="col-lg-4">
                <input type="text" class="form-control custom-fields mt-3" id="Email" placeholder="Date of Purchase *">
            </div> 
            <div class="col-lg-4">
                <input type="text" class="form-control custom-fields mt-3" id="Contact_number" placeholder="Expiry Date *">
            </div> 
           <div class="col-lg-4">
                <input type="text" class="form-control custom-fields mt-3" id="Username" placeholder="Supplier 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>
                    
                </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/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);
                            }
                        });
        }

    });

    $("#approve_all").click(function()
    {
            var baseurl='https://www.meddbot.com/district_hospital/';
            //swal();
            var approve_all_select_pharmacy=$("#approve_all_select_pharmacy").val();
            var user_token=$("#user_token").val();
            //swal(approve_all_select_pharmacy);
            if(approve_all_select_pharmacy=='')
            {
              swal("Please Choose Pharmacy");
              return false;
            }
            else
            {
              var pharmacy_id=$("#pharmacy_id").val();
            var someObj={};
            someObj.requestids=[];
            someObj.dispatched_quantity=[];
            someObj.pharmacy_id=pharmacy_id;
            someObj._token    =user_token;

            $("input:checkbox").each(function(){
                var $this = $(this);

                if($this.is(":checked"))
                {
                    
                    //swal($this.attr("id"));
                    var ck_id=$this.attr("id");
                    var r_id=getSecondPart(ck_id);
                    //swal(r_id);
                    if(r_id!='markall')
                    {
                       var dispatched_quantity=$("#dispatched_quantity_"+r_id).val();
                      //swal(dispatched_quantity);

                      someObj.requestids.push(r_id);
                      someObj.dispatched_quantity.push(dispatched_quantity);
                    }
                   
                }
                // else
                // {
                //     someObj.fruitsDenied.push($this.attr("id"));
                // }
            });
            //swal(someObj);
            console.log(someObj);

             $.ajax({url:baseurl+'approve_med_request_new',
                            type:"POST",
                            data:someObj,
                            success: function (res) {
                              //swal(res);
                                if(res=='Updated')
                                {
                                    swal('Request Approved!!');
                                }
                                if(res=='not updated')
                                {
                                    swal('Please Check Dispatched Quantity');
                                }
                                     
                                console.log(res);
                                //location.reload();
                                window.setTimeout(function(){ 
                                    location.reload();
                                } ,3000);
                            }
                        });



                  function getSecondPart(str) 
                  {
                      return str.split('_')[1];
                  }

            }
            
            
           

                });
    

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

        

        if ($('#d_hospital').is(':checked'))
        {
           //swal('checked');
           var doctor_type='District_hospital';
           $("#DC_hospital").val('District Hospital');
        }else{
           //swal('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 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();
        //swal(doctor_type);
        if(name=='')
        {
            swal('Please Enter Doctor Name');
            return false;
        }
        if(doctor_id=='')
        {
            swal('Please Enter Doctor ID');
            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();
            //swal(DC_hospital);
            if(DC_hospital=='other_hospital')
            {
                var Clinic_name=Clinic;
            }
            else
            {
                var Clinic_name=DC_hospital;
            }
            //swal(Clinic_name);

            
        var data = {

                     name      :name,
                     doctor_id   :doctor_id,
                     Clinic : Clinic_name,
                     Qualification : Qualification,
                     Specialisation : Specialisation,
                     Email : email,
                     Contact_number : Contact_number,
                     Username : Username,
                     Password : Password,
                     doctor_type : doctor_type,
                     _token   :user_token
                  }

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

    function approve_med_request(phar_id,id,count)
    {
        //swal(count);
        var pharmacy_id=$("#pharmacy_id").val();
        var user_token=$("#user_token").val();
        var dispatched_quantity=$("#dispatched_quantity_"+id).val();
        var baseurl='https://www.meddbot.com/district_hospital/';
        let text = "Are you sure to Approve Request!";
          if (confirm(text) == true) 
          {
            var data = {

                     id      :id,
                     count      :dispatched_quantity,
                     pharmacy_id : phar_id,
                     _token   :user_token
                  }

             $.ajax({url:baseurl+'approve_med_request',
                            type:"POST",
                            data:data,
                            success: function (res) {
                                if(res!='')
                                {
                                    swal('Request Approved!!');
                                }
                                
                                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();
        //swal(search_hospital);
        if(search_doctor=='')
        {
            swal('Please Enter Pharmacy 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();
                                }
                                
                                
                                
                            }
                        });
        }
        
    })
</script>
<script type="text/javascript">

  function checkAll(source) {
  checkboxes = document.getElementsByName('foo');
  for(var i=0, n=checkboxes.length;i<n;i++) {
    checkboxes[i].checked = source.checked;
  }
}

 //  function checkAll(ele) {
 //    swal();
 //     var checkboxes = document.getElementsByName('chk_all');
 //     if (ele.checked) {
 //      swal(checkboxes.length);
 //         for (var i = 0; i < checkboxes.length; i++) {
 //             if (checkboxes[i].type == 'checkbox') {
 //                 checkboxes[i].checked = true;
 //             }
 //         }
 //     } else {
 //         for (var i = 0; i < checkboxes.length; i++) {
 //             console.log(i)
 //             if (checkboxes[i].type == 'checkbox') {
 //                 checkboxes[i].checked = false;
 //             }
 //         }
 //     }
 // }

 $('#phar_id').on('change', function() {
  // swal( this.value );
  var baseurl="https://www.meddbot.com/district_hospital/";
  var phar_id=this.value;
   //swal(phar_id);

  window.location.href = baseurl+"pharmacy_medicine_request_list/"+phar_id;
          });

 $("#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/med_request_list.blade.php ENDPATH**/ ?>