<?php
include_once 'header.php';

?>

<div class="page-wrapper">
        <!-- ============================================================== -->
        <!-- Bread crumb and right sidebar toggle -->
        <!-- ============================================================== -->
        <div class="page-breadcrumb">
          <div class="row">
            <div class="col-12 d-flex no-block align-items-center">
              <h4 class="page-title">Search for Student </h4>
              <div class="ms-auto text-end">
                <nav aria-label="breadcrumb">
                  <ol class="breadcrumb">
                    <li class="breadcrumb-item"><a href="#">Dashboard</a></li>
                    <li class="breadcrumb-item active" aria-current="page">
                     Search
                    </li>
                   
                  </ol>
                </nav>
              </div>
            </div>
          </div>
        </div>
        <!-- ============================================================== -->
        <!-- End Bread crumb and right sidebar toggle -->
     
        <div class="container-fluid ">
          <div class="row" style="background-color:white;">
            <div class="col-4 mb-3 mt-3">             
              <input type="text" class="form-control" id="s_id" placeholder="Enter Student ID">
            </div>
            <div class="col-2 mb-3 mt-3">             
                 <button  class="btn btn-primary" id="show_id">Show Record </button>
            </div>
            <div class="col-4 mb-3 mt-3">             
              <input type="text" class="form-control" id="batch" placeholder="Enter Batch No">
            </div>
            <div class="col-2 mb-3 mt-3">             
                 <button  class="btn btn-primary" id="show_batch">Show Record </button>
            </div>
          </div>
          <div class="col-12 mt-3" id="load">  
        
            </div>
        </div>
                    <!-- The Modal -->
        <div class="modal" id="myModal">
            <div class="modal-dialog" style="max-width: 72%;">
              <div class="modal-content">

                <!-- Modal Header -->
                  <div class="modal-header">
                    <h4 class="modal-title"></h4>
                    <button type="button" class="btn-close" data-bs-dismiss="modal"></button>
                  </div>

                <!-- Modal body -->           
                <div class="modal-body">
                                             
                </div>            
              
                <!-- Modal footer -->
                  <div class="modal-footer">
                       <!-- Modal footer  <button type="button" class="btn btn-danger" id="print_data">Print Data</button> -->
                  </div>

              </div>
            </div>
          </div>

          <!-- ============================================================== -->
          <!-- End PAge Content -->
          <!-- ============================================================== -->
          <!-- ============================================================== -->
          <footer class="footer text-center">
          All Rights Reserved by ECI. Designed and Developed by
          <a href="https://www.ntlogix.in">NTLogix</a>.
        </footer>
       
   <!-- All Jquery -->
    <!-- ============================================================== -->
    <script src="../assets/libs/jquery/dist/jquery.min.js"></script>
    <!-- Bootstrap tether Core JavaScript -->
    <script src="../assets/libs/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
    <!-- slimscrollbar scrollbar JavaScript -->
    <script src="../assets/libs/perfect-scrollbar/dist/perfect-scrollbar.jquery.min.js"></script>
    <script src="../assets/extra-libs/sparkline/sparkline.js"></script>
    <!--Wave Effects -->
    <script src="../dist/js/waves.js"></script>
    <!--Menu sidebar -->
    <script src="../dist/js/sidebarmenu.js"></script>
    <!--Custom JavaScript -->
    <script src="../dist/js/custom.min.js"></script>
    <!-- this page js -->
    <script src="../assets/extra-libs/multicheck/datatable-checkbox-init.js"></script>
    <script src="../assets/extra-libs/multicheck/jquery.multicheck.js"></script>
    <script src="../assets/extra-libs/DataTables/datatables.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
    <script>
        
      var msg;
      var icon;
      function showAlert(msg,icon) {
          Swal.fire({
              title: msg,
              icon: icon,
              confirmButtonText: 'Close'
          });
      }
      $(document).ready(function(){
        
                  $("#zero_config").DataTable();  
                  $('#add').click(function(e){
                            e.preventDefault();
                      
                            $("#myModal").modal('show');
                    });
                    $("#show_id").click(function() {
                      var id = $('#s_id').val();
                      $.ajax({
                          url:"../admin/core/search.php",
                          method:"post",
                          data: {
                              id:id,
                              type:'s_id',                          
                          },
                          success: function(data){ 
                            $("#load").empty();                         
                            $("#load").append(data);                     
                          }
                      });                        
                  });
                  $("#show_batch").click(function() {
                      var id = $('#batch').val();
                      $.ajax({
                          url:"../admin/core/search.php",
                          method:"post",
                          data: {
                              id:id,
                              type:'batch',                          
                          },
                          success: function(data){ 
                            $("#load").empty();                         
                            $("#load").append(data);                     
                          }
                      });                        
                  });
                  $('#course').change(function(){
                      var id = $("#course").val();
                      $.ajax({
                          url:"../admin/core/fetch_course.php",
                          method:"post",
                          data: {
                              id:id,                          
                          },
                          success: function(data){                          
                              $('#duration').val(data[0].duration);
                              $('#desc').val(data[0].description);
                              $('#fee').val(data[0].total_fee);
                              if($('#duration').val()==''){
                              $("#shift_time").prop("disabled",true); 
                            }else{
                              $("#shift_time").prop("disabled",false); 
                            }
                          }
                      });
                  });
                  $('#s_id').keypress(function (e) {    
    
                      var charCode = (e.which) ? e.which : event.keyCode    

                      if (String.fromCharCode(charCode).match(/[^0-9]/g))    

                          return false;                        

                  });    
                  
                
              
 
              
        });
</script>

  </body>
</html>