<link rel="stylesheet" href="themes/base/jquery.ui.all.css">
<link rel="stylesheet" href="css/chosen.css">
<script src="plugins/datepicker/js/jquery-1.7.2.js"></script>
<script src="plugins/datepicker/ui/jquery.ui.core.js"></script>
<script src="plugins/datepicker/ui/jquery.ui.widget.js"></script>
<script src="plugins/datepicker/ui/jquery.ui.datepicker.js"></script>
<script>
	$(function() {
		$( "#datepicker" ).datepicker({
			format: ('yyyy-mm-dd')
		});
	});
</script>
<script>
	$(function() {
		$( "#datepicker1" ).datepicker({
			format: ('yyyy-mm-dd')
		});
	});
</script>
<script>
	$(function() {
		$( "#datepicker2" ).datepicker({
			format: ('yyyy-mm-dd')
		});
	});
</script>
<div class="content-wrapper">
        <!-- Content Header (Page header) -->
        <section class="content-header">
          <h1>
            TAMBAH PESERTA
          </h1>
          <ol class="breadcrumb">
            <li><a href="#"><i class="fa fa-dashboard"></i> Home</a></li>
            
          </ol>
        </section>

        <!-- Main content -->
        <section class="content">

          <div class="row">
              
              <!-- TABS -->
            <div class="col-md-12">
              <div class="nav-tabs-custom">
                <ul class="nav nav-tabs">
                  <li class="active"><a href="#biodata" data-toggle="tab">Biodata Umum</a></li>
                  <li><a href="#alamat" data-toggle="tab">Rekam Medis </a></li>
                  <li><a href="#lain" data-toggle="tab">Periksa</a></li>
                </ul>
                  
                  
                <div class="tab-content">
                    <!-- TABS WILAYAH -->
                    <div class="active tab-pane" id="biodata">
                    <!-- Post -->
                        <div class="post">
                        <div class="box"> 
                            <div class="box-header">
                                
                            </div><!-- /.box-header -->
                            <div class="box-body">
                               
                            <form name="form" action="" method="post" enctype="multipart/form-data">             

                            <div class="row">
                                <div class="col-md-6">
                                    <div class="form-group">
                                        <label for="" class="col-sm-5 control-label">Upload Foto </label>
                                        <div class="col-sm-7">
                                          <input name="Foto" class="" type="file" required>
                                        </div>
                                    </div>
                                    <br><br>
                                    <div class="form-group">
                                        <label for="" class="col-sm-5 control-label">No Registrasi</label>
                                        <div class="col-sm-7">
                                          <input type="text" class="form-control" id="" placeholder="No Urut" name="NoKK">
                                        </div>
                                    </div>
                                    <br><br>
                                    <div class="form-group">
                                        <label for="" class="col-sm-5 control-label">No Peserta</label>
                                        <div class="col-sm-7">
                                          <input type="text" class="form-control" id="" placeholder="No Peserta" name="NoKTP">
                                        </div>
                                    </div>
                                    <br><br>
                                    <div class="form-group">
                                        <label for="" class="col-sm-5 control-label">Nama Lengkap</label>
                                        <div class="col-sm-7">
                                          <input type="text" class="form-control" id="" placeholder="Nama" name="Nama">
                                        </div>
                                    </div>
                                    <br><br>
                                    <div class="form-group">
                                        <label for="inputName" class="col-sm-5 control-label">Tempat Lahir</label>
                                        <div class="col-sm-7">
                                            <input type="text" class="form-control" id="inputName" placeholder="Tempat Lahir" name="TempatLahir">
                                        </div>
                                    </div>
                                    <br><br>
                                    <div class="form-group">
                                        <label for="inputName" class="col-sm-5 control-label">Tanggal Lahir</label>
                                        <div class="col-sm-7">  
                                            <input type="text" class="form-control" id="datepicker" name="TglLahir" placeholder="yyyy-mm-dd">
                                        </div> 
                                    </div>
                                    <br><br>
                                    <div class="form-group">
                                        <label for="inputName" class="col-sm-5 control-label">Jenis Kelamin</label>
                                            <div class="col-sm-7">
                                                <select class="form-control" name="JenKel">
                                                <option value=""></option>
                                                <option value="Laki-laki">Laki-laki</option>
                                                <option value="Perempuan">Perempuan</option>
                                                </select>
                                            </div>
                                    </div>
                                    <br><br>
                                </div> 
                                <div class="col-md-6">
                                    <input type="hidden" name="SHDK" value="Kepala Keluarga">
                                    <div class="form-group">
                                        <label for="inputName" class="col-sm-5 control-label">Agama</label>
                                            <div class="col-sm-7">
                                              <select class="form-control" name="Agama">
                                                <option value=""></option>
                                                <option value="Islam">Islam</option>
                                                <option value="Protestan">Protestan</option>
                                                <option value="Katolik">Katolik</option>
                                                <option value="Hindu">Hindu</option>
                                                <option value="Budha">Budha</option>
                                                <option value="Lainnya">Lainnya</option>
                                              </select>
                                        </div>
                                    </div>
                                    <br><br>
                                    <div class="form-group">
                                        <label for="inputName" class="col-sm-5 control-label">Golongan Darah</label>
                                            <div class="col-sm-7">
                                              <select class="form-control" name="GolDar">
                                                <option value=""></option>
                                                <option value="A">A</option>
                                                <option value="B">B</option>
                                                <option value="O">O</option>
                                                <option value="AB">AB</option>
                                                <option value="A+">A+</option>
                                                <option value="A-">A-</option>
                                                <option value="B+">B+</option>
                                                <option value="O+">O+</option>
                                                <option value="O-">O-</option>
                                                <option value="AB+">AB+</option>
                                                <option value="AB-">AB-</option>
                                                <option value="Tidak Tahu">Tidak Tahu</option>
                                              </select>
                                            </div>
                                    </div>
                                    <br><br>
                                    <div class="form-group">
                                        <label for="inputName" class="col-sm-5 control-label">Status</label>
                                        <div class="col-sm-7">
                                        <select name="Pekerjaan" class="form-control" id="chosen" data-placeholder="Pilih Status"  tabindex="1">
                                            <option value="" selected="selected"></option>
                                            <option value="Siswa">Siswa</option>
                                            <option value="Guru">Guru</option>
                                            <option value="Karyawan">Karyawan</option>
                                            <option value="Kepala Sekolah">Kepala Sekolah</option>
                                            <option value="Orang Tua/Wali">Orang Tua/Wali</option>
                                            <option value="Umum">Umum</option>
                                            
                                        </select>
                                    </div>
                                    <br><br><br>
                                   
                                    <div class="form-group">
                                        <label for="" class="col-sm-5 control-label">Status Organisasi</label>
                                            <div class="col-sm-7">
                                              <select class="form-control" name="StatusKK">
                                                <option value=""></option>
                                                <option value="Pengurus">Pengurus</option>
                                                <option value="Anggota">Anggota</option>
                                              </select>
                                        </div>
                                    </div>  
                                </div>
                            </div>
                            </div><!-- /.post -->
                        </div><!-- /.tab-pane -->
                                <div class="box-footer">
											<div class="row">
												<div class="col-sm-6">
													<div class="text-left">
													</div>
												</div>
												<div class="col-sm-6">
													<div class="text-right">
                                                        <a href="#alamat" data-toggle="tab"><button type="submit" class="btn btn-primary">Selanjutnya</button></a>
													</div>
												</div>
											</div>
				                </div>
                        </div>
                    </div>
                </div>
                    
                    

                  <div class="tab-pane" id="alamat">
                      <div class="post">
                        <div class="box">
                            <div class="box-header">
            
                            </div><!-- /.box-header -->
                            <div class="box-body">
                            <div class="form-group">
                        <label for="inputName" class="col-sm-3 control-label">Rekam Medis</label>
                        <div class="col-sm-10">
                          <small>Data Sakit</small><textarea class="form-control" name="Jalan"></textarea>
						  
                          <small>Tindakan</small><input type="text" class="form-control" id="" placeholder="Jenis Tindakan" name="RT">
                          <small>Obat</small><input type="text" class="form-control" id="" placeholder="Jenis Obat" name="RW">
                        </div>
                      </div>
                            </div>
                                <div class="box-footer">
											<div class="row">
												<div class="col-sm-6">
													<div class="text-left">
														<a href="#biodata" data-toggle="tab"><button type="submit" class="btn btn-primary">Kembali</button></a>
													</div>
												</div>
												<div class="col-sm-6">
													<div class="text-right">
                                                        <a href="#lain" data-toggle="tab"><button type="submit" class="btn btn-primary">Selanjutnya</button></a>
													</div>
												</div>
											</div>
				                </div>
                            </div>
                        </div><!-- /.post -->
                    </div><!-- /.tab-pane -->            
                  
                    <div class="tab-pane" id="lain">
                        <div class="post">
                            <div class="box">
                                <div class="box-header">
                                    
                                </div><!-- /.box-header -->
                                <div class="box-body">
                                        <div class="row">
                                        <div class="col-md-6">
                                            <div class="form-group">
                                                <label for="inputName" class="col-sm-4 control-label">Pemeriksaan Rambut</label>
                                                    <div class="col-sm-6">
                                                        <select class="form-control" name="KelainanFisik">
                                                            <option value="Wajar">Wajar</option>
                                                            <option value="Tidak Wajar">Tidak Wajar</option>
                                                        </select>
                                                    </div>
                                            </div>
                                            <br><br>
                                            <div class="form-group">
                                                <label for="inputName" class="col-sm-4 control-label">Pemeriksaan Kuku</label>
                                                    <div class="col-sm-6">
                                                        <select class="form-control" name="PenyandangCacat">
                                                           
                                                             <option value="Wajar">Wajar</option>
                                                            <option value="Tidak Wajar">Tidak Wajar</option>
                                                        </select>
                                                    </div>
                                            </div>
                                            <br><br>
                                            <div class="form-group">
                                                <label for="inputName" class="col-sm-4 control-label">Pemeriksaan Sepatu</label>
                                                    <div class="col-sm-6">
                                                        <select class="form-control" name="AktaLahir">
                                                            <option value="Wajar">Wajar</option>
                                                            <option value="Tidak Wajar">Tidak Wajar</option>
                                                        </select>
                                                    </div>
                                            </div>
                                            <br><br>
                                            <div class="form-group">
                                                <label for="inputName" class="col-sm-4 control-label">Catatan</label>
                                                    <div class="col-sm-6">
                                                        <input type="text" class="form-control" id="inputName" placeholder="Catatan" name="NoAktaLahir">
                                                    </div>
                                            </div>
                                            
                                            <br><br>
                                            <div class="form-group">
                                                <label for="inputName" class="col-sm-4 control-label">Tanggal Pemeriksaan</label>
                                                <div class="col-sm-6">  
                                                    <input class="form-control" type="text" id="datepicker2" name="TglCerai">
                                                </div> 
                                            </div>
                                            <br><br>
                                        </div>
                                        </div>
                                        <div class="box-footer">
											<div class="row">
												<div class="col-sm-6">
													<div class="text-left">
														<a href="#alamat" data-toggle="tab"><button type="submit" class="btn btn-primary">Kembali</button></a>
													</div>
												</div>
												<div class="col-sm-6">
													<div class="text-right">
														<button type="submit" class="btn btn-danger btn-lg"name="Simpan">SIMPAN</button>
													</div>
												</div>
											</div>
										</div>
                                    </div> 
                                </div>
                        </div><!-- /.post -->
                    </div><!-- /.tab-pane -->
					</form>
					<?php
					include 'koneksi.php';
					if (isset($_POST['Simpan'])) 
					{
					include 'koneksi.php';
					error_reporting(E_ALL ^ (E_NOTICE | E_WARNING));					
						$NoKTP = $_POST['NoKTP'];
						$NoKK= $_POST['NoKK']; 
						$Nama= $_POST['Nama']; 
						$TempatLahir= $_POST['TempatLahir']; 
						$TglLahir= $_POST['TglLahir'];
						$Jalan= $_POST['Jalan'];
						$RT = $_POST['RT'];
						$RW= $_POST['RW']; 
						$JenKel= $_POST['JenKel']; 
						$Agama= $_POST['Agama']; 
						$SHDK= $_POST['SHDK'];
						$GolDar= $_POST['GolDar'];
						$Pendidikan= $_POST['Pendidikan'];
						$Pekerjaan = $_POST['Pekerjaan'];
						$S_Nikah= $_POST['S_Nikah']; 
						$Kewarganegaraan= $_POST['Kewarganegaraan']; 
						$StatusKK = $_POST['StatusKK']; 
						
						$KTPAyah= $_POST['KTPAyah']; 
						$NamaAyah= $_POST['NamaAyah'];
						$KTPIbu= $_POST['KTPIbu'];
						$NamaIbu = $_POST['NamaIbu'];
						
						$KelainanFisik= $_POST['KelainanFisik'];
						$PenyandangCacat= $_POST['PenyandangCacat'];
						$AktaLahir = $_POST['AktaLahir'];
						$NoAktaLahir= $_POST['NoAktaLahir']; 
						$AktaKawin= $_POST['AktaKawin']; 
						$NoAktaKawin= $_POST['NoAktaKawin']; 
						$TglKawin= $_POST['TglKawin'];
						$AktaCerai= $_POST['AktaCerai'];
						$NoAktaCerai = $_POST['NoAktaCerai'];
						$TglCerai= $_POST['TglCerai']; 
						$Foto  = $_FILES['Foto']['name'];
						
					$query3=mysql_query("INSERT INTO penduduk (id,NoKTP,NoKK,Nama,TempatLahir,TglLahir,Jalan,RT,RW,JenKel,Agama,GolDar,Pendidikan,Pekerjaan,S_Nikah,Kewarganegaraan,SHDK,StatusKK,KTPAyah,NamaAyah,KTPIbu,NamaIbu,KelainanFisik,PenyandangCacat,AktaLahir,NoAktaLahir,AktaKawin,NoAktaKawin,TglKawin,AktaCerai,NoAktaCerai,TglCerai,Foto) VALUES ('','$NoKTP','$NoKK','$Nama','$TempatLahir','$TglLahir','$Jalan','$RT','$RW','$JenKel','$Agama','$GolDar','$Pendidikan','$Pekerjaan','$S_Nikah','$Kewarganegaraan','$SHDK','$StatusKK','$KTPAyah','$NamaAyah','$KTPIbu','$NamaIbu','$KelainanFisik','$PenyandangCacat','$AktaLahir','$NoAktaLahir','$AktaKawin','$NoAktaKawin','$TglKawin','$AktaCerai','$NoAktaCerai','$TglCerai','$Foto')")or die(mysql_error());  
					if($query3)
							{ 
						$mv = move_uploaded_file($_FILES['Foto']['tmp_name'], "images/Penduduk/$Foto");  
							if($mv)  
								{
									echo "<script>window.location='indexadmin.php?p=UksPesertaInduk';</script>";
								}
							}
					}
					?>
    
                
                </div><!-- /.tab-content -->
              </div><!-- /.nav-tabs-custom -->
            </div><!-- /.col -->
          </div><!-- /.row -->
        </section><!-- /.content -->
      </div><!-- /.content-wrapper -->


