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

    $sql = mysqli_query($koneksi, "SELECT * FROM t_buku WHERE keterangan != 1 AND jumlah != 0 ORDER BY keterangan");
?>
		<!-- main-slider -->
			<ul id="demo1">
				<li>
					<img src="images/slider1.jpg" alt="" />
					<!--Slider Description example-->
					<div class="slide-desc">
						<h3>Sebagai sumber ilmu</h3>
					</div>
				</li>
				<li>
					<img src="images/slider2.jpg" alt="" />
					  <div class="slide-desc">
						<h3>Meraih prestasi</h3>
					</div>
				</li>
				<li>
					<img src="images/slider3.jpg" alt="" />
					<div class="slide-desc">
						<h3>Sebagai media informasi dari berbagai segi kehidupan</h3>
					</div>
				</li>
			</ul>
		<!-- //main-slider -->
		<!-- breadcrumbs -->
		<div class="breadcrumbs">
			<div class="container">
					<!-- <?php 
						if(isset($_POST['cari'])){
							$cari 	= $_POST['search'];
							$sql 	= mysqli_query($koneksi, "SELECT * FROM t_buku WHERE judul LIKE '%$cari%' ORDER BY isbn");
						}
					?>
				<div class="w3l_search">
					<form action="" method="post">
						<input type="search" name="search" placeholder="Cari Judul Buku" required="">
						<button type="submit" class="btn btn-default search" aria-label="Left Align" name="cari">
							<i class="fa fa-search" aria-hidden="true"> </i>
						</button>
						<div class="clearfix"></div>
					</form>
				</div> -->
			</div>
		</div>
	<!-- //breadcrumbs -->
		<!-- top-brands -->
		<div class="top-brands">
			<div class="container">
			<h2>Penawaran terbaik</h2>
				<div class="grid_3 grid_5">
					<div class="bs-example bs-example-tabs" role="tabpanel" data-example-id="togglable-tabs">
						<ul id="myTab" class="nav nav-tabs" role="tablist">
							<li role="presentation" class="active"><a href="#expeditions" id="expeditions-tab" role="tab" data-toggle="tab" aria-controls="expeditions" aria-expanded="true">Buku terlaris</a></li>
							<li role="presentation"><a href="#tours" role="tab" id="tours-tab" data-toggle="tab" aria-controls="tours">Potongan Harga</a></li>
						</ul>
						<div id="myTabContent" class="tab-content">
							<div role="tabpanel" class="tab-pane fade in active" id="expeditions" aria-labelledby="expeditions-tab">
								<div class="agile-tp">
									<h5>Buku dengan Penjualan Terbaik</h5>
									<p class="w3l-ad">Berikut daftar buku dengan penjualan terbaik dalam bulan ini.</p>
								</div>
								<div class="agile_top_brands_grids">
									<?php
										$sql = mysqli_query($koneksi, "SELECT * FROM t_buku WHERE keterangan = 2 AND jumlah != 0 ORDER BY jumlah ASC LIMIT 6");
										while($data = mysqli_fetch_array($sql)){
									?>
									<div class="col-md-4 top_brand_left">	
										<div class="hover14 column">
											<div class="agile_top_brand_left_grid">
												<div class="agile_top_brand_left_grid_pos">
													<img src="images/offer.png" alt=" " class="img-responsive">
												</div>
												<div class="agile_top_brand_left_grid1">
													<figure>
														<div class="snipcart-item block" >
															<div class="snipcart-thumb">
																<a href="singlebook.php?kd=<?php echo $data['isbn'];?>"><img class="col-md-12" title="Klik Disini" src="<?php echo $data['gambar']; ?>" >
																<h4><?php echo $data['judul']; ?></h4>
																<h4><?php echo $data['pengarang']; ?></h4>
																<h4><?php echo $data['tahun']; ?></h4>
																<h4>Rp.<?php echo number_format($data['harga'],2,",",".");?></h4>
																</a>
															</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'];?>" >
																	<input type="submit" name="simpan" value="Pesan" class="button" /></a>
															</div>
														</div>
													</figure>
												</div>
											</div>
										</div>
										<br>
									</div>
									<?php   
					              		}
					              	?>
									<div class="clearfix"> </div>	
								</div>
							</div>
							<div role="tabpanel" class="tab-pane fade" id="tours" aria-labelledby="tours-tab">
								<div class="agile-tp">
									<h5>Buku dengan Potongan Harga Terbaik</h5>
									<p class="w3l-ad">Berbelanja lebih hemat dengan penawaran harga terbaik.</p>
								</div>
								<div class="agile_top_brands_grids">
									<?php
										$sql = mysqli_query($koneksi, "SELECT * FROM t_buku WHERE keterangan = 3 AND jumlah != 0 ORDER BY harga ASC LIMIT 6");
										while($data = mysqli_fetch_array($sql)){
									?>
									<div class="col-md-4 top_brand_left">
										<div class="hover14 column">
											<div class="agile_top_brand_left_grid">
												<div class="agile_top_brand_left_grid_pos">
													<img src="images/offer.png" alt=" " class="img-responsive">
												</div>
												<div class="agile_top_brand_left_grid1">
													<figure>
														<div class="snipcart-item block" >
															<div class="snipcart-thumb">
																<a href="singlebook.php?kd=<?php echo $data['isbn'];?>"><img class="col-md-12" title="Klik Disini" src="<?php echo $data['gambar']; ?>" >
																<h4><?php echo $data['judul']; ?></h4>
																<h4><?php echo $data['pengarang']; ?></h4>
																<h4><?php echo $data['tahun']; ?></h4>
																<h4>Rp.<?php echo number_format($data['harga'],2,",",".");?></h4>
																</a>
															</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'];?>" >
																<input type="submit" name="simpan" value="Pesan" class="button" /></a>
															</div>
														</div>
													</figure>
												</div>
											</div>
										</div>
										<br>
									</div>
									<?php   
					              		}
					              	?>
									<div class="clearfix"> </div>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	<!-- //top-brands -->
	<!-- new -->
		<div class="newproducts-w3agile">
			<div class="container">
				<h3>Rilis Terbaru</h3>
					<div class="agile_top_brands_grids">
					<?php
						$sql = mysqli_query($koneksi, "SELECT * FROM t_buku WHERE keterangan = 4 AND jumlah != 0 ORDER BY harga ASC LIMIT 4");
						while($data = mysqli_fetch_array($sql)){
					?>
						<div class="col-md-3 top_brand_left-1">
							<div class="hover14 column">
								<div class="agile_top_brand_left_grid">
									<div class="agile_top_brand_left_grid_pos">
										<img src="images/offer.png" alt=" " class="img-responsive">
									</div>
									<div class="agile_top_brand_left_grid_pos">
										<img src="images/offer.png" alt=" " class="img-responsive">
									</div>
									<div class="agile_top_brand_left_grid1">
										<figure>
											<div class="snipcart-item block" >
												<div class="snipcart-thumb">
													<a href="singlebook.php?kd=<?php echo $data['isbn'];?>"><img class="col-md-12" title="Klik Disini" src="<?php echo $data['gambar']; ?>" >
													<h4><?php echo $data['judul']; ?></h4>
													<h4><?php echo $data['pengarang']; ?></h4>
													<h4><?php echo $data['tahun']; ?></h4>
													<h4>Rp.<?php echo number_format($data['harga'],2,",",".");?></h4>
													</a>
												</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'];?>" />
													<input type="submit" name="simpan" value="Pesan" class="button" ></a>
												</div>
											</div>
										</figure>
									</div>
								</div>
							</div>
						</div>
						<?php   
					   		}
				      	?>
							<div class="clearfix"> </div>
					</div>
			</div>
		</div>
	<!-- //new -->
	
<?php
	include 'footer.php';
?>