<?php
include("sess_check.php");
error_reporting(0);
// deskripsi halaman
$pagedesc = "pindah";
include("layout_top.php");
include("dist/function/format_tanggal.php");
include("dist/function/format_rupiah.php");
?>
<!-- top of file -->
<!-- Page Content -->
<div id="page-wrapper">
	<div class="container-fluid">
		<div class="row">
			<div class="col-lg-12">
				<h1 class="page-header">Surat Keterangan Pindah</h1>
			</div><!-- /.col-lg-12 -->
		</div><!-- /.row -->

		<div class="row">
			<div class="col-lg-12"><?php include("layout_alert.php"); ?></div>
		</div>

		<div class="row">
			<div class="col-lg-12">
				<div class="panel panel-default">
					<div class="panel-heading">
						<a href="skpindahkeluar_tambah.php" class="btn btn-success">Tambah</a>
					
					</div>
					<div class="panel-body">
						<table class="table table-striped table-bordered table-hover" id="tabel-data">
							<thead>
								<tr>
									<th width="1%">No</th>
									<th width="8%">Tanggal</th>
									<th width="10%">Nama Lengkap</th>
									<th width="10%">Keterangan pindah</th>
									<th width="15%">Opsi</th>
								</tr>
							</thead>
							<tbody>
								<?php
								$i = 1;
								$sql = "SELECT pindah.id_pindah, penduduk.nama_lengkap, kelurahan.nama_pejabat, pindah.keterangan_pindah from pindah inner join penduduk on penduduk.id_penduduk=pindah.id_penduduk inner join kelurahan on kelurahan.id_kelurahan=pindah.id_kelurahan order by pindah.id_pindah desc";
								$ress = mysqli_query($conn, $sql);
								while ($data = mysqli_fetch_array($ress)) {
									echo '<tr>';
									echo '<td class="text-center">' . $i . '</td>';
									echo '<td class="text-center">' . format_tanggal($data['tanggal']) . '</td>';
									echo '<td class="text-left">' . $data['nama_lengkap'] . '</td>';
									echo '<td class="text-center">' . $data['keterangan_pindah'] . '</td>';
									echo '<td class="text-center">
										
													   '; ?>
													<a href="cetakskpindah.php?id=<?php echo $data['id_pindah']; ?>" target="_blank" class="btn btn-warning btn-xs">Cetak</a>
									<a href="skpindah_hapus2.php?hapus=<?php echo $data['id_pindah']; ?>" onclick="return confirm('Apakah anda yakin akan menghapus <?php echo $data['nama_lengkap']; ?>?');" class="btn btn-danger btn-xs">Hapus</a></td>
								<?php
									echo '</td>';
									echo '</tr>';
									$i++;
								}
								?>
							</tbody>
						</table>
					</div>
					<!-- Large modal -->
					<div class="modal fade bs-example-modal" id="myModal" tabindex="-1" role="dialog" aria-hidden="true">
						<div class="modal-dialog modal-lg">
							<div class="modal-content">
								<div class="modal-body">
									<p>One fine body…</p>
								</div>
							</div>
						</div>
					</div>
				</div><!-- /.panel -->
			</div><!-- /.col-lg-12 -->
		</div><!-- /.row -->
	</div><!-- /.container-fluid -->
</div><!-- /#page-wrapper -->
<!-- bottom of file -->
<script type="text/javascript">
	$(document).ready(function() {
		$('#tabel-data').DataTable({
			"responsive": true,
			"processing": true,
			"columnDefs": [{
				"orderable": false,
				"targets": [3]
			}]
		});

		$('#tabel-data').parent().addClass("table-responsive");
	});
</script>
<script>
	var app = {
		code: '0'
	};

	$('[data-load-code]').on('click', function(e) {
		e.preventDefault();
		var $this = $(this);
		var code = $this.data('load-code');
		if (code) {
			$($this.data('remote-target')).load('skpindahdetail.php?code=' + code);
			app.code = code;

		}
	});
</script>
<?php
include("layout_bottom.php");
?>

