<!DOCTYPE html>
<html lang="en">
<head>
    <title>SIMPEL</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="bootstrap/css/bootstrap.css">
    <link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
    <script src="bootstrap/js/bootstrap.min.js"></script>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.bundle.min.js"></script>
  <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css" rel="stylesheet">
    
    <link href='select2/dist/css/select2.min.css' rel='stylesheet' type='text/css'>
       <style type="text/css">
        .selectt {
            color: #fff;
            padding: 10px;
            display: none;
            margin-top: 5px;
            width: 100%;
            background: green
        }
          
        label1 {
            margin-right: 20px;
        }
    </style>

</head>
<body><div style="text-align:center;">
<nav class="navbar navbar-expand-md bg-dark navbar-dark"> 
    <!-- Brand -->
    <a class="navbar-brand" href="index.php">
        <img src="gambar/logosi.png" alt="logo" style="width:30px;margin-left:30px;">
    </a>

    <!-- Toggler/collapsibe Button -->
    <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#collapsibleNavbar">
        <span class="navbar-toggler-icon"></span>
    </button>
     
   <!-- Navbar links -->
    <div class="collapse navbar-collapse" id="collapsibleNavbar">
        <ul class="navbar-nav">
            <div class="dropdown">
<button type="button" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown" style="margin:5px;background-color:#212529;color:rgba(255,255,255,.5);border:none;">Records</button> 
            <ul class="dropdown-menu">
              <li><a class="dropdown-item" href="datapinjam.php">Booking Records</a></li>
              <li><a class="dropdown-item" href="index.php">Attendance Records</a></li>
            </ul>
          </div>
            <!--<li class="nav-item">
                <a class="nav-link" href="tambahdata.php">Peminjaman Lab</a>
            </li>-->
            <div class="dropdown">
<button type="button" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown" style="margin:5px;background-color:#212529;color:rgba(255,255,255,.5);border:none;">Booking</button> 
            <ul class="dropdown-menu">                                           
              <li><a class="dropdown-item" href="tambahdata.php">Booking Form</a></li>
              <li><a class="dropdown-item" href="tambahdatalogbook.php">Attendance Form</a></li>
            </ul>
          </div>
            <!--<li class="nav-item" style="margin:5px;background-color:#212529;color:rgba(255,255,255,.5);border:none;">
                <a class="nav-link" href="#">Akun</a>
            </li>-->
            <!--<li class="nav-item" style="margin:5px;background-color:#212529;color:rgba(255,255,255,.5);border:none;">
                <a class="nav-link" href="#">Informasi</a>
            </li>-->
            <div class="dropdown">
<button type="button" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown" style="margin:5px;background-color:#212529;color:rgba(255,255,255,.5);border:none;">Reports</button> 
            <ul class="dropdown-menu">
              <li><a class="dropdown-item" href="laporanpinjam.php">Booking Reports</a></li>
              <li><a class="dropdown-item" href="laporanLog.php">Attendance Reports</a></li>
            </ul>
          </div>
        </ul>
    </div>
       
</nav></div>
<div class="jumbotron text-center">
    <h1>SIMPEL (Sistem InforMasi PEminjaman Laboratorium)</h1>
    <p><b>DEPARTEMENT OF INFORMATION SYSTEMS - FACULTY OF COMPUTER SCIENCES <br/>
    UNIVERSITAS PEMBANGUNAN NASIONAL "VETERAN" JAWA TIMUR</b></p>
</div>
<div class="container">
    <div class="row">
        <center><div class="col-sm-8">
            <div class="thumbnail">
                <div class="caption">
                <div class="comment">
                    <label><h2>Laboratory Booking Form</h2></label>
        <form method="POST" action="action.php" id="form1">
        <div class="form-group">
        <label><strong>Status :</strong></label>
            <label style="padding-left: 10px; padding-right: 10px;"><input type="radio" name="colorRadio" value="dosen">Lecturer</label>
          <label style="padding-left: 10px; padding-right: 10px;"><input type="radio" name="colorRadio" value="mahasiswa">Student</label>
