
<?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>
        .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 class="lab">
           <div class="sidebar lab">
               <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 class="active" href="https://www.meddbot.com/district_hospital/lab_appointment/<?php echo e($id); ?>"><i class="bi bi-dash-lg"></i> Add Patients</a> </li>
                               <li> <a  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>Add Patient</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 cuss-padd mt-0">
                       <div class="main-heading">
                           <h1>Add Patient </h1>
                       </div>
                       <form  action="/district_hospital/save_external_patient" method="post">
            
                          <input type="hidden" id="user_token" name="_token" value="<?php echo e(csrf_token()); ?>">


                       <section class="Specimen_Info">
                       <div class="row">
                           <!-- <div class="col-lg-12" id="barcode-container">
                               <div class="barcode-container">
                                   <div class="bar-details justify-content-between">
                                       <div class="barcode-features">
                                           <div class="form-group">
                                               <label>Code No :</label>
                                               <div class="form-control codeno" >5389256</div>
                                           </div>
                                       </div>
                                       <div class="barcode-features">
                                           <div class="form-group">
                                               <label>Barcode :</label>
                                               <img class="bar-img" alt="img" src="<?php echo e(url('emr_assets/img/barcode.svg')); ?>">
                                           </div>
                                       </div>
                                   </div>
                               </div>
                           </div> -->


                           <div class="col-lg-6">
                               <div class="form-group">
                                   <label>First Name:</label>
                                   <input type="text" name="first_name" class="form-control"  >
                               </div>
                           </div>
                           <div class="col-lg-6">
                               <div class="form-group">
                                   <label>Last Name:</label>
                                   <input type="text" name="last_name" class="form-control"  >
                               </div>
                           </div>
                           <div class="col-lg-6">
                               <div class="form-group">
                                   <label>Date of Birth :</label>
                                   <input type="date" name="date_of_birth" class="form-control" placeholder="09/10/2024" >
                               </div>
                           </div>
                           <div class="col-lg-6">
                               <div class="form-group">
                                    <label>Gender : </label>
                                   <div class="check-container mt-3">
                                       <div class="chk-itm">
                                           <label class="container-lab-check">Male
                                              <input type="radio" name="gender" value="Male">
                                              <span class="checkmark-lab"></span>
                                           </label>
                                       </div>
                                       <div class="chk-itm">
                                           <label class="container-lab-check">Female
                                              <input type="radio" name="gender" value="Female">
                                              <span class="checkmark-lab"></span>
                                           </label>
                                       </div>
                                       <div class="chk-itm">
                                           <label class="container-lab-check">Other
                                              <input type="radio" name="gender" value="Other">
                                              <span class="checkmark-lab"></span>
                                           </label>
                                       </div>
                                       
                                   </div>
                                   <div id="Specimen-Type-Container" class="others-container" style="display: none;">
                                      <input type="text" name="gender_other" class="form-control" placeholder="Enter Other Specimen Types">
                                    </div>
                               </div>
                           </div>
                           <div class="col-lg-4">
                               <div class="form-group">
                                   <label>Blood Group :</label>
                                   <input type="text" name="blood_group" class="form-control"  >
                               </div>
                           </div>
                           <div class="col-lg-4">
                               <div class="form-group">
                                   <label>Contact Number :</label>
                                   <input type="text" name="contact_number" class="form-control" >
                               </div>
                           </div>
                           
                           <div class="col-lg-4">
                               <div class="form-group">
                                   <label>Aadhar No:</label>
                                   <input type="text" name="aadhar_number" class="form-control"  >
                               </div>
                           </div>
                           <div class="col-lg-8">
                               <div class="form-group">
                                   <label>Address:</label>
                                   <input type="text" name="address" class="form-control"  >
                               </div>
                           </div>

                           <div class="col-lg-4">
                               <div class="form-group">
                                   <label>District:</label>
                                   <input type="text" name="district" class="form-control"  >
                               </div>
                           </div>

                           <div class="col-lg-4">
                               <div class="form-group">
                                   <label>Doctor Name:</label>
                                   <input type="text" name="doctor_name" class="form-control"  >
                               </div>
                           </div>

                           <div class="col-lg-4">
                               <div class="form-group">
                                   <label>Clinic Name:</label>
                                   <input type="text" name="clinic_name" class="form-control"  >
                               </div>
                           </div>
                           
                           <input type="hidden" name="lab_id" value="<?php echo e($id); ?>">
                       </div>
                       </section>
                       
                       <section class="Specimen_Info">
                           <div class="sub-heading mb-4">
                           <h2>Choose Laboratory tests</h2>
                       </div>
                       <div class="row">
                           <div class="col-lg-12">
                               <div class="form-group">


                                 <div>
        <!-- Select box populated with PHP -->
        <select id="dynamicSelect" name="lab_test_name" class="form-control" style="width:50%;float: left;">
          <?php $__currentLoopData = $lab_test; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $value): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
           
                <option value="<?php echo e($value->id); ?>"><?php echo e($value->name); ?></option>
           <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
        </select>

        <!-- Add button to trigger JavaScript function -->
        <button class="lab-btn-common" id="addButton" type="button" style="margin-left: 15%;">Add</button>
    </div>

    <!-- Div to display selected checkboxes -->
    <div class="check-container mt-3" id="checkboxList"></div>


                                  
                                   <div id="Laboratory-tests-Container" class="others-container" style="display: none;">
                                      <input type="text" class="form-control" placeholder="Enter Other Laboratory Tests">
                                    </div>
                               </div>
                           </div>
                           <div class="col-lg-12">
                               <div class="btn-container">
                                   <button  class="lab-btn-common" >Submit</button>
                               </div>
                           </div>
                       </div>
                       </section>
                   </div>
                    </form>
               </div>




               

   


               <div class="footer">
                   <span>Copyright © 2022, Meddbot</span>
               </div>
           </div>
        </main>
        
        
        
        



        
        
        
       <!-- 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() {
  $('#Specimen-Type').change(function() {
    if ($(this).is(':checked')) {
      $('#Specimen-Type-Container').show();
    } else {
      $('#Specimen-Type-Container').hide();
    }
  });
    $('#Specimen-Source').change(function() {
    if ($(this).is(':checked')) {
      $('#Specimen-Source-Container').show();
    } else {
      $('#Specimen-Source-Container').hide();
    }
  });     
    $('#Laboratory-tests').change(function() {
    if ($(this).is(':checked')) {
      $('#Laboratory-tests-Container').show();
    } else {
      $('#Laboratory-tests-Container').hide();
    }
  }); 
        
    $(document).ready(function() {
  $('#showBarcodeButton').click(function() {
    $('#barcode-container').show();
  });
});    
        
        
});
    
   $(document).on('click', '.add-test', function() {
    // Find the parent of the clicked button
    var parent = $(this).parent();
    
    // Find the sibling with class 'testaddcontainer' and show it
    parent.siblings('.testaddcontainer').toggle();
}); 
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
       $(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');
    });



   
        // jQuery function to add selected option as checkbox
        $(document).ready(function() {
            $('#addButton').click(function() {
                // Get the selected option text and value
                var selectedText = $('#dynamicSelect option:selected').text();
                var selectedValue = $('#dynamicSelect').val();

                // Check if the checkbox already exists
                if (!$('#checkboxList input[value="' + selectedValue + '"]').length) {
                    // Append checkbox for the selected option
                    $('#checkboxList').append(
                        '<div class="chk-itm"><label class="container-lab-check">' + selectedText  +
                        '<input type="checkbox" name="test_options[]" value="' + selectedValue + '">'+
                        '<span class="checkmark-lab"></span></label></div>'
                    );
                } else {
                    alert(selectedText + " is already added.");
                }
            });
        });
   

</script>                                 <?php /**PATH /home/meddbot/public_html/resources/views/district_hospital_new/lab_add_patient.blade.php ENDPATH**/ ?>