Files
sidak/admin/lahir/data_lahir.php
wartana 51451824ba Replace all confirmation dialogs with SweetAlert2
- Replace native confirm() with SweetAlert2 for better UX
- Add custom confirmation functions for logout and delete actions
- Fix HTML syntax errors (</> to </a>) in all data tables
- Use consistent styling with cancel/confirm buttons
- All confirmations now have 'Konfirmasi Hapus'/'Konfirmasi Logout' titles
2026-01-22 08:53:47 +08:00

90 lines
2.3 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>Jekel</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 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>