<label style="padding-left: 10px; padding-right: 10px;"><input type="radio" name="colorRadio" value="staff">General/Guest</label>
        </div> 
        <div class="dosen selectt">
        <center><strong>Lecturer</strong></center> 
        <div class="table-responsive">
        <table class="table" border="0">
        <div class="form-group">
        <tr>
                    <td><label style="color:white;">Name</label></td><td style="color:white;">:</td><td>
                    <select id="pegawai" style="width:300px;" name="pegawai">
                    <option value=''>-- Find Name, Ex.: ag --</option>
                    <?php 
                   include 'config.php';
            $query = mysqli_query($conn,"Select nip, namapegawai from pegawai order by namapegawai asc") or die(mysqli_error());
              			while ($data = mysqli_fetch_array($query, MYSQLI_ASSOC)){
                        echo "<option value=".$data['nip'].">".$data['namapegawai']."</option>";
                    }
                    ?>
                    </select></td>
        </tr>
        <tr>
          <td><label style="color:white;">Class</label></td><td style="color:white;">:</td><td>                    
          <select id="paralelmk" style="width:300px;" name="paralelmk">
          <option value=''>-- Find Class, Ex.: A --</option>
          <?php 
          include 'config.php';
          $query = mysqli_query($conn,"Select idparalel, paralel from paralelmk order by paralel asc") or die(mysqli_error());
            while ($data = mysqli_fetch_array($query, MYSQLI_ASSOC)){
              echo "<option value=".$data['idparalel'].">".$data['paralel']."</option>";
            }
          ?>
          </select></td></tr>
          <tr>
          <td><label style="color:white;">Session</label></td><td style="color:white;">:</td><td>
          <select id="sesi" style="width:300px;" name="sesi">
          <option value=''>-- Find Session, Ex.: ag --</option>
          <?php 
          include 'config.php';
          $query = mysqli_query($conn,"Select kodesesi, namasesi from sesi order by kodesesi asc") or die(mysqli_error());
            while ($data = mysqli_fetch_array($query, MYSQLI_ASSOC)){
              echo "<option value=".$data['kodesesi'].">".$data['namasesi']."</option>";
            }
          ?>
          </select></td</tr>
          <tr>
          <td><label for="Tanggal" style="color:white;">Date</label></td><td style="color:white;">:</td><td>
           <input type="date" id="Tanggal" name="Tanggal" placeholder="MM/DD/YYYY"></td></tr>
          <tr>
          <td><label style="color:white;">Course</label></td><td style="color:white;">:</td><td>
          <select id="matakuliah" style="width:300px;" name="matakuliah">
          <option value=''>-- Find Course, Ex.: Audit --</option>
          <?php 
          include 'config.php';
          $query = mysqli_query($conn,"select kodemk, namamk from matakuliah order by namamk") or die(mysqli_error());
            while ($data = mysqli_fetch_array($query, MYSQLI_ASSOC)){
              echo "<option value=".$data['kodemk'].">".$data['namamk']."</option>";
            }
          ?>
          </select></td></tr>
          <tr>
          <td><label style="color:white;">Laboratory</label></td><td style="color:white;">:</td><td>
          <select id="lab" style="width:300px;" name="lab">
          <option value=''>-- Find Lab., Ex.: MSI --</option>
          <?php 
          include 'config.php';
          $query = mysqli_query($conn,"select kodelab, nickname from laboratorium order by kodelab") or die(mysqli_error());
            while ($data = mysqli_fetch_array($query, MYSQLI_ASSOC)){
              echo "<option value=".$data['kodelab'].">".$data['nickname']."</option>";
            }
          ?>
          </select></td></tr>
          <tr>
          <td><label style="color:white;">Purpose</label></td><td style="color:white;">:</td><td>
          <select id="keperluan" style="width:300px;" name="keperluan">
          <option value=''>-- Find Purpose, Ex.: demo --</option>
          <?php 
          include 'config.php';
          $query = mysqli_query($conn,"select idkeperluan, namakeperluan from keperluanpinjam where idkeperluan not in ('1')") or die(mysqli_error());
            while ($data = mysqli_fetch_array($query, MYSQLI_ASSOC)){
              echo "<option value=".$data['idkeperluan'].">".$data['namakeperluan']."</option>";
            }
          ?>
          </select></td></tr>
          <tr>
          <td><label style="color:white;">Required Equipment <br/> (Software, Hardware, Etc.)</label></td><td style="color:white;">:</td><td>
          <textarea id="keterangan" name="keterangan" cols="40" rows="5"></textarea></td></tr>
          </div> <!-- end form-group-->
          </table>
          </div> <!-- end table responsive-->
          <center><input type='submit' value='Save Data'></center> 
          </div> <!-- end dosen selectt-->
  
        <div class="mahasiswa selectt">
          <center><strong>Student</strong></center>
        <div class="table-responsive">
        <table class="table" border="0">
        <div class="form-group">
        <tr>
                    <td><label style="color:white;">Student ID/NPM</label></td><td style="color:white;">:</td><td>
                    <input type="text" id="npm" name="npm" style="width:250px;"></td>
        </tr>
        <tr>
          <td><label style="color:white;">Name</label></td><td style="color:white;">:</td><td>                    
          <input type="text" id="namamhs" name="namamhs" style="width:250px;"></td></tr>
          <tr>
          <td><label style="color:white;">Class</label></td><td style="color:white;">:</td><td>                    
          <select id="paralelmhs" style="width:300px;" name="paralelmhs">
          <option value='0'>-- Find Class, Ex.: A --</option>
          <?php 
          include 'config.php';
          $query = mysqli_query($conn,"Select idparalel, paralel from paralelmk order by paralel asc") or die(mysqli_error());
            while ($data = mysqli_fetch_array($query, MYSQLI_ASSOC)){
              echo "<option value=".$data['idparalel'].">".$data['paralel']."</option>";
            }
          ?>
          </select></td></tr>
          <tr>
          <td><label style="color:white;">Session</label></td><td style="color:white;">:</td><td>
          <select id="sesimhs" style="width:250px;" name="sesimhs">
          <option value='0'>-- Find Session, Ex.: ag --</option>
          <?php 
          include 'config.php';
          $query = mysqli_query($conn,"Select kodesesi, namasesi from sesi order by kodesesi asc") or die(mysqli_error());
            while ($data = mysqli_fetch_array($query, MYSQLI_ASSOC)){
              echo "<option value=".$data['kodesesi'].">".$data['namasesi']."</option>";
            }
          ?>
          </select></td</tr>
          <tr>
          <td><label for="Tanggal" style="color:white;">Date</label></td><td style="color:white;">:</td><td>
           <input type="date" id="tglmhs" name="tglmhs" placeholder="MM/DD/YYYY"></td></tr>
          <tr>
          <td><label style="color:white;">Course</label></td><td style="color:white;">:</td><td>
          <select id="mkmhs" style="width:300px;" name="mkmhs">
          <option value='0'>-- Find Course, Ex.: Audit --</option>
          <?php 
          include 'config.php';
          $query = mysqli_query($conn,"select kodemk, namamk from matakuliah where kodemk not in('SI258282') order by namamk") or die(mysqli_error());
            while ($data = mysqli_fetch_array($query, MYSQLI_ASSOC)){
              echo "<option value=".$data['kodemk'].">".$data['namamk']."</option>";
            }
          ?>
          </select></td></tr>
          <tr>
          <td><label style="color:white;">Laboratory</label></td><td style="color:white;">:</td><td>
          <select id="labmhs" style="width:300px;" name="labmhs">
          <option value='0'>-- Find Lab., Ex.: msi --</option>
          <?php 
          include 'config.php';
          $query = mysqli_query($conn,"select kodelab, nickname from laboratorium order by kodelab") or die(mysqli_error());
            while ($data = mysqli_fetch_array($query, MYSQLI_ASSOC)){
              echo "<option value=".$data['kodelab'].">".$data['nickname']."</option>";
            }
          ?>
          </select></td></tr>
          <tr>
          <td><label style="color:white;">Purpose</label></td><td style="color:white;">:</td><td>
          <select id="keperluanmhs" style="width:300px;" name="keperluanmhs">
          <option value='0'>-- Find Purpose, Ex.: demo --</option>
          <?php 
          include 'config.php';
