<title>Input Tag</title>
<div id="pagetitle">INPUT TAG</div>
<div id="batascontent">
	<form action="?m=bustag_simpan" method="post" enctype="multipart/form-data">
		<?php
			$udb = mysqli_query($koneksi, "SELECT * FROM cmas_admin WHERE admin_username='$admin_username'");
			$udt = mysqli_fetch_array($udb);
		?>
		<input name="posted_id" type="hidden" value="<?php echo $udt['admin_id']; ?>">
		
		<?php
			$id = mysqli_real_escape_string($koneksi, $_GET['id']);
			$db = mysqli_query($koneksi, "SELECT * FROM cmas_bus WHERE bus_id='$id'");
			$dt = mysqli_fetch_array($db);
		?>
		<input name="bus_id" type="hidden" value="<?php echo $dt['bus_id']; ?>">
		
		<div id="wrapgsetting" class="clearfix">
			<div id="gsettingleft">
				<div id="gsetting" class="clearfix">
					<div id="gsettinglabel">Input Tags</div>
					<div id="gsettingedit">
						<input name="bustag_title" list="tags" type="text" placeholder="Masukkan Article Tag / Kata Kunci" autocomplete="off" required />
						<datalist id="tags">
							<?php
								$codb = mysqli_query($koneksi, "SELECT * FROM cmas_bustag ORDER BY bustag_id DESC");
								while($codt = mysqli_fetch_array($codb)) {
							?>
								<option value="<?php echo $codt['bustag_title']; ?>">
							<?php } ?>
						</datalist>
					</div>
				</div>
				
				<div id="gsetting" class="clearfix" >
					<div id="gsettinglabel">Tags</div>
					<div id="gsettinginput">
						<div id="tagsbot" class="clearfix">
							<?php
								$tgdb = mysqli_query($koneksi, "SELECT * FROM cmas_bustag WHERE bus_id='$dt[bus_id]' ORDER BY bustag_id DESC");
								$find = mysqli_num_rows($tgdb);
								
								if ($find == 0) {
									echo "No Tag";
								} else {
									while($tgdt = mysqli_fetch_array($tgdb)) {
							?>
									<div id="tagsrows" class="clearfix">
										<div id="tagsleft">
											<a href="?m=bustag_hapus&id=<?php echo $tgdt['bustag_id']; ?>" onclick="return confirm('DATA AKAN DIHAPUS, ANDA YAKIN?');" class="erasetags">
												<?php echo $tgdt['bustag_title']; ?>
											</a>
										</div>
										<div id="tagsrite">
											<a href="?m=bustag_hapus&id=<?php echo $tgdt['bustag_id']; ?>" onclick="return confirm('DATA AKAN DIHAPUS, ANDA YAKIN?');" class="erasetags">x</a>
										</div>
									</div>
								<?php } ?>
							<?php } ?>
						</div>
					</div>
				</div>
			</div>
			<div id="gsettingrite">
				<div id="gsetting" class="clearfix">
					<div id="gsettinginputfull">
						<input name="bus_nama" type="hidden" value="<?php echo $dt['bus_nama']; ?>"><?php echo $dt['bus_nama']; ?>
					</div>
				</div>
			</div>
		</div>
		<div id="tombolsubmit">
			<a href="?m=bus_index"><input name="button" type="button" value="KEMBALI" class="myButton"/></a>
			<input name="submit" type="submit" value="SIMPAN" class="submitbutton" />
		</div>
	</form>
	<div id="infobottom" class="clearfix">
		<div class="infobottomleft">
			Posted by <b><?php echo $dt['posted_nama']; ?></b> on <b><?php echo date_format(date_create($dt['postdated']), 'd/m/Y H:i:s'); ?></b>
		</div>
		<div class="infobottomrite">
			Updated by <b><?php echo $dt['updated_nama']; ?></b> on <b><?php echo date_format(date_create($dt['updated']), 'd/m/Y H:i:s'); ?></b>
		</div>
	</div>
</div>
