<title>Input Bus Image</title>
<div id="pagetitle">INPUT BUS IMAGE</div>
<div id="batascontent" class="clearfix">
	<form action="?m=busimg_simpan" method="post" enctype="multipart/form-data">
		<?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="gsetting" class="clearfix">
				<div id="gsettinglabel">Judul Bus</div>
				<div id="gsettinginput">
					<input name="bus_nama" type="hidden" value="<?php echo $dt['bus_nama']; ?>"><?php echo $dt['bus_nama']; ?>
				</div>
			</div>
			<div id="gsetting" class="clearfix">
				<div id="gsettinglabel">Judul Image</div>
				<div id="gsettingedit">
					<input name="busimg_judul" type="text" required />
				</div>
			</div>
			<div id="gsetting" class="clearfix">
				<div id="gsettinglabel">Upload Image</div>
				<div id="gsettinginput">
					<input name="busimg_image" type="file" required />
				</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="UPLOAD" class="submitbutton"/> 
		</div>
	</form>
	
	<br>
	
	<div id="wrapgsetting" class="clearfix">
		<div id="gsettingtitle">GALERI BUS <?php echo $dt['bus_nama']; ?></div>
		<div id="gsetting" class="clearfix">
			<div id="gsettingfull">
				<table width="100%" cellpadding="0" cellspacing="0" border="0" class="display" id="example">
					<thead>
						<tr align="left">
							<th>NO</th>
							<th></th>
							<th>JUDUL IMAGE</th>
							<th>UPLOAD ON</th>
							<th></th>
						</tr>
					</thead>
					<tbody>
						<?php
							$nomor = 1;
							$idb = mysqli_query($koneksi, "SELECT * FROM cmas_busimg WHERE bus_id='$dt[bus_id]' ORDER BY busimg_id DESC");
							while($idt = mysqli_fetch_array($idb)) {
						?>
							<tr>
								<td align="center" width="1%">
									<?php echo $nomor; ?>
								</td>
								<td align="center" width="1%">
									<img src="assets/images/bus/add/<?php echo $idt['busimg_image']; ?>" width="100">
								</td>
								<td>
									<?php echo $idt['busimg_judul']; ?>
								</td>
								<td>
									<?php echo date_format(date_create($idt['postdated']), 'd/m/Y H:i:s'); ?>
								</td>
								<td align="center" width="10%">
									<a href="?m=busimg_hapus&id=<?php echo $idt['busimg_id']; ?>" onclick="return confirm('DATA AKAN DIHAPUS, ANDA YAKIN?');">
										<img src="assets/images/icons/icon_delete.png" width="20" title="Hapus Data">
									</a>
								</td>
							</tr>
						<?php $nomor++; } ?>
					</tbody>
				</table>
			</div>
		</div>
	</div>	
	<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>
