<?php 
	session_start();
	if($_SESSION['level']==""){
	header("location:index.php?alert=belum_login");
}
	?><head>
<title>Tampil data</title>
	<link rel="stylesheet" type="text/css" href="css/style_tampil.css">
	<script type="text/javascript" src="jquery.js"></script>
</head>
	
<link href="//netdna.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css" rel="stylesheet">



<body>
	<div class="menu">
		<ul>
		    <li><a href="login/logout.php">LOGOUT</a></li>
		</ul>
	</div>

<center><h1>SURAT PENGANTAR RT</h1></center>
	<table cellspacing='0'>
	<tr><th>No</th>
		<th>Tanggal</th>
		<th>No Surat</th>
		<th>NIK</th>
		<th>Nama</th>
		<th>Alamat</th>
		<th>Keperluan</th>
		<th>Berlaku Mulai</th>
		<th>Opsi</th>
</tr>

<?php
include"koneksi.php";
$no = 0; 		
$data = mysqli_query($koneksi,"select * from pengantar order by berlaku_mulai desc");
while($d = mysqli_fetch_array($data))
{
 $no ++;
	
		?>
		 
<tr><td><?php echo $no ; ?></td>
	<td><?php echo $d['berlaku_mulai'];?></td>
	<td><?php echo $d['nomor_surat'];?></td>
	<td><?php echo $d['nik'];?></td>
	<td><?php echo $d['nama'];?></td>
	<td><?php echo $d['alamat'];?></td>
	<td><?php echo $d['keperluan'];?></td>
	<td><?php echo $d['berlaku_mulai'];?></td>
<td>
		
	<a href="edit_data.php?nomor_surat=<?php echo $d['nomor_surat']; ?> "><button> <i class="fa fa-edit fa_custom fa-1x">Edit</button></i></a>
	<a href="hapus_data.php?nomor_surat=<?php echo $d['nomor_surat'];?>"><button> <i class="fa fa-trash-o fa_custom fa-1x">Hapus</button></i></a>
	<a href="cetak.php?nomor_surat=<?php echo $d['nomor_surat']; ?>" target="_blank"><button> <i class="fa fa-print fa_custom fa-1x">Cetak</button></i></a></td>
</tr>
<?php
};
?>
</table>
<script language="JavaScript" type="text/javascript">
function del(id){
if (confirm("yakin akan menghapus data ini?")){
window.location.href = 'hapus_data.php?id=' + id;
}}
</script>
</body>
</html>