-
Notifications
You must be signed in to change notification settings - Fork 0
/
insert-pet.php
186 lines (170 loc) · 6.82 KB
/
insert-pet.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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
<?php require 'Classes.php'; ?>
<!doctype html>
<html lang="pt-br">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" href="../../../../favicon.ico">
<title>Pet Monitor - Cadastro de pet</title>
<!-- Bootstrap core CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="signin.css" rel="stylesheet">
<!-- Custom styles for this template -->
<link href="dashboard.css" rel="stylesheet">
</head>
<?php
if(empty($_SESSION["userAtual"])){
echo '<script type="text/javascript">';
echo 'alert("Usuario não logado.");';
echo 'window.location = "sign-up.html";';
echo '</script>';
}
$user = unserialize($_SESSION["userAtual"]); ?>
<body>
<nav class="navbar navbar-dark fixed-top bg-dark flex-md-nowrap p-0 shadow">
<a class="navbar-brand col-sm-3 col-md-2 mr-0" href="#"><?php echo $user->Nome; ?></a>
<ul class="navbar-nav px-3">
<li class="nav-item text-nowrap">
<a class="nav-link" href="logout.php">Sair</a>
</li>
</ul>
</nav>
<div class="container-fluid">
<div class="row">
<nav class="col-md-2 d-none d-md-block bg-light sidebar">
<div class="sidebar-sticky">
<ul class="nav flex-column">
<li class="nav-item">
<a class="nav-link active" href="dashboard.php">
<span data-feather="home"></span>
Dashboard <span class="sr-only">(current)</span>
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="insert-pet.php">
<span data-feather="plus"></span>
Cadastrar Pet
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="insert-rastreador.php">
<span data-feather="plus"></span>
Cadastrar Rastreador
</a>
</li>
</ul>
</div>
</nav>
<main role="main" class="col-md-9 ml-sm-auto col-lg-10 px-4">
<div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
<h1 class="h2">Dados do seu pet</h1>
<div class="btn-toolbar mb-2 mb-md-0">
</div>
</div>
<form class="form-insert" method="POST" action="cadastrarPet.php">
<div class="form-group">
<label for="inputName">Nome</label>
<input type="text" name="inputNome" id="inputName" class="form-control" placeholder="Insira o nome do seu pet" required autofocus>
</div>
<div class="form-group">
<label for="inputName">Tipo</label>
<div class="form-group">
<select class="form-control" id="exampleFormControlSelect1" name="inputTipo">
<option>Escolha o tipo do seu pet</option>
<option>Cachorro</option>
<option>Gato</option>
<option>Pássaro</option>
<option>Outro</option>
</select>
</div>
</div>
<div class="form-group">
<label for="inputName" class="">Sexo</label>
<select class="form-control" id="exampleFormControlSelect1" required="required" name="inputSexo">
<option>Escolha o sexo do seu pet</option>
<option value="M">Macho</option>
<option value="F">Fêmea</option>
</select>
</div>
<div class="form-group">
<label for="inputName">Data de Nascimento</label>
<input type="date" id="inputName" name="inputNascimento" class="form-control" placeholder="Insira a data de nascimento" required>
</div>
<button class="btn btn-lg btn-primary btn-block" type="submit">Cadastrar</button>
</form>
</main>
</div>
<div class="row">
<div class="col-md-9 ml-sm-auto col-lg-10 px-4">
<?php
$user = unserialize($_SESSION["userAtual"]);
$p1 = new Pet();
$pets = $p1->ListarPets($user);
if(count($pets) > 0){
?>
<table class="table table-dark">
<thead>
<td>
<b>Nome</b>
</td>
<td>
<b>Tipo</b>
</td>
<td>
<b>Data de Nascimento</b>
</td>
<td>
<b>Sexo</b>
</td>
<th>
<b>Monitorar Pet</b>
</th>
</thead>
<?php foreach($pets as $pet){ ?>
<tr>
<td>
<?php echo $pet->Nome; ?>
</td>
<td>
<?php echo $pet->Tipo; ?>
</td>
<td>
<?php echo $pet->DataNascimento; ?>
</td>
<td>
<?php echo $pet->Sexo; ?>
</td>
<td>
<form action="abrePetMapa.php" method="post">
<input type="hidden" name="inputIdPet" value="<?php echo $pet->IdPet; ?>"/>
<input type="submit" class="btn btn-ligh" value="Monitorar"/>
<?php $_SESSION["Pet".$pet->IdPet] = serialize($pet); ?>
</form>
</td>
</tr>
<?php } ?>
</table>
<?php
}else{
echo '<p><b style="color:#C9FF24;">Você não possui Pets cadastrados.</b></p>';
}
?>
</div>
</div>
</div>
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script>window.jQuery || document.write('<script src="../../assets/js/vendor/jquery-slim.min.js"><\/script>')</script>
<script src="js/popper.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<!-- Icons -->
<script src="https://unpkg.com/feather-icons/dist/feather.min.js"></script>
<script>
feather.replace()
</script>
</body>
</html>