<title>Menu Kategori</title>
<div id="pagetitle">MENU KATEGORI</div>
<div id="batascontent" class="clearfix">
	<?php if ($udt['admincat_id'] != "1") {} else { ?>
		<div id="tomboltambah">
			<a href="?m=menucat_input" class="addbutton">+ MENU 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>MENU KATEGORI</th>
					<th>MENU</th>
					<th></th>
					<th>ID</th>
				</tr>
			</thead>
			<tbody>
				<?php
					$nomor = 1;
					$db = mysqli_query($koneksi, "SELECT * FROM cmas_menucat ORDER BY menucat_id DESC");
					while($dt  = mysqli_fetch_array($db)) {
					
					if ($dt['menucat_status'] == "Non-Aktif") {
						$menucat_status = "<img src='assets/images/icons/icon_no.png' width='20' title='$dt[menucat_status]'>";
					} else {
						$menucat_status = "<img src='assets/images/icons/icon_yes.png' width='20' title='$dt[menucat_status]'>";
					}
				?>
					<tr>
						<td align="center" width="1%">
							<?php echo $nomor; ?>
						</td>
						<td align="left">
							<a href="?m=menucat_edit&id=<?php echo $dt['menucat_id']; ?>">
								<?php echo $dt["menucat_nama"]; ?>
							</a>
						</td>
						<td>
							<?php
								$bdb = mysqli_query($koneksi, "SELECT COUNT(menu_id) AS JumlahMenu FROM cmas_menu WHERE menucat_id='$dt[menucat_id]'");
								$bdt = mysqli_fetch_array($bdb);
							?>
							<a href="?m=menu_index">
								<?php echo $bdt["JumlahMenu"]; ?> Menu
							</a>
						</td>
						<td align="center" width="8%">
							<a href="?m=menucat_updatestatus&id=<?php echo $dt['menucat_id']; ?>">
								<?php echo $menucat_status; ?>
							</a>
							<a href="?m=menucat_edit&id=<?php echo $dt['menucat_id']; ?>">
								<img src="assets/images/icons/icon_edit.png" width="20" title="Edit Data">
							</a>
							<a href="?m=menucat_hapus&id=<?php echo $dt['menucat_id']; ?>" onclick="return confirm('DATA AKAN DIHAPUS, ANDA YAKIN?');">
								<img src="assets/images/icons/icon_delete.png" width="20" title="Hapus Data">
							</a>
						</td>
						<td align="center" width="1%">
							<?php echo $dt["menucat_id"]; ?>
						</td>
					</tr>
				<?php $nomor++; } ?> 
			</tbody>
		</table>
	</div>
</div>