<?php 
session_start();
if(!isset($_SESSION['idUsuario'])){
	header("location:../");
}
include_once '../conexao/index.php';

$_SESSION['idUsuario'] = $_SESSION['idUsuario'];
$_SESSION['nomeUsuario'] = $_SESSION['nomeUsuario'];
$_SESSION['categoriaUsuario'] = $_SESSION['categoriaUsuario']; 

?>
<!DOCTYPE html>
<html>
<head>
	<title></title>
	<meta charset="utf-8">
	<meta name="viewport" content="width-device-width, initial-scale=1">
	<link rel="shorcut icon"  href="../../../img/config/ios7-cart.png">
	<link rel="stylesheet" type="text/css" href="../../../css/administracao.css">
	<link rel="stylesheet" type="text/css" href="../../../css/jquery-ui.min.css">
	<link rel="stylesheet" type="text/css" href="../../../css/jquery-ui.css">
	<script type="text/javascript" src="../../../js/jquery-3.3.1.min.js"></script>
	<script type="text/javascript" src="../../../js/jquery-ui.min.js"></script>
	<script type="text/javascript" src="../../../js/jquery-ui.js"></script>
	<script type="text/javascript" src="../../../js/funcoesAdministracao.js"></script>
	<script type="text/javascript" src="../../../js/configuracoesAdministracao.js"></script>
</head>
<body>
<div class="geralHeader">
	<div class="box grupo-head">
		<p class="p">Cadastro de Produtos</p>
		<p><img src="../img/config/ios7-pricetags-outline.png"></p>
	</div>
	<div class="box grupo-inputs">
		<p><span>Cod</span><span><input type="text" id="cod" placeholder="BNA"></span></p>
		<p><span>Nome</span><span><input type="text" id="nome" placeholder="Banana"></span></p>
		<p><span>Stock</span><span><input type="number" id="stock" placeholder="50"></span></p>
		<p><span>Preco</span><span><input type="number" id="preco" placeholder="500"></span></p>
		<p><span>Imagem</span><span><input type="text" id="img" placeholder="milagre.png"></span></p>
	</div>
	<div class="box">
		<div class="btns">
			<button type="reset">
				Limpar
			</button>
			<button id="addEmpresa">
				Enviar
			</button>
		</div>
	</div>
	<div class="box table">
		<div class="look">
			<p>
				<span>Numero de registros</span>
				<span>
					<select id="numeroRegistros">
						<option value="5">5</option>
						<option value="10">10</option>
						<option value="20">20</option>
						<option value="50">50</option>
					</select>
				</span>
			</p>
			<p><input type="text" id="look" placeholder="Procurar"></p>
		</div>
		<div class="tabela">
			<table>
				<thead>
					<th>#</th>
					<th>Cod</th>
					<th>Nome</th>
					<th>Stock</th>
					<th>Preco</th>
					<th>Imagem</th>
				</thead>
				<tbody>
					<tr>
						<td>1</td>
						<td>BNA</td>
						<td>Bananas</td>
						<td>50</td>
						<td>20.00</td>
						<td>banana.png</td>
					</tr>
					<tr>
						<td>2</td>
						<td>LRA</td>
						<td>Laranja</td>
						<td>50</td>
						<td>80.00</td>
						<td>laranja.png</td>
					</tr>
					<tr>
						<td>3</td>
						<td>TMT</td>
						<td>Tomate</td>
						<td>50</td>
						<td>40.00</td>
						<td>tomate.png</td>
					</tr>
				</tbody>
			</table>
		</div>
	</div>
	<script type="text/javascript">
		$(function() {
			$("table tbody tr td").on('dblclick', function() {
				if ($('td > input').length > 0) {
					return;
				}
				var conteudoOriginal = $(this).text();
				var novoElemento = $('<input/>', {type: 'text', value:conteudoOriginal});
				$(this).html(novoElemento.bind('blur keydown', function(e) {
					var keyCode = e.which;
					if (keyCode == 13) {
						var conteudoNovo = $(this).val();
						if (conteudoNovo != "") {
							$(this).parent().html(conteudoNovo);
						}
					}
					if (e.type == "blur") {
						$(this).parent().html(conteudoOriginal);
					}
				}));
				$(this).children().select();
			});
		});
	</script>
</div>
</body>
</html>