<!--Modal Tambah data-->
<div class="modal fade" id="cariayah" tabindex="-1" role="dialog" aria-labelledby="cariayahLabel" aria-hidden="true">
  	<div class="modal-dialog modal-lg">
    	<div class="modal-content">
            
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="cariayahLabel">Form Pencarian Ayah</h4>
      		</div>
      		<div class="modal-body">            
                <form name="form" method="post" action="">
                  
                <div class="table-responsive">
                <table id="table1" class="table table-bordered table-striped table-hover"  width="100%">
                                    <thead>
                                        <tr>
                                            <th style="width:px;">No KTP</th>
                                            <th style="width:px;">Nama</th>
                                            <th style="width:px;">Tempat Lahir</th>
                                            <th style="width:px;">Tanggal Lahir</th>
                                            <th style="width:px;">Jalan</th>
                                            <th style="width:px;">RT</th>
                                            <th style="width:px;">RW</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                    <?php
                                    $query = mysql_query("SELECT * FROM penduduk WHERE JenKel='Laki-laki' ");
                                    while ($data = mysql_fetch_array($query)) {
                                    ?>
                                        <tr>           
                                            <td><?php echo $data['NoKTP']; ?></td>
                                            <td><?php echo $data['Nama']; ?></td>
                                            <td><?php echo $data['TempatLahir']; ?></td>
                                            <td><?php echo $data['TglLahir']; ?></td>
                                            <td><?php echo $data['Jalan']; ?></td>
                                            <td><?php echo $data['RT']; ?></td>
                                            <td><?php echo $data['RW']; ?></td>
                                        </tr>
                                      <?php
                                      }
                                      ?>
                                    </tbody>
                                </table>
                </div>    
            </div>
      		<div class="modal-footer">
                <button type="close" class="btn btn-default" data-dismiss="modal"><i class="fa fa-close"></i> Close</button>
        		<button type="submit" class="btn btn-primary" name="TambahWilayah"><i class="fa fa-save"></i> OK</button>
                </form>
      		</div>
    	
        </div>
  	</div>
