<title>Banner Kategori</title>
<div id="pagetitle">BANNER KATEGORI</div>
<div id="batascontent" class="clearfix">
	<?php if ($udt['admincat_id'] != "1") {} else { ?>
		<div id="tomboltambah">
			<a href="?m=bannerkat_input" class="addbutton">+ BANNER KATEGORI</a>
		</div>
	<?php } ?>
	<div id="tableres">
		<table width="100%" cellpadding="0" cellspacing="0" border="0" class="display" id="example">
			<thead>
				<tr align="left">
					<th>NO</th>
					<th>BANNER KATEGORI</th>
					<th>BANNER</th>
					<th></th>
					<th>ID</th>
				</tr>
			</thead>
			<tbody>
				<?php
					$nomor = 1;
					$db = mysqli_query($koneksi, "SELECT * FROM cmas_bannerkat ORDER BY bannerkat_id DESC");
					while($dt = mysqli_fetch_array($db)) {
					
					if ($dt['bannerkat_status'] == "Non-Aktif") {
						$bannerkat_status = "<img src='assets/images/icons/icon_no.png' width='20' title='$dt[bannerkat_status]'>";
					} else {
						$bannerkat_status = "<img src='assets/images/icons/icon_yes.png' width='20' title='$dt[bannerkat_status]'>";
					}
				?>
					<tr>
						<td align="center" width="1%">
							<?php echo $nomor; ?>
						</td>
						<td>
							<a href="?m=bannerkat_edit&id=<?php echo $dt['bannerkat_id']; ?>">
								<?php echo $dt["bannerkat_nama"]; ?>
							</a>
						</td>
						<td>
							<?php
								$bdb = mysqli_query($koneksi, "SELECT COUNT(banner_id) AS JumlahBanner FROM cmas_banner WHERE bannerkat_id='$dt[bannerkat_id]'");
								$bdt = mysqli_fetch_array($bdb);
							?>
							<a href="?m=banner_index">
								<?php echo $bdt["JumlahBanner"]; ?> Banner
							</a>
						</td>
						<?php if ($udt['admincat_id'] == "1") { ?>
							<td align="center" width="8%">
								<a href="?m=bannerkat_updatestatus&id=<?php echo $dt['bannerkat_id']; ?>">
									<?php echo $bannerkat_status; ?>
								</a>
								<a href="?m=bannerkat_edit&id=<?php echo $dt['bannerkat_id']; ?>">
									<img src="assets/images/icons/icon_edit.png" width="20" title="Edit Data">
								</a>
								<a href="?m=bannerkat_hapus&id=<?php echo $dt['bannerkat_id']; ?>" onclick="return confirm('DATA AKAN DIHAPUS, ANDA YAKIN?');">
									<img src="assets/images/icons/icon_delete.png" width="20" title="Hapus Data">
								</a>
							</td>
						<?php } else { ?>
							<td align="center" width="5%">
								<a href="?m=bannerkat_updatestatus&id=<?php echo $dt['bannerkat_id']; ?>">
									<?php echo $bannerkat_status; ?>
								</a>
								<a href="?m=bannerkat_edit&id=<?php echo $dt['bannerkat_id']; ?>">
									<img src="assets/images/icons/icon_edit.png" width="20" title="Edit Data">
								</a>
							</td>
						<?php } ?>
						<td align="center" width="1%">
							<?php echo $dt['bannerkat_id']; ?>
						</td>
					</tr>
				<?php $nomor++; } ?> 
			</tbody>
		</table>
	</div>
</div>


