Files
sidak/admin/kartu/data_kartu.php
2026-01-18 21:16:53 +08:00

93 lines
2.4 KiB
PHP

<div class="card card-info">
<div class="card-header">
<h3 class="card-title">
<i class="fa fa-table"></i> Data KK</h3>
</div>
<!-- /.card-header -->
<div class="card-body">
<div class="table-responsive">
<div>
<a href="?page=add-kartu" 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>NO KK</th>
<th>Kepala Keluarga</th>
<th>Alamat</th>
<th>Anggota KK</th>
<th>Aksi</th>
</tr>
</thead>
<tbody>
<?php
$no = 1;
$sql = $koneksi->query("select * from tb_kk");
while ($data= $sql->fetch_assoc()) {
?>
<tr>
<td>
<?php echo $no++; ?>
</td>
<td>
<?php echo $data['no_kk']; ?>
</td>
<td>
<?php echo $data['kepala']; ?>
</td>
<td>
<?php echo $data['desa']; ?>
RT
<?php echo $data['rt']; ?>/ RW
<?php echo $data['rw']; ?>.
</td>
<td>
<a href="?page=anggota&kode=<?php echo $data['id_kk']; ?>" title="Anggota KK"
class="btn btn-info btn-sm">
<i class="fa fa-users"></i>
</a>
</td>
<td>
<a href="?page=edit-kartu&kode=<?php echo $data['id_kk']; ?>" title="Ubah" class="btn btn-success btn-sm">
<i class="fa fa-edit"></i>
</a>
<a href="#" onclick="HapusData('<?php echo $data['id_kk']; ?>')" title="Hapus" class="btn btn-danger btn-sm">
<i class="fa fa-trash"></i>
</a>
</td>
</tr>
<?php
}
?>
</tbody>
</tfoot>
</table>
</div>
</div>
</div>
<!-- /.card-body -->
<script>
function HapusData(id){
Swal.fire({
title: 'Apakah anda yakin?',
text: "Data yang dihapus tidak dapat dikembalikan!",
icon: 'warning',
showCancelButton: true,
confirmButtonColor: '#d33',
cancelButtonColor: '#3085d6',
confirmButtonText: 'Ya, Hapus!',
cancelButtonText: 'Batal'
}).then((result) => {
if (result.value) {
window.location.href = "?page=del-kartu&kode=" + id;
}
})
}
</script>