
<?php
Session::get('lab_email');
$id=Session::get('lab_id');
Session::put('lab_id', $id);
$id;
?>
<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')); ?>">
        
        <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>
      <style>
        .btn-primary1
        {
         
          background: #11a9bbeb !important;
    height: 30px;
    border-radius: 5px;
    color: white;
    margin-right: 10px;
        }
        .modal-body.addnew input, .modal-body.addnew select {
    border: 5;
    border-radius: 6px;
    border-bottom: 2px solid #ccc;
    color: #6c6969;
}
.loader {
  border: 16px solid #f3f3f3;
  border-radius: 50%;
  border-top: 16px solid #3498db;
  width: 120px;
  height: 120px;
  -webkit-animation: spin 2s linear infinite; /* Safari */
  animation: spin 2s linear infinite;
  margin-left: 40%;
    display: none;
}

/* Safari */
@-webkit-keyframes spin {
  0% { -webkit-transform: rotate(0deg); }
  100% { -webkit-transform: rotate(360deg); }
}

@keyframes  spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
</style>
      <style type="text/css">
        .pac-target-input{
                z-index: 10000 !important;
                /*width: auto !important;*/
                position: initial !important;
                left: 0 !important;
                right: 0 !important;
                display: block !important;
            }
            /*.pac-container:empty{
                display: none !important;
            }*/
            .pac-container { z-index: 2000 !important;  }
      </style>
       <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 " 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> Lab</span>
                          </a>

                        <div class="collapse show" id="collapseExample">
                           <ul class="sub-menu" >
                              
                              <li> <a  href="https://www.meddbot.com/district_hospital/lab_appointment/<?php echo e($id); ?>"><i class="bi bi-dash-lg"></i> Patients</a> </li>
                               <li> <a class="active" href="https://www.meddbot.com/district_hospital/lab_test_request_login/<?php echo e($id); ?>"><i class="bi bi-dash-lg"></i> My Appointments</a> </li>
                              
                               <li> <a  href="https://www.meddbot.com/district_hospital/lab_test_request_uploaded_login/<?php echo e($id); ?>"><i class="bi bi-dash-lg"></i>Test Results</a> </li>
                                <li> <a  href="https://www.meddbot.com/district_hospital/lab_test_request_uploaded_login/<?php echo e($id); ?>"><i class="bi bi-dash-lg"></i>Doctors</a> </li>
                            </ul>
                        </div>
                       </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>My Appointments</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><?php echo e(Session::get('lab_name')); ?></h5>
                          
                           <div class="dropdown">
                                  <button class=" btn-secondary dropdown-toggle user-profile" type="button" data-bs-toggle="dropdown" aria-expanded="false">
                                    <span class="" >L</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="<?php echo e(url('/logout')); ?>">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 Lab" class="form-control" >
                           <button class="btn-primary search-hos" > Submit</button> -->
                       </div>
                       <div class="actions">
                           <!-- <button class="btn-primary add-new" data-bs-toggle="modal" data-bs-target="#"> Approvals</button>
                           <button class="btn-primary add-new" data-bs-toggle="modal" data-bs-target="#"> 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">
                       
                       <div class="row align-items-center">
                           <div class="col-lg-8">
                             <!--   <h6>Test 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" > -->
                           </div>
                       </div>
                       

                       
                       <!-- <div  class="table table-responsive"> -->
                            <table id="example" class="table table-striped" style="width:100%">
                          <thead>
                            <tr>
                              <th scope="col">SL No</th>
                              <th scope="col">Doctor Name</th>
                              <th scope="col">Patient Name</th>
                              <th scope="col">Lab Name</th>
                              <th scope="col">Status</th>
                              <th scope="col">Contact Number</th>
                              <th scope="col">Aadhar</th>
                              
                              <th scope="col">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->doctor_name); ?></a> </td>
                               <td scope="row"><a href="#"><?php echo e($doctor->patient_name); ?></a> </td>
                              <td><?php echo e($doctor->name); ?></td>
                              <td>
                                <?php
                                if($doctor->test_report_status==0)
                                {
                                  echo "Lab Report Pending";
                                }
                                else
                                {
                                  echo "Report Uploaded";
                                }

                                  ?>
                              </td>
                               <td><?php echo e($doctor->patient_contact_number); ?></td>
                              <td><?php echo e($doctor->aadhar_no); ?></td>
                              
                              <td>
                                  <div class="action-buttons">

                                    <button class="edit" onclick="upload_function('<?php echo e($doctor->doctor_name); ?>','<?php echo e($doctor->patient_name); ?>','<?php echo e($doctor->consult_id); ?>','<?php echo e($doctor->req_id); ?>')" > <span><i class="bi bi-pencil-square" ></i></span>Upload</button>

                                    <?php
                                    if($doctor->status==1)
                                    {
                                      ?>
                                      <a  href="<?php echo e(url('/district_hospital/collect_specimen/'.$doctor->patient_lab_test_id)); ?>">
                                        <button class="btn-primary1" onclick="add_to_appointment('<?php echo e($doctor->req_id); ?>');"> Lab Test</button>
                                      </a>
                                      <?php
                                    }

                                    if($doctor->status==2)
                                    {
                                      ?>
                                       <a  href="<?php echo e(url('/district_hospital/add_test_result/'.$doctor->patient_lab_test_id)); ?>">
                                    <button class="btn-primary1" onclick="add_to_appointment('<?php echo e($doctor->req_id); ?>');"> Add Test Result</button>
                                    </a>
                                      <?php
                                    }
                                    ?>
                                      
                                    
                                     
                                      <!-- <button class="edit" onclick="upload_function('<?php echo e($doctor->doctor_name); ?>','<?php echo e($doctor->patient_name); ?>','<?php echo e($doctor->consult_id); ?>','<?php echo e($doctor->req_id); ?>')" > <span><i class="bi bi-pencil-square" ></i></span>Upload</button> -->
                                      <!-- <button class="delete" onclick="delete_lab_report('<?php echo e($doctor->req_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>
               <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">Upload Lab Report</h1>
        <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
      </div>
      <div class="modal-body addnew">
        <div class="loader"></div>
       <div class="row mb-3">
         <div class="col-lg-12" style="margin-bottom: 10px;">
            <div class="col-lg-5" style="float: left;">
                <label>Dr.Name : </label>
            </div> 
            <div class="col-lg-7">
               <label id="dr_name"></label> 
            </div>
          </div>
          <div class="col-lg-12" style="margin-bottom: 10px;">
            <div class="col-lg-5" style="float: left;">
                <label>Patient Name:</label>
            </div> 
            <div class="col-lg-7" style="float: left;">
               <label id="patient_name"></label> 
            </div>
          </div>
          <div class="col-lg-12" style="margin-bottom: 10px;">
            <div class="col-lg-5" style="float: left;">
                <label>Lab Test Name:</label>
            </div> 
            <div class="col-lg-7" style="float: left;">
               <label id="lb_tst_name"></label> 
            </div>
          </div>

          <div class="col-lg-12" style="margin-bottom: 10px;">
            <div class="col-lg-5" style="float: left;">
                <label> Upload Result:</label>
            </div> 
            <div class="col-lg-7" style="float: left;">

              <form id="image-upload-form" method="post">
                <input type="hidden" id="user_token" name="_token" value="<?php echo e(csrf_token()); ?>"> 
                 <!--  <div id="targetLayer">Image Preview</div> -->
                  <div style="float: left;">
                   
                    <input name="userImage" id="userImage" type="file" class="inputFile" />
                  </div>
                  <div style="float: left;">
                    <button type="button" class="btn btn-primary save-button"  id="upload"> Upload</button> 
                  </div>
                </form>
                </div>
          </div>
          <div class="col-lg-12" style="margin-bottom: 10px;">
            <div class="col-lg-5" style="float: left;">
                <label>Uploaded Test Name:</label>
            </div> 
            <div class="col-lg-7" style="float: left;">
               <input style="border: 2px solid #ced4da;" type="text" class="form-control" id="test_result_name">
            </div>
          </div>
            
           

            
            
            <input type="hidden" id="consult_id" >
            <input type="hidden" id="imagename">
            <input type="hidden" id="test_result_id">
            
       </div>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-primary save-button" id="save_lab_reports">Save Now</button>
      </div>
    </div>
  </div>
