<?php
	require_once("koneksi.php");
    include 'header.php';
?>

	<!-- breadcrumbs -->
		<div class="breadcrumbs">
			<div class="container">
				<ol class="breadcrumb breadcrumb1 animated wow slideInLeft" data-wow-delay=".5s">
					<?php
	                if (isset($_SESSION['pengunjung'])) {
					    echo '
						<li><span><i class="fa fa-sign-in" aria-hidden="true"></i><a href="login.php"> Masuk</a></span></li>
						<li class="active">Informasi Buku</li> ';
					}
					else {
						echo '
						<li><a href="index.php"><span class="glyphicon glyphicon-home" aria-hidden="true"></span>Beranda</a></li>
						<li class="active">Informasi Buku</li> ';
					}
				?>
				</ol>
			</div>
		</div>
	<!-- //breadcrumbs -->
		<div class="products">
			<div class="container">
				<div class="agileinfo_single">
					<?php                  
						$query = mysqli_query($koneksi, "SELECT * FROM t_buku, t_kategori, t_penerbit WHERE isbn = '$_GET[kd]'");
						$data  = mysqli_fetch_array($query);
					?>
					<div class="col-md-2 agileinfo_single_left">
						<img src="<?php echo $data['gambar']; ?>"  class="img-responsive" />
					</div>
					<div class="col-md-5 agileinfo_single_right">
						Judul Buku		: <h3><?php echo $data['judul']; ?></h3><br>
						Nama Penagarang	: <h3><?php echo $data['pengarang']; ?></h3><br>
						Kategori Buku 	: <h3><?php echo $data['nama_kategori']; ?></h3><br>
						Penerbit Buku 	: <h3><?php echo $data['nama_penerbit']; ?></h3><br>
						Tahun Terbit	: <h3><?php echo $data['tahun']; ?></h3>
					</div>
					<div class="col-md-5 agileinfo_single_right">
						<br><br><br><br><br>
						<div class="snipcart-item block">
							<div class="snipcart-thumb agileinfo_single_right_snipcart">
								<h3><?php 
										if ($data['jumlah'] >= 1) {
			                           		echo '<strong style="color: blue;">Buku Tersedia</strong>';	
		                                }
		                                else {
			                           		echo '<strong style="color: red;">Buku Telah Habis Terjual</strong>';	
		                                }; 
		                            ?>
		                    	</h3>
							</div>
							<div class="snipcart-thumb agileinfo_single_right_snipcart">
								<h3 class="m-sing">Rp.<?php echo number_format($data['harga'],2,",",".");?></h3>
							</div>
							<div class="snipcart-details top_brand_home_details">
								<a href="function.php?act=add&amp;barang_id=<?php echo $data['isbn']; ?>&amp;ref=checkout.php?kd=<?php echo $data['isbn'];?>" >
								<?php if ($data['jumlah'] >= 1) {
									echo '<input type="submit" name="simpan" value="Tambah" class="button" />';
								} ?>
								</a>
							</div>
						</div>
					</div>
					<div class="clearfix"> </div>
				</div>
			</div>
		</div>
	
<?php
	include 'footer.php';
?>