-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcliente_view.php
103 lines (97 loc) · 5.74 KB
/
cliente_view.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
<?php
$clientes = $_REQUEST['clientes'];
?>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no">
<title>construtora</title>
<link rel="stylesheet" href="../assets/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:400,500,700">
<link rel="stylesheet" href="../assets/css/styles.min.css">
</head>
<body style="background-color: rgb(110,126,142);">
<?php
$page=2;
require_once '../View/menu.php';
require_once '../View/alerta.php';
?>
<div class="row">
<div class="col">
<h1 class="text-center text-light" style="margin-top: 44px;margin-bottom: 36px;">Clientes</h1>
</div>
</div>
<div class="contact-clean">
<form method="POST" action="ClienteController.php">
<h2 class="text-center">Cadastrar Clientes</h2>
<div class="form-group"><input class="form-control" type="text" name="nome" placeholder="Nome" required></div>
<div class="form-group">Data de nascimento<input class="form-control" type="date" name="dt_nasc" placeholder="dd/mm/aaaa" autocomplete="off" required></div>
<div class="form-group"><input class="form-control" type="text" name="end_cli" placeholder="Endereço Cliente" required></div>
<div class="form-group text-center">
<p class="text-center" style="font-size: 20px;font-weight: bold;font-style: normal;">Sexo</p>
<div class="form-check form-check-inline"><input class="form-check-input" name="sexo" type="radio" id="formCheck-3" value="M" required><label class="form-check-label" for="formCheck-3">Masculino</label></div>
<div class="form-check form-check-inline"><input class="form-check-input" name="sexo" type="radio" id="formCheck-4" value="F" required><label class="form-check-label" for="formCheck-4">Feminino</label></div>
</div>
<div class="form-group"><input class="form-control" type="text" name="end_ent" placeholder="Endereço Entrega" required></div>
<div class="form-group"><button class="btn btn-primary btn-block" type="submit" name="cadastrar">Cadastrar</button></div>
</form>
</div>
<div class="row">
<div class="col-xl-10 offset-xl-1">
<div class="table-responsive table-borderless table-hover table-primary">
<table class="table table-bordered">
<thead>
<tr id="darker">
<th>Nome</th>
<th>Data de Nascimento</th>
<th>Sexo</th>
<th>Endereço Cliente</th>
<th>Endereço Entrega</th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<?php
if(isset($clientes)){
$clientes = array_reverse($clientes);
$count = count($clientes) - 1;
foreach($clientes as $cliente){
echo "<tr>";
echo "<form action='ClienteController.php' method='POST'>";
echo "<td><input type='text' class='form-control' name='nome' value='{$cliente[0]}'></td>";
echo "<td><input type='date' class='form-control' name='dt_nasc' value='{$cliente[1]}'></td>";
echo "<td class='text-center'>";
if($cliente[2] == "M"){
echo "<select class='form-control' name='sexo'><optgroup label='Sexo'><option value='M'>Masculino</option><option value='F'>Feminino</option></optgroup></select>";
}else if($cliente[2] == "F"){
echo "<select class='form-control' name='sexo'><optgroup label='Sexo'><option value='M' selected>Masculino</option><option value='F' selected>Feminino</option></optgroup></select>";
}
echo "</td>";
echo "<td><input type='text' class='form-control' name='end_cli' value='{$cliente[3]}'></td>";
echo "<td><input type='text' class='form-control' name='end_ent' value='{$cliente[4]}'></td>";
echo "<input name='id' value='{$count}' hidden>";
echo "<td><button class='btn btn-success' type='submit' name='atualizar' style='width:100'>Editar</button></td>";
echo "<td><button class='btn btn-danger' type='submit' name='apagar' style='width:100'>Remover</button></td>";
echo "</form>";
echo "</tr>";
$count --;
}
}
?>
</tbody>
</table>
</div>
</div>
</div>
<script src="../assets/js/jquery.min.js"></script>
<script src="../assets/bootstrap/js/bootstrap.min.js"></script>
<?php
if(isset($mensagem)){
echo "<script>$('.alert').show().delay(1500).fadeOut(400);</script>";
unset($mensagem);
unset($_SESSION['mensagem']);
}
?>
</body>
</html>