<?php
  $tahun = date('y');
  $bulan = date('m');
  $hari = date('d');
  $rand = rand(1, 9999);
  $char = "N";
  $newID = sprintf($tahun).sprintf($bulan).sprintf($hari).sprintf("%04s", $rand); 
?>

        <div class="col" role="main">
          <div class="">
            <div class="clearfix"></div>
            <div class="row">
              <div class="col-md-12 col-sm-12 col-xs-12">
                <div class="x_panel">
                  <div class="x_title" style="text-transform: capitalize;">
                    <h2>TAMBAH DATA SANTRI</h2>
                    <div class="clearfix"></div>
                  </div>
                  <div class="x_content">
                    <form action="?module=santri&aksi=simpan"  enctype="multipart/form-data" method="POST">
                    <div class="row">
                    <div class="col-md-6">
                      <label for="id">ID santri :</label>
                      <input type="text"  class="form-control" disabled value="<?php echo $newID;?>"  />
                      <input type="hidden"  class="form-control" name="id" value="<?php echo $newID;?>"  />
                       
                      <label for="nama">Nama :</label>
                      <input type="text"  class="form-control" name="nama"  value="" />
                      
                      <label>Jenis Kelamin :</label>
                      <select id="heard" class="form-control" required name="jenkel">
                              <option value="" selected>- Jenis kelamin -</option>
                              <option value="1" >Laki-laki</option>
                              <option value="0" >Perempuan</option>
                           
                      </select>

                      <label for="nama">Tempat Lahir :</label>
                      <input type="text"  class="form-control" name="tempat_lahir"  value="" />

                      <label for="nama">Tanggal Lahir :</label>
                    
                      <div class="input-group">
                      <div class="input-group-addon"><i class="glyphicon glyphicon-calendar"></i></div>
                      <input type="text" class="form-control " autocomplete="off" value="" id="tanggal"   name="tanggal_lahir"  >
                      </div>

                      <label>Status :</label>
                      <select id="heard" class="form-control" required name="status">
                            <?php if ($r['statuus']==0){ ?>
                              <option value="0" selected>- Pilih Status -</option>
                            <?php 
                            }
                            $query2  = "SELECT * FROM jenis_status ORDER BY id_status";
                            $tampil2 = mysqli_query($conn, $query2);
                            while($w=mysqli_fetch_array($tampil2)){
                              if ($r['statuus']==$w['id_status']){
                                echo "<option value=\"$w[id_status]\" selected>$w[nama_status]</option>";
                              }
                              else{
                                echo "<option value=\"$w[id_status]\">$w[nama_status]</option>";
                              }
                            }
                          ?>
                      </select>

                      <!--data baru-->

                      <label for="nama">NIK :</label>
                      <input type="text"  class="form-control" name="nik"  value="" />

                      <label for="nama">NO. KK :</label>
                      <input type="text"  class="form-control" name="nokk"  value="" />

                   



                      </div>
                      <div class="col-md-6">

                      <label for="nama">Tanggal Masuk :</label>
                    
                      <div class="input-group">
                      <div class="input-group-addon"><i class="glyphicon glyphicon-calendar"></i></div>
                      <input type="text" class="form-control " autocomplete="off" value="" id="tanggal2"   name="tanggal_masuk"  >
                      </div>

                      <label for="nama">FOTO :</label>
                      <input type="text"  class="form-control" name="foto"  value="" />
            
                      <label for="nama">Nama Ayah :</label>
                      <input type="text"  class="form-control" name="nama_ayah"  value="" />

                      <label for="nama">NIK Ayah :</label>
                      <input type="text"  class="form-control" name="nik_ayah"  value="" />

                      <label for="nama">Nama Ibu :</label>
                      <input type="text"  class="form-control" name="nama_ibu"  value="" />

                      <label for="nama">NIK Ibu :</label>
                      <input type="text"  class="form-control" name="nik_ibu"  value="" />
                      
                      <label for="alamat">Alamat Lengkap :</label>
                      <textarea class="form-control" name="alamat" requerid  > </textarea>
                    
                   
                      </div>
                      </div>
                      <div class="ln_solid"></div>
                      <div class="form-group">
                        <button type="button" class="btn btn-default btn-sm" onclick=self.history.back()>Batal</button>
                        <button type="submit" onclick="return confirm('Apakah yakin akan disimpan?')" class="btn btn-success btn-sm">Simpan</button><br>
                      </div><br><br>
                  </div>
                </div>
              </div>
          </div>
        </div>
      </div>