Files
sidak/admin/pindah/data_pindah.php

97 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 Pindah</h3>
</div>
<!-- /.card-header -->
<div class="card-body">
<div class="table-responsive">
<div>
<a href="?page=add-pindah" 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>NIK</th>
<th>Nama</th>
<th>Jenis Kelamin</th>
<th>Tanggal</th>
<th>Alasan</th>
<th>Aksi</th>
</tr>
</thead>
<tbody>
<?php
$no = 1;
$sql = $koneksi->query("SELECT p.id_pend, p.nik, p.nama, p.jekel, d.tgl_pindah, d.alasan, d.id_pindah from
tb_pindah d inner join tb_pdd p on p.id_pend=d.id_pdd");
while ($data= $sql->fetch_assoc()) {
?>
<tr>
<td>
<?php echo $no++; ?>
</td>
<td>
<?php echo $data['nik']; ?>
</td>
<td>
<?php echo $data['nama']; ?>
</td>
<td>
<?php echo $data['jekel'] == 'LK' ? 'LAKI-LAKI' : 'PEREMPUAN'; ?>
</td>
<td>
<?php echo $data['tgl_pindah']; ?>
</td>
<td>
<?php echo $data['alasan']; ?>
</td>
<td>
<a href="?page=view-pindah&kode=<?php echo $data['id_pindah']; ?>" title="Detail"
class="btn btn-info btn-sm">
<i class="fa fa-eye"></i>
</a>
<a href="?page=edit-pindah&kode=<?php echo $data['id_pindah']; ?>" title="Ubah"
class="btn btn-success btn-sm">
<i class="fa fa-edit"></i>
</a>
<a href="?page=del-pindah&kode=<?php echo $data['id_pend']; ?>" 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>