<title>Inbox</title>
<div id="pagetitle">INBOX</div>
<div id="batascontent" class="clearfix">
	<div id="tableres">
		<table width="100%" border="0" class="display" id="example">
			<thead>
				<tr align="left">
					<th>NO</th>
					<th>SUBJECT</th>
					<th>FROM</th>
					<th>PHONE</th>
					<th>EMAIL</th>
					<th>DATE</th>
					<th></th>
				</tr>
			</thead>
			<tbody>
				<?php
					$nomor = 1;
					$db = mysqli_query($koneksi, "SELECT * FROM cmas_pesan ORDER BY pesan_id DESC");
					while($dt = mysqli_fetch_array($db)) {
				?>
					<tr>
						<td width="1%">
							<?php echo $nomor; ?>
						</td>
						<?php if ($dt['pesan_status'] != 0) { ?>
							<td>
								<a href="?m=pesan_detail&id=<?php echo $dt['pesan_id']; ?>">
									<b><?php echo $dt['pesan_subject']; ?></b>
								</a>
							</td>
							<td>
								<b><?php echo $dt['pesan_name']; ?></b>
							</td>
							<td>
								<b><?php echo $dt['pesan_phone']; ?></b>
							</td>
							<td>
								<b><?php echo $dt['pesan_email']; ?></b>
							</td>
							<td>
								<b><?php echo date_format(date_create($dt['postdated']), 'd/m/Y H:i:s'); ?></b>
							</td>
						<?php } else { ?>
							<td>
								<a href="?m=pesan_detail&id=<?php echo $dt['pesan_id']; ?>">
									<?php echo $dt['pesan_subject']; ?>
								</a>
							</td>
							<td>
								<?php echo $dt['pesan_name']; ?>
							</td>
							<td>	
								<?php echo $dt['pesan_phone']; ?>
							</td>
							<td>
								<?php echo $dt['pesan_email']; ?>
							</td>
							<td>
								<?php echo date_format(date_create($dt['postdated']), 'd/m/Y H:i:s'); ?>
							</td>
						<?php } ?>
							
						<td width="8%">
							<a href="?m=pesan_detail&id=<?php echo $dt['pesan_id']; ?>">
								<img src="assets/images/icons/icon_view.png" width="20" title="Lihat Email">
							</a> 
							<a href="mailto:<?php echo $dt['pesan_email']; ?>">
								<img src="assets/images/icons/icon_reply.png" width="20" title="Balas Email">
							</a> 
							<a href="?m=pesan_hapus&id=<?php echo $dt['pesan_id']; ?>" onClick="return confirm('DATA AKAN DIHAPUS, ANDA YAKIN ?');">
								<img src="assets/images/icons/icon_delete.png" width="20" title="Hapus Email">
							</a>
						</td>
					</tr>
				<?php $nomor++;	} ?>
			</tbody>
		</table>
	</div>
</div>