<?php

    if(isset($_GET['kode'])){
        $sql_cek = "SELECT * from tb_pdd where id_pend ='".$_GET['kode']."'";
        $query_cek = mysqli_query($koneksi, $sql_cek);
        $data_cek = mysqli_fetch_array($query_cek,MYSQLI_BOTH);
    }
?>

<div class="card card-success">
	<div class="card-header">
		<h3 class="card-title">
			<i class="fa fa-user"></i> Detail Penduduk</h3>
		</h3>
		<div class="card-tools">
		</div>
	</div>
	<div class="card-body p-0">
		<table class="table">
			<tbody>
				<tr>
					<td style="width: 150px">
						<b>Foto KTP</b>
					</td>
					<td>
						<?php if(!empty($data_cek['foto_ktp'])): ?>
							<img src="foto/ktp/<?php echo $data_cek['foto_ktp']; ?>" width="200px" style="border: 2px solid #6c757d; padding: 3px; border-radius: 5px; cursor: pointer;" onclick="showImage(this.src)" title="Klik untuk memperbesar">
						<?php else: ?>
							<img src="dist/img/noprofile.png" width="200px" style="border: 2px solid #6c757d; padding: 3px; border-radius: 5px;">
						<?php endif; ?>
					</td>
				</tr>
				<tr>
					<td style="width: 150px">
						<b>NIK</b>
					</td>
					<td>:
						<?php echo $data_cek['nik']; ?>
					</td>
				</tr>
				<tr>
					<td style="width: 150px">
						<b>Nama</b>
					</td>
					<td>:
						<?php echo $data_cek['nama']; ?>
					</td>
				</tr>
				<tr>
					<td style="width: 150px">
						<b>Tempat/Tanggal Lahir</b>
					</td>
					<td>:
						<?php echo $data_cek['tempat_lh']; ?>
						/
						<?php echo $data_cek['tgl_lh']; ?>
					</td>
				</tr>
				<tr>
					<td style="width: 150px">
						<b>Jenis Kelamin</b>
					</td>
					<td>:
						<?php 
                            if($data_cek['jekel'] == 'LK') echo "LAKI-LAKI";
                            elseif($data_cek['jekel'] == 'PR') echo "PEREMPUAN";
                            else echo $data_cek['jekel'];
                        ?>
					</td>
				</tr>
				<tr>
					<td style="width: 150px">
						<b>Alamat</b>
					</td>
					<td>:
						<?php echo $data_cek['desa']; ?>, RT
						<?php echo $data_cek['rt']; ?>/ RW
						<?php echo $data_cek['rw']; ?>
					</td>
				</tr>
				<tr>
					<td style="width: 150px">
						<b>Kecamatan</b>
					</td>
					<td>:
						<?php echo $data_cek['kecamatan']; ?>
					</td>
				</tr>
				<tr>
					<td style="width: 150px">
						<b>Kabupaten</b>
					</td>
					<td>:
						<?php echo $data_cek['kabupaten']; ?>
					</td>
				</tr>
				<tr>
					<td style="width: 150px">
						<b>Provinsi</b>
					</td>
					<td>:
						<?php echo $data_cek['provinsi']; ?>
					</td>
				</tr>
				<tr>
					<td style="width: 150px">
						<b>Agama</b>
					</td>
					<td>:
						<?php echo $data_cek['agama']; ?>
					</td>
				</tr>
				<tr>
					<td style="width: 150px">
						<b>Status Kawin</b>
					</td>
					<td>:
						<?php echo $data_cek['kawin']; ?>
					</td>
				</tr>
				<tr>
					<td style="width: 150px">
						<b>Pekerjaan</b>
					</td>
					<td>:
						<?php echo $data_cek['pekerjaan']; ?>
					</td>

				</tr>
				<tr>
					<td style="width: 150px">
						<b>Kewarganegaraan</b>
					</td>
					<td>:
						<?php echo $data_cek['kewarganegaraan']; ?>
					</td>
				</tr>


			</tbody>
		</table>
		<div class="card-footer">
			<a href="?page=data-pend" class="btn btn-warning">Kembali</a>
		</div>
	</div>
</div>