<title>Bus Type</title>
<div id="pagetitle">BUS TYPE</div>
<div id="bataspadding">
	<div id="tomboltambah">
		<a href="?m=bustype_input" class="addbutton">+ BUS TYPE</a>
	</div>
	<div id="tableres">
		<table width="100%" cellpadding="0" cellspacing="0" border="0" class="display" id="example">
			<thead>
				<tr>
					<th>NO</th>
					<th>BUS TYPE</th>
					<th>TUJUAN</th>
					<th></th>
				</tr>
			</thead>
			<tbody>
				<?php
					$nomor = 1;
					$db = mysqli_query($koneksi, "SELECT * FROM cmas_bustype ORDER BY bustype_id ASC");
					while($dt = mysqli_fetch_array($db)) {
					
					if ($dt['bustype_status'] == "Non-Aktif") {
						$bustype_status = "<img src='assets/images/icons/icon_no.png' width='20' alt='$dt[bustype_status]' title='$dt[bustype_status]'>";
					} else {
						$bustype_status = "<img src='assets/images/icons/icon_yes.png' width='20' alt='$dt[bustype_status]' title='$dt[bustype_status]'>";
					}
				?>
					<tr>
						<td align="center" width="1%">
							<?php echo $nomor; ?>
						</td>
						<td>
							<a href="?m=bustype_edit&id=<?php echo $dt['bustype_id']; ?>">
								<?php echo $dt["bustype_nama"]; ?>
							</a>
						</td>
						<td align="center">
							<a href="?m=tujuan_indexkat&id=<?php echo $dt['bustype_id']; ?>">
							<?php
								$tudb = mysqli_query($koneksi, "SELECT COUNT(bustype_id) AS JumlahTujuan FROM cmas_tujuan WHERE bustype_id='$dt[bustype_id]'");
								$tudt = mysqli_fetch_array($tudb);
								echo $tudt['JumlahTujuan'];
								echo " Tujuan";
							?>
							</a>
						</td>
						<td align="center" width="9%">
							<a href="?m=bustype_updatestatus&id=<?php echo $dt['bustype_id']; ?>">
								<?php echo $bustype_status; ?>
							</a>
							<a href="?m=bustype_edit&id=<?php echo $dt['bustype_id']; ?>">
								<img src="assets/images/icons/icon_edit.png" width="20">
							</a>
							<a href="?m=bustype_hapus&id=<?php echo $dt['bustype_id']; ?>" onclick="return confirm('DATA AKAN DIHAPUS, ANDA YAKIN?');">
								<img src="assets/images/icons/icon_delete.png" width="20">
							</a>
						</td>
					</tr>
				<?php $nomor++; } ?> 
			</tbody>
		</table>
	</div>
</div>