</div> 
    <!-- <input type="hidden" id="user_token" name="_token" value="<?php echo e(csrf_token()); ?>">  -->    
        
        
        
        
        
        
        
       <!-- 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();
        }); 

    $("#upload").click(function()
    {
        var baseurl='https://www.meddbot.com/district_hospital/';
        var user_token=$("#user_token").val();
        //swal();
$(".loader").show();
        $.ajax({
              url:baseurl+'single_image_upload',
          type: "POST",
          data:  new FormData(document.getElementById("image-upload-form")),
          contentType: false,
              cache: false,
          processData: false,
          success: function(data)
            {
             // console.log(data.name);
              console.log(data);
              var result = data.slice(1);

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

       function upload_function(doc_name,pati_name,consult_id,id)
       {
        var baseurl='https://www.meddbot.com/district_hospital/';
        var user_token=$("#user_token").val();
        $("#consult_id").val(consult_id);
        //swal(consult_id);
        var data = {

                     id :id,
                     _token   :user_token
                  }

             $.ajax({url:baseurl+'list_lab_test',
                            type:"POST",
                            data:data,
                            success: function (res) 
                            {
                              console.log(res);
                              $("#lb_tst_name").html(res);
                              $("#test_result_name").val(res);
                              $("#test_result_id").val(id);
                            }
                          });
        //swal(consult_id);
        //swal(doc_name);
        //swal(pati_name);
        $("#patient_name").html(pati_name);
        $("#dr_name").html(doc_name);

        $("#exampleModal").modal("toggle");
       }

      


        </script>
<script type="text/javascript">
    $("#save_lab_reports").click(function()
    {
        var baseurl='https://www.meddbot.com/district_hospital/';
        var user_token=$("#user_token").val();
        //swal();
        var consult_id=$("#consult_id").val();
        var imagename=$("#imagename").val();
        var test_result_name=$("#test_result_name").val();
        var test_result_id=$("#test_result_id").val();
        

        var data = {

                     imagename      :imagename,
                     consult_id   :consult_id,
                     test_result_name:test_result_name,
                     test_result_id:test_result_id,
                     _token   :user_token
                    
                  }

             $.ajax({url:baseurl+'save_lab_reports',
                            type:"POST",
                            data:data,
                            success: function (res) {
                                if(res!='')
                                {
                                    swal('Lab Report Saved!!');
                                }
                                
                                console.log(res);
                                //location.reload();
                                window.setTimeout(function(){ 
                                    location.reload();
                                } ,3000);
                            }
                        });
    });


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

                     id      :id,
                     _token   :user_token
                  }

             $.ajax({url:baseurl+'delete_lab_report',
                            type:"POST",
                            data:data,
                            success: function (res) {
                                if(res!='')
                                {
                                    swal('Lab Deleted!!');
                                }
                                
                                console.log(res);
                               // location.reload();
                               window.setTimeout(function(){ 
                                    location.reload();
                                } ,3000);
                                console.log(res);
                                
                            }
                        });  
          } 
          else 
          {
            
          }
    }
    $("#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/lab_dashboard.blade.php ENDPATH**/ ?>