<?php
require 'verifica_cookie.php';
require 'conexao.php';

$mesa    = (isset($_GET['mesa'])) ? $_GET['mesa'] : '' ;
$comanda = (isset($_GET['comanda'])) ? $_GET['comanda'] : '' ;
$cliente = (isset($_GET['cliente'])) ? $_GET['cliente'] : '' ;
$pdo  = Conexao::getInstance();

$sql = "SELECT cat_001, cat_002 FROM categoria WHERE sit_001 = 4";
$stm = $pdo->prepare($sql);
$stm->execute();
$categorias = $stm->fetchAll(PDO::FETCH_OBJ);

?>
<!DOCTYPE html>
<html>
<head>
	<title>Comanda Eletrônica</title>
	<?php require 'include/head.php'; ?>
</head>
<body>
	<div class="mdl-layout mdl-js-layout mdl-layout--fixed-header">
	  
	  <?php require 'include/menu.php'; ?>

	  <div class="mdl-grid">
	  	<div class="mdl-cell mdl-cell--6-col mdl-cell--12-col-phone">
	  		<h4>Categorias</h4>
	  		<?php foreach($categorias as $categoria):?>
				<div class="mdl-card mdl-shadow--4dp categoria">
				   <div class="mdl-card__title">
				    <h4 class="mdl-card__supporting-text"><?= strtoupper($categoria->cat_002) ?></h4>
				    <a href="produto.php?categoria=<?=strtoupper($categoria->cat_001)?>&mesa=<?=$mesa?>&comanda=<?=$comanda?>&cliente=<?=$cliente?>"><i class="material-icons">play_circle_filled</i></a>
				  </div>
				</div><br>
			<?php endforeach;?>
		</div>
	  </div>
	</div>
</body>
</html>
