 <?php 
 include ('includes/connection.php'); 
 // code for block exam 

 if(isset($_GET['del']))
{
$id= $_GET['del']; 
$sql =mysqli_query($conn,"DELETE FROM `quiz_subject_question_soes` WHERE quiz_subject_question_id = '$id'");
header('location:admin.php?page=quiz');
}

if(isset($_GET['Id_3']))
{
$id=$_GET['Id_3'];
$status='Disable'; 
$sql =mysqli_query($conn,"update subject_soes set subject_status='$status' WHERE subject_id='$id'");
header('location:admin.php?page=course');
}

//code for active students
if(isset($_GET['Id_2']))
{
$id=$_GET['Id_2'];
$status='Enable'; 
$sql =mysqli_query($conn,"update subject_soes set subject_status='$status' WHERE subject_id='$id'");
header('location:admin.php?page=course');
}  

if (isset($_POST['save'])){    

     $quiz_id = $_POST["subject_id"];
     $type_exam = $_POST["type_exam"];
    $quiz_subject_id        =  $_POST["module_id"];
    $quiz_subject_question_title  =  $_POST["quiz_subject_question_title"];
    $quiz_subject_question_answer =  $_POST["quiz_subject_question_answer"];
    $marks =  $_POST["marks"];

    $query_quiz ="INSERT INTO `quiz_subject_question_soes` 
    (`quiz_id`,`type_exam`, `quiz_subject_id`, `quiz_subject_question_title`, `quiz_subject_question_answer`,`marks`) 
    VALUES ('$quiz_id','$type_exam','$quiz_subject_id', '$quiz_subject_question_title', '$quiz_subject_question_answer', '$marks')";
     $query=mysqli_query($conn,$query_quiz); 
    if($query){ 
         ?>
         <script type="text/javascript">
             alert("Quiz Successed Added");
         </script>
        <?php  
      }  
      else{
        ?>  
        <script type="text/javascript">
         alert("Sorry Quiz not Added Try Again");
        </script>
        <?php
    }
  }
 if (isset($_POST['add'])){    
    $quiz_id = $_POST["subject_id"];
    $type_exam = $_POST["type_exam"];
    $quiz_subject_id=  $_POST["module_id"];
    $quiz_subject_question_title  =  $_POST["quiz_subject_question_title"];
    $quiz_subject_question_answer =  $_POST["quiz_subject_question_answer"];
    $option_1 =  $_POST["option_1"];
    $option_2 =  $_POST["option_2"];
    $option_3 =  $_POST["option_3"];
    $option_4 =  $_POST["option_4"];
    $marks =  $_POST["marks"];
    $subject_exam_end_time =  $_POST["subject_exam_end_time"];
    

    $query_quiz ="INSERT INTO `quiz_subject_question_soes` 
    (`quiz_id`,`type_exam`, `quiz_subject_id`,`quiz_subject_question_title`,`quiz_subject_question_answer`,`option_1`,`option_2`,`option_3`,`option_4`,`marks`) 
    VALUES ('$quiz_id','$type_exam','$quiz_subject_id','$quiz_subject_question_title', '$quiz_subject_question_answer', '$option_1', '$option_2', '$option_3', '$option_4', '$marks')";
     $query=mysqli_query($conn,$query_quiz); 
    if($query){ 
         ?>
         <script type="text/javascript">
             alert("Quiz Successed Added");
         </script>
        <?php  
      }  
      else{
        ?>  
        <script type="text/javascript">
         alert("Sorry Quiz not Added Try Again");
        </script>
        <?php
    }
  }

  
?>
 
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
 
  <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700&display=fallback">
  <!-- Font Awesome -->
   <link rel="stylesheet" href="../stp_con/fontawesome-free/css/all.min.css">
  <!-- daterange picker -->
  <link rel="stylesheet" href="../stp_con/daterangepicker/daterangepicker.css">
  <!-- iCheck for checkboxes and radio inputs -->
  <link rel="stylesheet" href="../stp_con/icheck-bootstrap/icheck-bootstrap.min.css">
  <!-- Bootstrap Color Picker -->
  <link rel="stylesheet" href="../stp_con/bootstrap-colorpicker/css/bootstrap-colorpicker.min.css">
  <!-- Tempusdominus Bootstrap 4 -->
  <link rel="stylesheet" href="../stp_con/tempusdominus-bootstrap-4/css/tempusdominus-bootstrap-4.min.css">
  <!-- Select2 -->
  <link rel="stylesheet" href="../stp_con/select2/css/select2.min.css">
  <link rel="stylesheet" href="stp_con/select2-bootstrap4-theme/select2-bootstrap4.min.css">
  <!-- Bootstrap4 Duallistbox -->
  <link rel="stylesheet" href="../stp_con/bootstrap4-duallistbox/bootstrap-duallistbox.min.css">
  <!-- BS Stepper -->
  <link rel="stylesheet" href="../stp_con/bs-stepper/css/bs-stepper.min.css">
  <!-- dropzonejs -->
  <link rel="stylesheet" href="../stp_con/dropzone/min/dropzone.min.css">
  <!-- Theme style -->
  <link rel="stylesheet" href="../assets/css/adminlte.min.css">
   <link rel="stylesheet" type="text/css" href="../stp_con/parsley/parsley.css"/>
