98 lines
2.5 KiB
PHP
98 lines
2.5 KiB
PHP
<div class="card card-info">
|
|
<div class="card-header">
|
|
<h3 class="card-title">
|
|
<i class="fa fa-table"></i> Data Kelahiran</h3>
|
|
</div>
|
|
<!-- /.card-header -->
|
|
<div class="card-body">
|
|
<div class="table-responsive">
|
|
<div>
|
|
<a href="?page=add-lahir" class="btn btn-primary">
|
|
<i class="fa fa-edit"></i> Tambah Data</a>
|
|
</div>
|
|
<br>
|
|
<table id="example1" class="table table-bordered table-striped">
|
|
<thead>
|
|
<tr>
|
|
<th>No</th>
|
|
<th>Nama</th>
|
|
<th>Tgl Lahir</th>
|
|
<th>Jenis Kelamin</th>
|
|
<th>Keluarga</th>
|
|
<th>Aksi</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
|
|
<?php
|
|
$no = 1;
|
|
$sql = $koneksi->query("SELECT l.id_lahir, l.nama, l.tgl_lh, l.jekel, k.no_kk, k.kepala from
|
|
tb_lahir l inner join tb_kk k on k.id_kk=l.id_kk");
|
|
while ($data= $sql->fetch_assoc()) {
|
|
?>
|
|
|
|
<tr>
|
|
<td>
|
|
<?php echo $no++; ?>
|
|
</td>
|
|
<td>
|
|
<?php echo $data['nama']; ?>
|
|
</td>
|
|
<td>
|
|
<?php echo $data['tgl_lh']; ?>
|
|
</td>
|
|
<td>
|
|
<?php
|
|
if ($data['jekel'] == 'LK') {
|
|
echo 'LAKI-LAKI';
|
|
} elseif ($data['jekel'] == 'PR') {
|
|
echo 'PEREMPUAN';
|
|
} else {
|
|
echo $data['jekel'];
|
|
}
|
|
?>
|
|
</td>
|
|
<td>
|
|
<?php echo $data['no_kk']; ?>-
|
|
<?php echo $data['kepala']; ?>
|
|
</td>
|
|
<td>
|
|
<a href="?page=edit-lahir&kode=<?php echo $data['id_lahir']; ?>" title="Ubah"
|
|
class="btn btn-success btn-sm">
|
|
<i class="fa fa-edit"></i>
|
|
</a>
|
|
<a href="?page=del-lahir&kode=<?php echo $data['id_lahir']; ?>" onclick="confirmDelete(event)"
|
|
title="Hapus" class="btn btn-danger btn-sm">
|
|
<i class="fa fa-trash"></i>
|
|
</a>
|
|
</td>
|
|
</tr>
|
|
|
|
<?php
|
|
}
|
|
?>
|
|
</tbody>
|
|
</tfoot>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<!-- /.card-body -->
|
|
<script>
|
|
function confirmDelete(event) {
|
|
event.preventDefault();
|
|
Swal.fire({
|
|
title: 'Konfirmasi Hapus',
|
|
text: 'Apakah Anda yakin ingin menghapus data ini?',
|
|
icon: 'warning',
|
|
showCancelButton: true,
|
|
confirmButtonColor: '#d33',
|
|
cancelButtonColor: '#3085d6',
|
|
confirmButtonText: 'Ya, Hapus',
|
|
cancelButtonText: 'Batal'
|
|
}).then((result) => {
|
|
if (result.isConfirmed) {
|
|
window.location.href = event.currentTarget.href;
|
|
}
|
|
});
|
|
}
|
|
</script>
|