$query = mysqli_query($conn,"select idkeperluan, namakeperluan from keperluanpinjam where idkeperluan in('3','6','10','11','14','16','17','18'); ") or die(mysqli_error());
            while ($data = mysqli_fetch_array($query, MYSQLI_ASSOC)){
              echo "<option value=".$data['idkeperluan'].">".$data['namakeperluan']."</option>";
            }
          ?>
          </select></td></tr>
          <tr>
<td><label style="color:white;">Required Equipment <br/> (Software, Hardware, Etc.)</label></td><td style="color:white;">:</td><td>
          <textarea id="keteranganmhs" name="keteranganmhs" cols="40" rows="5"></textarea></td></tr>
          </div> <!-- end form-group-->
          </table>
          </div>
          <center><input type='submit' value='Save Data'></center>
          </div><!-- end mahasiswa selectt-->
        <div class="staff selectt">
          <center><strong>General/Guest</strong></center>
          <div class="table-responsive">
        <table class="table" border="0">
        <div class="form-group">
        <tr>
            <td><label style="color:white;">Number of Identity</label></td><td style="color:white;">:</td><td>
            <input type="text" id="nippeg" name="nippeg" style="width:250px;"></td></tr>
        <tr>
          <td><label style="color:white;">Name</label></td><td style="color:white;">:</td><td>                    
          <input type="text" id="namapeg" name="namapeg" style="width:250px;"></td></tr>
          <tr>
          <td><label style="color:white;">Institution</label></td><td style="color:white;">:</td><td>                    
          <input type="text" id="namainstitusi" name="namainstitusi" style="width:350px;"></td></tr>
          <tr>
          <td><label for="Tanggal" style="color:white;">Date</label></td><td style="color:white;">:</td><td>
           <input type="date" id="tglpeg" name="tglpeg" placeholder="MM/DD/YYYY"></td></tr>
          <td><label style="color:white;">Session</label></td><td style="color:white;">:</td><td>
          <select id="sesipeg" style="width:250px;" name="sesipeg">
          <option value='0'>-- Find Session, Ex.: Session --</option>
          <?php 
          include 'config.php';
          $query = mysqli_query($conn,"Select kodesesi, namasesi from sesi order by kodesesi asc") or die(mysqli_error());
            while ($data = mysqli_fetch_array($query, MYSQLI_ASSOC)){
              echo "<option value=".$data['kodesesi'].">".$data['namasesi']."</option>";
            }
          ?>
          </select></td</tr>
          <tr>
          <td><label style="color:white;">Laboratory</label></td><td style="color:white;">:</td><td>
          <select id="labpeg" style="width:300px;" name="labpeg">
          <option value='0'>-- Find Lab., Ex.: msi --</option>
          <?php 
          include 'config.php';
          $query = mysqli_query($conn,"select kodelab, nickname from laboratorium order by kodelab") or die(mysqli_error());
            while ($data = mysqli_fetch_array($query, MYSQLI_ASSOC)){
              echo "<option value=".$data['kodelab'].">".$data['nickname']."</option>";
            }
          ?>
          </select></td></tr>
          <tr>
          <td><label style="color:white;">Purpose </label></td><td style="color:white;">:</td><td>
          <select id="keperluanpeg" style="width:350px;" name="keperluanpeg">
          <option value='0'>-- Find Purpose, Ex.: demo --</option>
          <?php 
          include 'config.php';
          $query = mysqli_query($conn,"select idkeperluan, namakeperluan from keperluanpinjam where idkeperluan in('12','13','15')") or die(mysqli_error());
            while ($data = mysqli_fetch_array($query, MYSQLI_ASSOC)){
              echo "<option value=".$data['idkeperluan'].">".$data['namakeperluan']."</option>";
            }
          ?>
          </select></td></tr>
          <tr>
          <td><label style="color:white;">Required Equipment <br /> (Software, Hardware, Etc.)</label></td><td style="color:white;">:</td><td>
          <textarea id="keteranganpeg" name="keteranganpeg" cols="40" rows="5"></textarea></td></tr>
          </div> <!-- end form-group-->
          </table>
          </div>
          <center><input type='submit' value='Save Data'></center>
          </div> <!-- end staff selecttt-->
        </form>
        <!--<div id="result"></div>-->
        </div>
            </div>
        </div>
        </div>
        </div></center>