</head>
<body class="hold-transition sidebar-mini layout-fixed top-nav">
<!-- Site wrapper -->
<div class="wrapper"> 
  <!-- Content Wrapper. Contains page content --> 
    
<div class="content-wrapper">
    <!-- Content Header (Page header) --> 
    <section class="content-header">
      <div class="container-fluid">
        <div class="row mb-2">
          <div class="col-sm-6">
            <a><strong>QUIZ</strong></a>
          </div>
          <div class="col-sm-6">
            <ol class="breadcrumb float-sm-right">
              <li class="breadcrumb-item"><a href="#">Home</a></li> 
              <li class="breadcrumb-item active">Quiz Management</li>
            </ol>
          </div>
        </div>
      </div><!-- /.container-fluid -->
    </section>
<br>
   <!-- Main content -->
   <section class="content">
      <div class="container-fluid">
        <div class="row"> 
          <!-- /.col -->
          <div class="col-md-12">
            <div class="card">
              <div class="card-header p-2">
                <ul class="nav nav-pills ">
                  <li class="nav-item"><a class="nav-link active" href="#quiz" data-toggle="tab"><i class="fas fa-th-list"></i> Quiz List</a></li> 
                  <li class="nav-item"><a class="nav-link" href="#module" data-toggle="tab"><i class="fas fa-list mr-1"></i> Result</a></li>  
                </ul>
              </div> 
              <div class="card-body"> 
              <div class="tab-content"> 
              <div class="active tab-pane" id="quiz">
              <div class="container-fluid">
                <div class="row">
                  <div class="col-sm-12">  
                    <div class="card">  
                      <div class="card-header">
                      <h3 class="card-title">Quiz List</h3>
                      <div class="float-right mb-2"> 
                        <a data-toggle="modal" href="#update1" class="btn btn-secondary btn-xs float-right ml-2" >
                            <i class="fa fa-edit"></i>  Add Obj Question
                        </a>
                         <a data-toggle="modal" href="#update" class="btn btn-info btn-xs float-right ml-2" >
                            <i class="fa fa-edit"></i>  Add Sub Question
                        </a>
                        </div>
                    </div>
                  <div class="card-body">
                <div class="table-responsive">
                    <table id="example1" class="table table-striped display table-bordered" >
                      <thead>
                        <tr>
                          <th>#</th>
                            <th>Course Name</th>
                            <th>Module</th>
                            <th>Question</th>
                            <th>Option 1</th>
                            <th>Option 2</th>
                            <th>Option 3</th>
                            <th>Option 4</th>
                            <th>Answer</th>
                            <th>Action</th>
                        </tr>
                        </thead>
                        <tbody>
                               <?php 
                                  $i = 1;
                                   $school_query = mysqli_query($conn,"SELECT * FROM quiz_subject_question_soes 
                                   INNER JOIN module_soes 
                                   ON module_soes.module_id = quiz_subject_question_soes.quiz_subject_id 
                                   INNER JOIN subject_soes 
                                    ON subject_soes.subject_id = quiz_subject_question_soes.quiz_id ");
                                while($row = mysqli_fetch_array($school_query)){  
                             ?>
                            <tr>
                              <td class="text-center"><?php echo $i++ ?></td> 
                              <td><?php echo $row['subject_name']; ?></td> 
                              <td><?php echo $row['code']; ?></td> 
                              <td><?php echo $row['quiz_subject_question_title']; ?></td> 
                              <td><?php echo $row['option_1']; ?></td> 
                              <td><?php echo $row['option_2']; ?></td> 
                              <td><?php echo $row['option_3']; ?></td> 
                              <td><?php echo $row['option_4']; ?></td> 
                              <td><?php echo $row['quiz_subject_question_answer']; ?></td> 
                          <td>
                             <div class="btn-group">
                            <a  data-id='<?php echo $row['quiz_subject_question_id'] ?>' href="admin.php?page=update_quiz&id=<?php echo $row['quiz_subject_question_id']; ?>" class="btn btn-primary btn-flat manage_class">
                              <i class="fas fa-edit"></i>
                            </a>
                             <a href="admin.php?page=quiz&del=<?php echo $row['quiz_subject_question_id']; ?>" onclick="return confirm('Are you sure you want to delete?');" class="btn btn-danger btn-flat delete_student">
                              <i class="fas fa-trash"></i>
                            </a>   
                        </div> </td>
                          </tr> 
                            <?php }?>
                            </tbody>
                        <tfoot>
                        <tr>
                           <th>#</th>
                            <th>Course Name</th>
                            <th>Module</th>
                            <th>Question</th>
                            <th>Option 1</th>
                            <th>Option 2</th>
                            <th>Option 3</th>
                            <th>Option 4</th>
                            <th>Answer</th>
                            <th>Action</th>
                        </tr>
                      </tfoot>
                    </table> 
                 </div>
               </div>
              </div> <!-- end card body-->
            </div> <!-- end card --> 
            </div>
            <!-- /.card -->
          </div>
          </div> 

        <div class="modal fade" id="update1">
        <div class="modal-dialog modal-lg">
          <div class="modal-content">
            <div class="modal-header">
              <h4 class="modal-title">Objective Question</h4>
              <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                <span aria-hidden="true">&times;</span>
              </button>
            </div>
           
              <form method="POST" action="" id="login_form" enctype="multipart/form-data"> 
                 <div class="modal-body">
                     <div class="form-group">
                            <label>Course<span style="color: red;">*</span></label>
                                <div class="select2-purple">  
                                  <select name="subject_id" id="subject_id" class="form-control select2" data-dropdown-css-class="Select a year" style="width: 100%;" required>  
                                    <option value="">Select Course</option>
                                    
                                    <?php 
                                      $result = mysqli_query($conn, "SELECT * FROM subject_soes ORDER BY subject_name ASC");
                                        while ($row = mysqli_fetch_assoc($result)) {
                                            echo "<option value='{$row['subject_id']}'>{$row['course_code']} | {$row['subject_name']}</option>";
                                        } 
                                  ?>  
                              </select>
                            </div>
                      </div>  
                        <div class="form-group">
                         <label>Module<span style="color: red;">*</span></label>
                         <div class="select2-purple"> 
                              <select class="form-control select2" id="module" name="module_id" data-dropdown-css-class="Select a Module" style="width: 100%;" required>
                              <option  value="">Select a Module</option> 
                            </select>
                            </div> 
                        </div> 
                     <div class="mb-3 row">
                        <label class="col-sm-3 col-form-label">Question Title</label>
                        <div class="col-sm-9">
                            <input type="text" name="quiz_subject_question_title" id="exam_subject_question_title" class="form-control datepicker" required data-parsley-trigger="keyup" />
                        </div>
                    </div>
                    <div class="mb-3 row">
                        <label class="col-sm-3 col-form-label">Option 1</label>
                        <div class="col-sm-9">
                            <input type="text" name="option_1" id="option_1" class="form-control" required />
                        </div>
                    </div>
                    <div class="mb-3 row">
                        <label class="col-sm-3 col-form-label">Option 2</label>
                        <div class="col-sm-9">
                            <input type="text" name="option_2" id="option_2" class="form-control" required />
                        </div>
                    </div>
                    <div class="mb-3 row">
                        <label class="col-sm-3 col-form-label">Option 3</label>
                        <div class="col-sm-9">
                            <input type="text" name="option_3" id="option_3" class="form-control" required />
                        </div>
                    </div>
                    <div class="mb-3 row">
                        <label class="col-sm-3 col-form-label">Option 4</label>
                        <div class="col-sm-9">
                            <input type="text" name="option_4" id="option_4" class="form-control" required />
                        </div>
                    </div>
                    <div class="mb-3 row">  
                        <label class="col-sm-3 col-form-label">Answer</label> 
                        <div class="col-sm-9">
                            <div class="select2-purple">
                            <select name="quiz_subject_question_answer" id="quiz_subject_question_answer" class="form-control select2" data-dropdown-css-class="Select a year" style="width: 100%;" required>
                                <option value="">Select</option>
                                <option value="1">1 Option</option>
                                <option value="2">2 Option</option>
                                <option value="3">3 Option</option>
                                <option value="4">4 Option</option>
                            </select>
                            </div>
                        </div>  
                    </div>
                     <div class="row"> 
                    <div class="col-sm-12">
                      <div class="form-group">
                       <label>Quiz marks<span style="color: red;">*</span></label> 
                           <input type="number" class="form-control" required name="marks">
                           <input type="hidden" name="type_exam" value="Objective">
                      </div>
                    </div>
                      <!--<div class="col-sm-8">-->
                      <!--   <div class="form-group">-->
                      <!--    <label>Exam Date & Time <span style="color: red;">*</span></label> -->
                      <!--    <input type="datetime-local" class="form-control" required name="subject_exam_end_time">-->
                      <!--  </div>-->
                      <!--</div> -->
                    </div>  
                </div>
              <div class="modal-footer justify-content-between">
              <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
              <button type="submit"  name="add" class="btn btn-primary">Save</button>
            </div>
            </form>
          </div>
          <!-- /.modal-content -->
        </div>
        <!-- /.modal-dialog -->
      </div>
            <div class="tab-pane" id="module">
              <div class="container-fluid">
                <div class="row">
                  <div class="col-sm-12">  
                    <div class="card">  
                      <div class="card-header">
                      <h3 class="card-title">Module List</h3>
                     <!--  <div class="float-right mb-2"> 
                         <a data-toggle="modal" href="#modal" class="btn btn-secondary btn-xs float-right ml-2" >
                            <i class="fa fa-edit"></i>  Add Module Here
                        </a>
                        </div> -->
                    </div>
                  <div class="card-body">
                  <div class="table-responsive">
                    <table id="example2" class="table table-striped display table-bordered" >
                      <thead>
                        <tr>
                          <th>#</th> 
                          <th>Name</th> 
                          <th>Course</th> 
                          <th>Module</th> 
                          <th>Remark</th>   
                          <th>Action</th>
                        </tr>
                        </thead>
                        <tbody>
                               <?php 
                                $i = 1;
                                   $school_query = mysqli_query($conn,"SELECT * FROM quiz_subject_question_answer
                                    INNER JOIN subject_soes
                                    ON subject_soes.subject_id = quiz_subject_question_answer.subject_id  
                                    INNER JOIN student_soes 
                                    ON student_soes.student_id = quiz_subject_question_answer.student_id ");
                                    
                                    //  $school_query = mysqli_query($conn,"SELECT SUM(marks) as marks FROM quiz_subject_question_answer GROUP BY student_id;");
                                while($row = mysqli_fetch_array($school_query)){  
                                    
                             ?>
                            <tr>
                              <td class="text-center"><?php echo $i++ ?></td> 
                              <td><?php echo $row['student_name']; ?></td> 
                              <td><?php echo $row['subject_name']; ?></td> 
                              <td><?php echo $row['course_code']; ?></td>
                              <?php if ($row['marks'] >= 0 ) {?>
                                <td>PASS</td>
                               <?php  }else{ ?> 
                               <td>FAIL | <span class="right badge badge-danger"> <?php echo $row['marks']; ?></span> </td>
                               <?php } ?>                                
                              <td>
                            <div class="btn-group">
                            <a  data-id='<?php echo $row['id'] ?>'  href="admin.php?page=quiz&id=<?php echo $row['module_id']; ?>" class="btn btn-info btn-flat manage_class">
                              <i class="fas fa-eye"></i>
                            </a> 
                          </div> </td>
                          </tr> 
                            <?php }?>
                            </tbody>
                        <tfoot>
                        <tr>
                           <th>#</th> 
                          <th>Name</th> 
                          <th>Course</th> 
                          <th>Module</th>
                          <th>Remark</th>  
                          <th>Action</th>
                        </tr>
                      </tfoot>
                    </table> 
                 </div>
               </div>
              </div> <!-- end card body-->
            </div> <!-- end card --> 
            </div>
            <!-- /.card -->
          </div>
          </div>

        <div class="modal fade" id="update">
        <div class="modal-dialog modal-lg">
          <div class="modal-content">
            <div class="modal-header">
              <h4 class="modal-title">Subjective Question</h4>
              <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                <span aria-hidden="true">&times;</span>
              </button>
            </div>
           
              <form method="post" action="" enctype="multipart/form-data"> 
                 <div class="modal-body">
                <div class="modal-body">
                  <span id="form_message"></span> 
                      <div class="form-group">
                         <label>Course<span style="color: red;">*</span></label>
                           <div class="select2-purple"> 
                              <?php  
                              $query = "SELECT * FROM subject_soes WHERE status = 1 ORDER BY subject_name ASC"; 
                              $result = $conn->query($query);      
                               ?> 
                             <select name="subject_id" id="course_code" class="form-control select2" required>
                              <option value="">Select Course</option>
                                <?php 
                              if($result->num_rows > 0){ 
                                  while($row = $result->fetch_assoc()){  
                                      echo '<option value="'.$row['subject_id'].'">'.$row['course_code'].' | '.$row['subject_name'].'</option>'; 
                                  } 
                              }else{ 
                                  echo '<option value="">Course not available</option>'; 
                              } 
                              ?>
                            </select>
                          </div> 
                        </div>
                        <div class="form-group">
                         <label>Module<span style="color: red;">*</span></label>
                           <div class="select2-purple"> 
                              <?php  
                              $query = "SELECT * FROM module_soes ORDER BY code ASC"; 
                              $result = $conn->query($query);      
                               ?> 
                             <select name="module_id" id="module_id" class="form-control select2" required>
                              <option value="">Select Module</option>
                                <?php 
                              if($result->num_rows > 0){ 
                                  while($row = $result->fetch_assoc()){  
                                      echo '<option value="'.$row['module_id'].'">'.$row['course_code'].' |'.$row['code'].'</option>'; 
                                  } 
                              }else{ 
                                  echo '<option value="">Module not available</option>'; 
                              } 
                              ?>
                            </select>
                          </div> 
                        </div>
                        
                      <div class="form-group">
                       <label>Quiz Question Subjective<span style="color: red;">*</span></label> 
                            <textarea id="summernote" name="quiz_subject_question_title" class="form-control select2" required>
                              Place <em>some</em> <u>text</u> <strong>here</strong>
                            </textarea> 
                      </div> 
                      <div class="form-group">
                       <label>Answer <span style="color: red;">*</span></label> 
                           <input type="type" class="form-control" required name="quiz_subject_question_answer">
                      </div> 
                      <div class="form-group">
                       <label>Quiz marks<span style="color: red;">*</span></label> 
                           <input type="number" class="form-control" required name="marks">
                           <input type="hidden" name="type_exam" value="Subjective">
                      </div>
                    </div>  
                </div>
              <div class="modal-footer justify-content-between">
              <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
              <button type="submit"  name="save" class="btn btn-primary">Save</button>
            </div>
            </form>
          </div>
          <!-- /.modal-content -->
        </div>
        <!-- /.modal-dialog -->
      </div>
             

        <div class="modal fade" id="view">
        <div class="modal-dialog modal-lg">
          <div class="modal-content">
            <div class="modal-header">
              <h4 class="modal-title">Subjective Question</h4>
              <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                <span aria-hidden="true">&times;</span>
              </button>
            </div>
           
              <form method="post" action="" enctype="multipart/form-data"> 
                 <div class="modal-body">
                <div class="modal-body">
                  <span id="form_message"></span> 
                      <div class="form-group">
                         <label>Course<span style="color: red;">*</span></label>
                           <div class="select2-purple"> 
                              <?php  
                              $query = "SELECT * FROM subject_soes ORDER BY subject_name ASC"; 
                              $result = $conn->query($query);      
                               ?> 
                             <select name="subject_id" id="course_code" class="form-control select2" required>
                              <option value="">Select Course</option>
                                <?php 
                              if($result->num_rows > 0){ 
                                  while($row = $result->fetch_assoc()){  
                                      echo '<option value="'.$row['subject_id'].'">'.$row['course_code'].' | '.$row['subject_name'].'</option>'; 
                                  } 
                              }else{ 
                                  echo '<option value="">Course not available</option>'; 
                              } 
                              ?>
                            </select>
                          </div> 
                        </div>
                        <div class="form-group">
                         <label>Module<span style="color: red;">*</span></label>
                           <div class="select2-purple"> 
                              <?php  
                              $query = "SELECT * FROM module_soes ORDER BY code ASC"; 
                              $result = $conn->query($query);      
                               ?> 
                             <select name="module_id" id="module_id" class="form-control select2" required>
                              <option value="">Select Module</option>
                                <?php 
                              if($result->num_rows > 0){ 
                                  while($row = $result->fetch_assoc()){  
                                      echo '<option value="'.$row['module_id'].'">'.$row['course_code'].' |'.$row['code'].'</option>'; 
                                  } 
                              }else{ 
                                  echo '<option value="">Module not available</option>'; 
                              } 
                              ?>
                            </select>
                          </div> 
                        </div>
                        
                      <div class="form-group">
                       <label>Quiz Question Subjective<span style="color: red;">*</span></label> 
                            <textarea id="summernote" name="quiz_subject_question_title" class="form-control select2" required>
                              Place <em>some</em> <u>text</u> <strong>here</strong>
                            </textarea> 
                      </div> 
                      <div class="form-group">
                       <label>Answer <span style="color: red;">*</span></label> 
                           <input type="type" class="form-control" required name="quiz_subject_question_answer">
                      </div> 
                      <div class="form-group">
                       <label>Quiz marks<span style="color: red;">*</span></label> 
                           <input type="number" class="form-control" required name="marks">
                      </div>
                    </div>  
                </div>
              <div class="modal-footer justify-content-between">
              <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
              <button type="submit"  name="save" class="btn btn-primary">Save</button>
            </div>
            </form>
          </div>
          <!-- /.modal-content -->
        </div>
        <!-- /.modal-dialog -->
      </div>


             </div>
                <!-- /.tab-content -->
             </div><!-- /.card-body -->
            </div>
            <!-- /.card -->
          </div>
          <!-- /.col -->
        </div>
        <!-- /.row -->
      </div><!-- /.container-fluid -->
    </section> 
  </div>
  <script src="../stp_con/jquery/jquery.min.js"></script>
<!-- Bootstrap 4 -->
<script src="../stp_con/bootstrap/js/bootstrap.bundle.min.js"></script>
<script src="../stp_con/select2/js/select2.full.min.js"></script>
<!-- DataTables  & Plugins -->
<script src="../stp_con/datatables/jquery.dataTables.min.js"></script>
<script src="../stp_con/datatables-bs4/js/dataTables.bootstrap4.min.js"></script>
<script src="../stp_con/datatables-responsive/js/dataTables.responsive.min.js"></script>
<script src="../stp_con/datatables-responsive/js/responsive.bootstrap4.min.js"></script>
<script src="../stp_con/datatables-buttons/js/dataTables.buttons.min.js"></script>
<script src="../stp_con/datatables-buttons/js/buttons.bootstrap4.min.js"></script>
<script src="../stp_con/tempusdominus-bootstrap-4/js/tempusdominus-bootstrap-4.min.js"></script>
<script src="../stp_con/jszip/jszip.min.js"></script>
<script src="../stp_con/pdfmake/pdfmake.min.js"></script>
<script src="../stp_con/pdfmake/vfs_fonts.js"></script>  
<script src="../stp_con/datatables-buttons/js/buttons.html5.min.js"></script>
<script src="../stp_con/datatables-buttons/js/buttons.print.min.js"></script>
<script src="../stp_con/datatables-buttons/js/buttons.colVis.min.js"></script>
<script src="../stp_con/summernote/summernote-bs4.min.js"></script>  
<script src="../assets/js/adminlte.min.js"></script>

<!--<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>-->

 <script>
  $(function () {
    $("#example1").DataTable({
      "responsive": true, "lengthChange": false, "autoWidth": false,
      "buttons": ["copy", "csv", "excel", "pdf", "print", "colvis"]
    }).buttons().container().appendTo('#example1_wrapper .col-md-6:eq(0)'); 
  });
   $(function () {
    $("#example2").DataTable({
      "responsive": true, "lengthChange": false, "autoWidth": false,
      "buttons": ["copy", "csv", "excel", "pdf", "print", "colvis"]
    }).buttons().container().appendTo('#example2_wrapper .col-md-6:eq(0)'); 
  });
</script>  
<script>
  $(function () {
    // Summernote
    $('#summernote').summernote()

    // CodeMirror
    CodeMirror.fromTextArea(document.getElementById("codeMirrorDemo"), {
      mode: "htmlmixed",
      theme: "monokai"
    });
  })
</script>
<script>
  $(function () {
    //Initialize Select2 Elements
    $('.select2').select2()

    //Initialize Select2 Elements
    $('.select2bs4').select2({
      theme: 'bootstrap4'
    })

    //Datemask dd/mm/yyyy
    $('#datemask').inputmask('dd/mm/yyyy', { 'placeholder': 'dd/mm/yyyy' })
    //Datemask2 mm/dd/yyyy
    $('#datemask2').inputmask('mm/dd/yyyy', { 'placeholder': 'mm/dd/yyyy' })
    //Money Euro
    $('[data-mask]').inputmask()

    //Date picker
    $('#reservationdate').datetimepicker({
        format: 'L'
    }); 
    //Date range picker
    $('#reservation').daterangepicker()
    //Date range picker with time picker
    $('#reservationtime').daterangepicker({
      timePicker: true,
      timePickerIncrement: 30,
      locale: {
        format: 'MM/DD/YYYY hh:mm A'
      }
    })
    //Date range as a button
    $('#daterange-btn').daterangepicker(
      {
        ranges   : {
          'Today'       : [moment(), moment()],
          'Yesterday'   : [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
          'Last 7 Days' : [moment().subtract(6, 'days'), moment()],
          'Last 30 Days': [moment().subtract(29, 'days'), moment()],
          'This Month'  : [moment().startOf('month'), moment().endOf('month')],
          'Last Month'  : [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
        },
        startDate: moment().subtract(29, 'days'),
        endDate  : moment()
      },
      function (start, end) {
        $('#reportrange span').html(start.format('MMMM D, YYYY') + ' - ' + end.format('MMMM D, YYYY'))
      }
    )

    //Timepicker
    $('#timepicker').datetimepicker({
      format: 'LT'
    })

    //Bootstrap Duallistbox
    $('.duallistbox').bootstrapDualListbox()

    //Colorpicker
    $('.my-colorpicker1').colorpicker()
    //color picker with addon
    $('.my-colorpicker2').colorpicker()

    $('.my-colorpicker2').on('colorpickerChange', function(event) {
      $('.my-colorpicker2 .fa-square').css('color', event.color.toString());
    })
  })
  // BS-Stepper Init
  document.addEventListener('DOMContentLoaded', function () {
    window.stepper = new Stepper(document.querySelector('.bs-stepper'))
  })

  // DropzoneJS Demo Code Start
  Dropzone.autoDiscover = false

  // Get the template HTML and remove it from the doumenthe template HTML and remove it from the doument
  var previewNode = document.querySelector("#template")
  previewNode.id = ""
  var previewTemplate = previewNode.parentNode.innerHTML
  previewNode.parentNode.removeChild(previewNode)

  var myDropzone = new Dropzone(document.body, { // Make the whole body a dropzone
    url: "/target-url", // Set the url
    thumbnailWidth: 80,
    thumbnailHeight: 80,
    parallelUploads: 20,
    previewTemplate: previewTemplate,
    autoQueue: false, // Make sure the files aren't queued until manually added
    previewsContainer: "#previews", // Define the container to display the previews
    clickable: ".fileinput-button" // Define the element that should be used as click trigger to select files.
  })

  myDropzone.on("addedfile", function(file) {
    // Hookup the start button
    file.previewElement.querySelector(".start").onclick = function() { myDropzone.enqueueFile(file) }
  })

  // Update the total progress bar
  myDropzone.on("totaluploadprogress", function(progress) {
    document.querySelector("#total-progress .progress-bar").style.width = progress + "%"
  })

  myDropzone.on("sending", function(file) {
    // Show the total progress bar when upload starts
    document.querySelector("#total-progress").style.opacity = "1"
    // And disable the start button
    file.previewElement.querySelector(".start").setAttribute("disabled", "disabled")
  })

  // Hide the total progress bar when nothing's uploading anymore
  myDropzone.on("queuecomplete", function(progress) {
    document.querySelector("#total-progress").style.opacity = "0"
  })

  // Setup the buttons for all transfers
  // The "add files" button doesn't need to be setup because the config
  // `clickable` has already been specified.
  document.querySelector("#actions .start").onclick = function() {
    myDropzone.enqueueFiles(myDropzone.getFilesWithStatus(Dropzone.ADDED))
  }
  document.querySelector("#actions .cancel").onclick = function() {
    myDropzone.removeAllFiles(true)
  }
  // DropzoneJS Demo Code End
</script>
 <script>

$(document).ready(function(){

    $('#login_form').parsley();
 
});

</script>
<script>
  $(function () {
    //Initialize Select2 Elements
    $('.select2').select2()

    //Initialize Select2 Elements
    $('.select2bs4').select2({
      theme: 'bootstrap4'
    })

    //Datemask dd/mm/yyyy
    $('#datemask').inputmask('dd/mm/yyyy', { 'placeholder': 'dd/mm/yyyy' })
    //Datemask2 mm/dd/yyyy
    $('#datemask2').inputmask('mm/dd/yyyy', { 'placeholder': 'mm/dd/yyyy' })
    //Money Euro
    $('[data-mask]').inputmask()

    //Date picker
    $('#reservationdate').datetimepicker({
        format: 'L'
    }); 
    //Date range picker
    $('#reservation').daterangepicker()
    //Date range picker with time picker
    $('#reservationtime').daterangepicker({
      timePicker: true,
      timePickerIncrement: 30,
      locale: {
        format: 'MM/DD/YYYY hh:mm A'
      }
    })
    //Date range as a button
    $('#daterange-btn').daterangepicker(
      {
        ranges   : {
          'Today'       : [moment(), moment()],
          'Yesterday'   : [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
          'Last 7 Days' : [moment().subtract(6, 'days'), moment()],
          'Last 30 Days': [moment().subtract(29, 'days'), moment()],
          'This Month'  : [moment().startOf('month'), moment().endOf('month')],
          'Last Month'  : [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
        },
        startDate: moment().subtract(29, 'days'),
        endDate  : moment()
      },
      function (start, end) {
        $('#reportrange span').html(start.format('MMMM D, YYYY') + ' - ' + end.format('MMMM D, YYYY'))
      }
    )

    //Timepicker
    $('#timepicker').datetimepicker({
      format: 'LT'
    })

    //Bootstrap Duallistbox
    $('.duallistbox').bootstrapDualListbox()

    //Colorpicker
    $('.my-colorpicker1').colorpicker()
    //color picker with addon
    $('.my-colorpicker2').colorpicker()

    $('.my-colorpicker2').on('colorpickerChange', function(event) {
      $('.my-colorpicker2 .fa-square').css('color', event.color.toString());
    })
  })
  // BS-Stepper Init
  document.addEventListener('DOMContentLoaded', function () {
    window.stepper = new Stepper(document.querySelector('.bs-stepper'))
  })

  // DropzoneJS Demo Code Start
  Dropzone.autoDiscover = false

  // Get the template HTML and remove it from the doumenthe template HTML and remove it from the doument
  var previewNode = document.querySelector("#template")
  previewNode.id = ""
  var previewTemplate = previewNode.parentNode.innerHTML
  previewNode.parentNode.removeChild(previewNode)

  var myDropzone = new Dropzone(document.body, { // Make the whole body a dropzone
    url: "/target-url", // Set the url
    thumbnailWidth: 80,
    thumbnailHeight: 80,
    parallelUploads: 20,
    previewTemplate: previewTemplate,
    autoQueue: false, // Make sure the files aren't queued until manually added
    previewsContainer: "#previews", // Define the container to display the previews
    clickable: ".fileinput-button" // Define the element that should be used as click trigger to select files.
  })

  myDropzone.on("addedfile", function(file) {
    // Hookup the start button
    file.previewElement.querySelector(".start").onclick = function() { myDropzone.enqueueFile(file) }
  })

  // Update the total progress bar
  myDropzone.on("totaluploadprogress", function(progress) {
    document.querySelector("#total-progress .progress-bar").style.width = progress + "%"
  })

  myDropzone.on("sending", function(file) {
    // Show the total progress bar when upload starts
    document.querySelector("#total-progress").style.opacity = "1"
    // And disable the start button
    file.previewElement.querySelector(".start").setAttribute("disabled", "disabled")
  })


    $('.toastrDefaultSuccess').click(function() {
      toastr.success('Lorem ipsum dolor sit amet, consetetur sadipscing elitr.')
    });
    $('.toastrDefaultInfo').click(function() {
      toastr.info('Lorem ipsum dolor sit amet, consetetur sadipscing elitr.')
    });
    $('.toastrDefaultError').click(function() {
      toastr.error('Lorem ipsum dolor sit amet, consetetur sadipscing elitr.')
    });
    $('.toastrDefaultWarning').click(function() {
      toastr.warning('Lorem ipsum dolor sit amet, consetetur sadipscing elitr.')
    });

  // Hide the total progress bar when nothing's uploading anymore
  myDropzone.on("queuecomplete", function(progress) {
    document.querySelector("#total-progress").style.opacity = "0"
  })

  // Setup the buttons for all transfers
  // The "add files" button doesn't need to be setup because the config
  // `clickable` has already been specified.
  document.querySelector("#actions .start").onclick = function() {
    myDropzone.enqueueFiles(myDropzone.getFilesWithStatus(Dropzone.ADDED))
  }
  document.querySelector("#actions .cancel").onclick = function() {
    myDropzone.removeAllFiles(true)
  }
  // DropzoneJS Demo Code End
  </script>
<script>
$(document).ready(function(){
    $('#login_form').parsley();
     $('#login_form2').parsley();
     $('#login_form3').parsley();
     $('#login_form4').parsley();
     $('#login_form5').parsley();
     $('#login_form6').parsley(); 
});

</script>

<script>
    $(document).ready(function(){
        $("#subject_id").change(function(){
            var subject_id = $(this).val();
            $.ajax({
                url: "orbital_001/fetch_subcourse.php",
                method: "POST",
                data: {subject_id: subject_id},
                success: function(data){
                    $("#module").html(data); 
                }
            });
        });
    });
</script>


<!--<script>-->
<!--$(document).ready(function(){-->
<!--    $('#subject_id').on('change', function(){-->
<!--        var subject_id = $(this).val();-->
<!--        if(subject_id){-->
<!--            $.ajax({-->
<!--                type:'POST',-->
<!--                url:'../includes/ajaxData.php',-->
<!--                data:'subject_id='+subject_id,-->
<!--                success:function(html){-->
<!--                    $('#module').html(html);-->
<!--                    $('#module').html('<option value="">Select Module first</option>'); -->
<!--                }-->
<!--            }); -->
<!--        }else{-->
<!--            $('#module').html('<option value="">Select Course first</option>');-->
<!--            $('#city').html('<option value="">Select Module2 first</option>'); -->
<!--        }-->
<!--    });-->
    
<!--    $('#module').on('change', function(){-->
<!--        var moduleID = $(this).val();-->
<!--        if(moduleID){-->
<!--            $.ajax({-->
<!--                type:'POST',-->
<!--                url:'includes/ajaxData.php',-->
<!--                data:'module_id='+moduleID,-->
<!--                success:function(html){-->
<!--                    $('#city').html(html);-->
<!--                }-->
<!--            }); -->
<!--        }else{-->
<!--            $('#city').html('<option value="">Select Module3 first</option>'); -->
<!--        }-->
<!--    });-->
<!--});-->
<!--</script>-->