</div>
<!--End Modal Tambah data-->

<!--Modal Tambah data-->
<div class="modal fade" id="cariibu" tabindex="-1" role="dialog" aria-labelledby="cariibu" aria-hidden="true">
  	<div class="modal-dialog modal-lg">
    	<div class="modal-content">
            
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="cariibu">Form Pencarian Ibu</h4>
      		</div>
      		<div class="modal-body">            
                <form name="form" method="post" action="">
                <div class="table-responsive">
                <table id="table" class="table table-bordered table-hover" width="100%">
                                    <thead>
                                        <tr>
                                            <th style="width:px;">No KTP</th>
                                            <th style="width:px;">Nama</th>
                                            <th style="width:px;">Tempat Lahir</th>
                                            <th style="width:px;">Tanggal Lahir</th>
                                            <th style="width:px;">Jalan</th>
                                            <th style="width:px;">RT</th>
                                            <th style="width:px;">RW</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                    <?php
                                    $query = mysql_query("SELECT * FROM penduduk WHERE JenKel='Perempuan' ");
                                    while ($data = mysql_fetch_array($query)) {
                                    ?>
                                        <tr>           
                                            <td><?php echo $data['NoKTP']; ?></td>
                                            <td><?php echo $data['Nama']; ?></td>
                                            <td><?php echo $data['TempatLahir']; ?></td>
                                            <td><?php echo $data['TglLahir']; ?></td>
                                            <td><?php echo $data['Jalan']; ?></td>
                                            <td><?php echo $data['RT']; ?></td>
                                            <td><?php echo $data['RW']; ?></td>
                                        </tr>
                                      <?php
                                      }
                                      ?>
                                    </tbody>
                                </table>
                </div>
            </div>
      		<div class="modal-footer">
                <button type="close" class="btn btn-default" data-dismiss="modal"><i class="fa fa-close"></i> Close</button>
        		<button type="submit" class="btn btn-primary" name="TambahPemukiman"><i class="fa fa-save"></i> Ok</button>
                </form>
      		</div>
    	
        </div>
  	</div>
