-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprodutos-criar.php
48 lines (46 loc) · 1.86 KB
/
produtos-criar.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php require_once 'global.php';?>
<?php
try {
$listaCategoria = Categoria::listar();
} catch (Exception $e) {
Erro::trataErro($e);
}
?>
<?php require_once 'cabecalho.php' ?>
<div class="row">
<div class="col-md-12">
<h2>Criar Nova Produto</h2>
</div>
</div>
<?php if (count($listaCategoria) > 0): ?>
<form action="produtos-criar-post.php" method="post">
<div class="row">
<div class="col-md-6 col-md-offset-3">
<div class="form-group">
<label for="nome">Nome do Produto</label>
<input type="text" name="nome" class="form-control" placeholder="Nome do Produto" required>
</div>
<div class="form-group">
<label for="preco">Preço da Produto</label>
<input type="number" name="preco" step="0.01" min="0" class="form-control" placeholder="Preço do Produto" required>
</div>
<div class="form-group">
<label for="quantidade">Quantidade do Produto</label>
<input type="number" name="quantidade" min="0" class="form-control" placeholder="Quantidade do Produto" required>
</div>
<div class="form-group">
<label for="nome">Categoria do Produto</label>
<select class="form-control" name="categoria_id" >
<?php foreach($listaCategoria as $linha):?>
<option value="<?php echo $linha['id']?>"><?php echo $linha['nome']?></option>
<?php endforeach ?>
</select>
</div>
<input type="submit" class="btn btn-success btn-block" value="Salvar">
</div>
</div>
</form>
<?php else: ?>
<p>Nenhuma categoria cadastrada no sistema. Por favor, crie uma categoria antes de cadastrar um produto.</p>
<?php endif ?>
<?php require_once 'rodape.php' ?>