<?php  
	include 'koneksi.php';
	include 'common/header.php';
?>

<h2> <span class="glyphicon glyphicon-credit-card"></span> Daftar Pesanan </h2>
<br><hr>

<table class="table table-hover table-condensed">
<tr>
	<th class="col-md-1"> NO</th>
	<th class="col-md-3"> Nama Pemesan</th>
	<th class="col-md-2"> Total </th>
	<th class="col-md-3"> Bukti </th>
	<th class="col-md-3"> opsi </th>
</tr>
<?php
	$no = 1;
	$sql = mysqli_query($koneksi,"SELECT pembayaran.id_pembayaran, pembayaran.total_harga, pembayaran.bukti, pembayaran.status, member.nama 
	FROM pembayaran INNER JOIN member ON member_id = id_member");
	while($row = mysqli_fetch_assoc($sql)){
	?>	
	<tr>
		<td> <?= $no?> </td>
		<td> <?= $row['nama']?> </td>
		<td> <?= $row['total_harga']?> </td>
		<td>
		<?php
		if($row['bukti'] == NULL){
				echo 'Gambar bukti belum di upload!';
		}else{	
			echo '<a href="picture/'. $row['bukti'] .'">
			<img src="picture/'. $row['bukti'] .'" width="170" height="150"> 
			</a>';
		}
		?>
		</td>
		<td>
			<?php
			if($row['bukti'] != NULL && $row['status'] != NULL){
					echo $row['status'];
			}
			else if($row['bukti'] != NULL && $row['status'] != 'Diterima' && $row['status'] == NULL){
				echo '<a href="konfirmasi.php?id='. $row['id_pembayaran']. '" class="btn btn-success"> Konfirmasi </a>';
			}else if($row['bukti'] == NULL && $row['status'] == NULL){
				echo 'none';
			}
			?>
			
		</td>
	</tr>
	
	
	<?php
	$no++;
	}
	?>
</table>
<?php
	include 'common/footer.php'; 
?>