</div>
<!--End Modal Tambah data-->
<script src="plugins/jQuery/jQuery-2.1.4.min.js"></script>
<script type="text/javascript" charset="utf8" src="plugins/datatables/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="js/chosen.jquery.js"></script>
<script>
    $('document').ready(function(){
        $("#chosen").chosen();
    })
</script>  
  <script>
  $(function(){
    $("#table").dataTable();
  })
  </script>
<script type="text/javascript"> 
$(document).ready(function ()  
{  
  
$("#table td:nth-child(2)").click(function(event){  
  
//Prevent the hyperlink to perform default behavior  
event.preventDefault();  
//alert($(event.target).text())  
  
var $td= $(this).closest('tr').children('td');  
  
  
var ktpibu= $td.eq(0).text();  
var namaibu= $td.eq(1).text();
document.getElementById("idibu").value = ktpibu;
document.getElementById("namaibu").value = namaibu;
     $('#cariibu').modal('hide');}  
  
);  
  
});  
  
</script>
<script type="text/javascript"> 

$(document).ready(function ()  
{  
  
$("#table1 td:nth-child(2)").click(function(event){  
  
//Prevent the hyperlink to perform default behavior  
event.preventDefault();  
//alert($(event.target).text())  
  
var $td= $(this).closest('tr').children('td');  
  
  
var ktpayah= $td.eq(0).text();  
var namaayah= $td.eq(1).text();
document.getElementById("idayah").value = ktpayah;
document.getElementById("namaayah").value = namaayah;
     $('#cariayah').modal('hide');}  
  
);  
  
});  
  
</script>
 
  <script>
  $(function(){
    $("#table1").dataTable();
  })
  </script>
   <script>
  $(function(){
    $("#table").dataTable();
  })
  </script>