</div><br>
<div class="jumbotron text-center" style="margin-bottom:0">
    <center><p><b>Departement of Information Systems-UPN Veteran Jatim <br/> &copy Copyright 2020 </b></p></center>
</div>

<!-- Script -->
        <Script>
        $(document).ready(function(){
            // Initialize select2
            $("#pegawai").select2();

           //Read selected option
           $('#but_read').click(function(){
           var nama = $('#pegawai option:selected').text();
           var nip = $('#pegawai').val();
          //$('#result').html("id : " + nip + ", name : " + nama);
         
            });
        });
        
        $(document).ready(function(){
            // Initialize select2
            $("#paralelmk").select2();

           //Read selected option
           $('#but_read').click(function(){
           var nama = $('#paralelmk option:selected').text();
           var nip = $('#paralelmk').val();
         
            });
        });
        
        $(document).ready(function(){
            // Initialize select2
            $("#sesi").select2();

           //Read selected option
           $('#but_read').click(function(){
           var nama = $('#sesi option:selected').text();
           var nip = $('#sesi').val();
         
            });
        });
        $(document).ready(function(){
            // Initialize select2
            $("#matakuliah").select2();

           //Read selected option
           $('#but_read').click(function(){
           var nama = $('#matakuliah option:selected').text();
           var nip = $('#matakuliah').val();
         
            });
        });
        $(document).ready(function(){
            // Initialize select2
            $("#lab").select2();

           //Read selected option
           $('#but_read').click(function(){
           var nama = $('#lab option:selected').text();
           var nip = $('#lab').val();
         
            });
        });
        $(document).ready(function(){
            // Initialize select2
            $("#keperluan").select2();

           //Read selected option
           $('#but_read').click(function(){
           var nama = $('#keperluan option:selected').text();
           var nip = $('#keperluan').val();
         
            });
        });
        //mahasiswa
        $(document).ready(function(){
            // Initialize select2
            $("#paralelmhs").select2();

           //Read selected option
           $('#but_read').click(function(){
           var nama = $('#paralelmhs option:selected').text();
           var nip = $('#paralelmhs').val();
         
            });
        });
        
        $(document).ready(function(){
            // Initialize select2
            $("#sesimhs").select2();

           //Read selected option
           $('#but_read').click(function(){
           var nama = $('#sesimhs option:selected').text();
           var nip = $('#sesimhs').val();
         
            });
        });
        $(document).ready(function(){
            // Initialize select2
            $("#mkmhs").select2();

           //Read selected option
           $('#but_read').click(function(){
           var nama = $('#mkmhs option:selected').text();
           var nip = $('#mkmhs').val();
         
            });
        });
        $(document).ready(function(){
            // Initialize select2
            $("#labmhs").select2();

           //Read selected option
           $('#but_read').click(function(){
           var nama = $('#labmhs option:selected').text();
           var nip = $('#labmhs').val();
         
            });
        });
        $(document).ready(function(){
            // Initialize select2
            $("#keperluanmhs").select2();

           //Read selected option
           $('#but_read').click(function(){
           var nama = $('#keperluanmhs option:selected').text();
           var nip = $('#keperluanmhs').val();
         
            });
        });
        
        $(document).ready(function(){
            // Initialize select2
            $("#sesipeg").select2();

           //Read selected option
           $('#but_read').click(function(){
           var nama = $('#sesipeg option:selected').text();
           var nip = $('#sesipeg').val();
         
            });
        });
        $(document).ready(function(){
            // Initialize select2
            $("#labpeg").select2();

           //Read selected option
           $('#but_read').click(function(){
           var nama = $('#labpeg option:selected').text();
           var nip = $('#labpeg').val();
         
            });
        });
        $(document).ready(function(){
            // Initialize select2
            $("#keperluanpeg").select2();

           //Read selected option
           $('#but_read').click(function(){
           var nama = $('#keperluanpeg option:selected').text();
           var nip = $('#keperluanpeg').val();
         
            });
        });
        
        </Script>
        <script type="text/javascript">
            $(document).ready(function() {
                $('input[type="radio"]').click(function() {
                    var inputValue = $(this).attr("value");
                    var targetBox = $("." + inputValue);
                    $(".selectt").not(targetBox).hide();
                    $(targetBox).show();
                    /*alert("Radio button " + inputValue + " is selected");*/
                });
            });
        </script>
        
</body>
</html>