<div id="bgbusdetails">
	<div id="bobusdetails" class="clearfix">
		
		<div id="bgbreadcumb">
			<div id="bobreadcumb">
				<div class="bobreadcumbtit">
					<?php
						date_default_timezone_set("Asia/Jakarta");
						include "../libs/functiondb.php";
						
						$id = mysqli_real_escape_string($koneksi, $_GET['id']);
						$bodb = mysqli_query($koneksi, "SELECT * FROM cmas_bus WHERE bus_id='$id'");
						$bodt = mysqli_fetch_array($bodb);
					?>
					<a href="./">Beranda</a> &nbsp;&#10095;&nbsp; <a href="sewa-bus-pariwisata">Sewa Bus</a> &nbsp;&#10095;&nbsp; <?php echo $bodt['bus_nama']; ?>
				</div>
			</div>
		</div>
		
		<?php 
			$id = mysqli_real_escape_string($koneksi, $_GET['id']);
			$bodb = mysqli_query($koneksi, "SELECT * FROM cmas_bus WHERE bus_id='$id'");
			$bodt = mysqli_fetch_array($bodb);
			$bus_id = $bodt['bus_id'];
			
			$loghits_ip		= $_SERVER['REMOTE_ADDR'];
			$loghits_date	= date("Y-m-d H:i:s");
			$loghits_agent	= $_SERVER['HTTP_USER_AGENT'];
			
			$khdb = mysqli_query($koneksi, "SELECT * FROM cmas_loghits WHERE loghits_ip='$loghits_ip' AND contentid='$bus_id'");
			$find = mysqli_num_rows($khdb);
			
			if ($find == 0) {
				mysqli_query($koneksi, "INSERT INTO cmas_loghits (loghits_id, loghits_ip, loghits_hits, loghits_date, loghits_agent, contentid, contenttitle) VALUES(NULL, '$loghits_ip', '1', '$loghits_date', '$loghits_agent', '$bodt[bus_id]', '$bodt[bus_nama]')");
			} else {
				mysqli_query($koneksi, "UPDATE cmas_loghits SET loghits_hits = loghits_hits+1, loghits_date = '$loghits_date', loghits_agent='$loghits_agent' WHERE loghits_ip='$loghits_ip' AND contentid='$bodt[bus_id]'");
			}
			
			$mdb = mysqli_query($koneksi, "SELECT * FROM cmas_metadata");
			$mdt = mysqli_fetch_array($mdb);
			
			if ($bodt['bus_imageid'] == 0) {
		?>
			<div id="busdetailsfull">
				<div class="busdetailstit">
					<h1><?php echo $bodt['bus_nama']; ?></h1>
				</div>
				<div class="busdetailsdes">
					<?php echo $bodt['bus_desc']; ?>
				</div>
				<div class="busdetailssos">
					<div class="<?php echo $mdt['metadata_addthisclass']; ?>"></div>
				</div>
			</div>
		<?php } else { ?>
			<div id="busdetailsleft">
				<div class="busdetailsimg">
					<img src="assets/images/bus/<?php echo $bodt['bus_image']; ?>" alt="<?php echo $bodt['bus_nama']; ?>" title="<?php echo $bodt['bus_nama']; ?>">
				</div>
				<?php 
					include "../libs/functiongaleri.php";
					$gdb = mysqli_query($koneksi, "SELECT * FROM cmas_busimg WHERE bus_id='$bus_id'");
					$find = mysqli_num_rows($gdb);
					
					if ($find == 0) {} else {
				?>
					<div id="busdetailsgal" class="clearfix">
						<?php while($gdt = mysqli_fetch_array($gdb)) { ?>
							<div id="busdetailsgalbox">
								<div class="busdetailsgalimg">
									<a class="fancybox" href="assets/images/bus/add/<?php echo $gdt['busimg_image']; ?>" title="<?php echo $gdt['busimg_judul']; ?>" data-fancybox-group="gallery">
										<img src="assets/images/bus/add/<?php echo $gdt['busimg_image']; ?>">
									</a>
								</div>
							</div>
						<?php } ?>
					</div>
				<?php } ?>
			</div>
			
			<div id="busdetailsrite">
				<div class="busdetailsdes">
					<?php echo $bodt['bus_model']; ?>
				</div>
				<div class="busdetailstit">
					<h1><?php echo $bodt['bus_nama']; ?></h1>
				</div>
				<div class="busdetailsdes">
					<?php echo $bodt['bus_desc']; ?>
				</div>
				<div class="busdetailssos">
					<div class="<?php echo $mdt['metadata_addthisclass']; ?>"></div>
				</div>
				<div id="busdetailsfot">
					<?php
						$budb = mysqli_query($koneksi, "SELECT * FROM cmas_banner WHERE banner_id='110'");
						$budt = mysqli_fetch_array($budb);
					?>
					<div class="busdetailstex">
						<?php echo $budt['banner_deskripsi']; ?>
					</div>
					<div class="busdetailsbtn">
						<a href="https://api.whatsapp.com/send?phone=<?php echo $budt['banner_url']; ?>&text=<?php echo $budt['banner_desk']; ?> <?php echo $bodt['bus_nama']; ?> <?php echo $bodt['bus_seat']; ?>" target="_blank" title="">
							<?php echo $budt['banner_keterangan']; ?>
						</a>
					</div>
				</div>
			</div>
		
		<?php } ?>
	</div>
</div>