-
Notifications
You must be signed in to change notification settings - Fork 0
/
adicionaExemplares.php
341 lines (251 loc) · 9.73 KB
/
adicionaExemplares.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
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
<?php
include_once "conexao.php";
include_once "Usuario.php";
include_once "codigosRecaptcha.php";
include_once "dadosSistema.php";
include_once "verificaTempoSessao.php";
if(!isset($_SESSION)) session_start();
$conexao = conexao::getConexao();
if(!isset($_SESSION["usuario"])){
header("location: index.php");
}
$dados = $_SESSION["usuario"];
$nivelAcesso = $dados->getNivelAcesso();
if($nivelAcesso != "A"){
header("location: index.php");
}
//Código acima - verificação de login
//Pegando instituições
try{
$etecs = implode(",", $dados->getInstituicoes());
$comando = $conexao->prepare("SELECT id_instituicao, nome_instituicao FROM instituicao WHERE id_instituicao IN($etecs)");
$comando->execute();
$instituicoesOP = null;
foreach($comando->fetchAll() as $valor){
$cod = htmlspecialchars($valor[0]);
$nome = htmlspecialchars($valor[1]);
$instituicoesOP .= "<option value='$cod'>$nome</option>";
}
}catch(Exception $ex){
header("location: livros.php");
}
?>
<!DOCTYPE html>
<html lang="pt-br">
<head>
<title><?php echo Info::$nomeSistema ?> - Adicionar Exemplares</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<script src="./scripts/jquery.min.js"></script>
<script src="./scripts/MaskaraJquery/jquery.mask.js"></script>
<script src="./scripts/adicionaExemplares.js"></script>
<script src="./scripts/controleEditora.js"></script>
<script src="./scripts/carregaLivroMoldal.js"></script>
<script src="https://www.google.com/recaptcha/api.js" async defer></script>
<link rel="stylesheet" type="text/css" href="./css/fontawesome-free-5.12.1-web/css/all.min.css">
<link rel="stylesheet" type="text/css" href="./css/fontawesome-free-5.12.1-web/css/brands.min.css">
<link rel="stylesheet" type="text/css" href="./css/fontawesome-free-5.12.1-web/css/solid.min.css">
<link rel="stylesheet" type="text/css" href="./css/fontawesome-free-5.12.1-web/css/svg-with-js.min.css">
<link rel="stylesheet" type="text/css" href="./css/fontawesome-free-5.12.1-web/css/regular.min.css">
<link rel="stylesheet" type="text/css" href="./css/fontawesome-free-5.12.1-web/css/v4-shims.min.css">
<link rel="shortcut icon" type="image/jpg" <?php echo "href='".Info::$logoSistema."'" ?> sizes="50x50">
<link rel="stylesheet" type="text/css" href="./css/config.css">
<link rel="stylesheet" type="text/css" href="./css/cadLivro.css">
</head>
<body>
<section id='MoldalAviso'></section>
<!--Moldal de Loading-->
<section id="moldalLoading">
<div></div>
</section>
<!--Moldal da editora-->
<section class="MoldalOpcoes">
<section class="telas">
<div class="fechaMoldalOpcoes">×</div>
<header>
<div>
<img <?php echo "src='". Info::$logoSistema ."'" ?>>
<h5><?php echo Info::$nomeSistema; ?> - Selecionar Editora</h5>
</div>
<div>
<?php
echo "<img title='". Info::$nomeEtec ."' src='". Info::$logoEtec ."'>
<img title='". Info::$nomeCentro ."' src='". Info::$logoCentro ."'>";
?>
</div>
</header>
<section>
<main>
<input type="text" name="textPesquisa" placeholder="Pesquisar editora..." onkeyup="pesquisaEditora(this)">
<button><i class='fas fa-search'></i></button>
</main>
<table>
<thead>
<tr>
<th>Nome</th>
<th>CNPJ</th>
<th class='opcoesMoldalTable'>Opcões</th>
</tr>
</thead>
<tbody id="editoraT"></tbody>
</table>
<footer>
<div><button class="adicionar" onclick="abreMoldalEditora(1, null)">Adicionar Editora</button></div>
<div><button class="btns carregarMaisT" onclick="carregaMaisEditoras(this)"><i class='fas fa-plus' title="Carregar Mais"></i></button></div>
</footer>
</section>
</section>
</section>
<!--Moldal da editora-->
<section class="MoldalOpcoes">
<section class="telas">
<div class="fechaMoldalOpcoes">×</div>
<header>
<div>
<img <?php echo "src='". Info::$logoSistema ."'" ?>>
<h5><?php echo Info::$nomeSistema; ?> - Selecionar Livro</h5>
</div>
<div>
<?php
echo "<img title='". Info::$nomeEtec ."' src='". Info::$logoEtec ."'>
<img title='". Info::$nomeCentro ."' src='". Info::$logoCentro ."'>";
?>
</div>
</header>
<section>
<main>
<input type="text" name="textPesquisa" placeholder="Pesquisar livro..." onchange="pesquisaLivro(this)">
<button><i class='fas fa-search'></i></button>
</main>
<table>
<thead>
<tr>
<th>Capa</th>
<th>Titulo</th>
</tr>
</thead>
<tbody id="livroT"></tbody>
</table>
<footer style="grid-template-columns: 1fr">
<div style="display: flex; align-items: center; justify-content: center;">
<button class="btns carregarMaisT" onclick="carregaLivros(this)"><i class='fas fa-plus' title="Carregar Mais"></i></button>
</div>
</footer>
</section>
</section>
</section>
<section class="MoldaCad"> <!--Editora-->
<section class="telas">
<div class="fechaMoldalCad" onclick="fechaMoldalCad()">×</div>
<header>
<div>
<img <?php echo "src='". Info::$logoSistema ."'" ?>>
<h5><?php echo Info::$nomeSistema; ?> - <span class="tituloCad">Cadastro da Editora</span></h5>
</div>
<div>
<?php
echo "<img title='". Info::$nomeEtec ."' src='". Info::$logoEtec ."'>
<img title='". Info::$nomeCentro ."' src='". Info::$logoCentro ."'>";
?>
</div>
</header>
<section>
<form action="javascript: void(0)">
<input type="text" name="nome" placeholder="Nome" class="inputsE" maxlength="100" onkeyup="limpaCamposE(0)">
<br><span class="spanCad spanCadE">Digite o nome da editora</span><br>
<input type="text" name="cnpj" placeholder="CNPJ" maxlength="14" class="inputsE" id="cnpjEditora">
<br><br>
<input type="submit" value="Cadastrar Editora" class="btnCadSub">
</form>
</section>
</section>
</section>
<section class="MoldaCad"> <!--Pegar tombo-->
<section class="telas">
<div class="fechaMoldalCad" onclick="fechaMoldalCad()">×</div>
<header>
<div>
<img <?php echo "src='". Info::$logoSistema ."'" ?>>
<h5><?php echo Info::$nomeSistema; ?> - Outros dados</h5>
</div>
<div>
<?php
echo "<img title='". Info::$nomeEtec ."' src='". Info::$logoEtec ."'>
<img title='". Info::$nomeCentro ."' src='". Info::$logoCentro ."'>";
?>
</div>
</header>
<section>
<form action="javascript: void(0)">
<p style="color: white">Este livro não possui nenhum tombo e ISBN cadastrado!, pois se trata de um livro que está disponível somente em pdf, portanto informe o tombo e o ISBN dos exemplares que você irá adicionar!</p><br>
<input type="text" name="tombo" class="inputTomboCad" placeholder="Tombo" maxlength="10">
<br><span class="spanCad spanTombo">Digite o tombo do livro</span><br>
<input type="text" name="isbn" class="inputTomboCad"placeholder="ISBN" maxlength="14">
<br><span class="spanCad spanTombo">Digite o ISBN do livro</span><br>
<input type="submit" value="Cadastrar Dados" class="btnCadSub" onclick="informaTombo()">
</form>
</section>
</section>
</section>
<nav id="menu">
<ul>
<li id="mn"><a href="javascript: history.go(-1)"><span><i class="fas fa-arrow-left"></i></span></a> <h5>Livros</h5></li>
<li id="imgInicial">
<?php
echo "<a href='". Info::$siteEtec ."' target='_blank'><img title='". Info::$nomeEtec ."' src='". Info::$logoEtec ."'></a>
<a href='Inicio.php'><img title='". Info::$nomeSistema ."' src='". Info::$logoSistema ."'></a>
<a href='". Info::$siteCentro ."' target='_blank'><img title='". Info::$nomeCentro ."' src='". Info::$logoCentro ."'></a>";
?>
</li>
</ul>
</nav>
<section id="container">
<form action="javascript: void(0)" name="formCad" id="formCad">
<input type="hidden" name="tombo" id="inputTombo" value="">
<input type="hidden" name="isbn" id="inputISBN" value="">
<div class="inputs" id="input2" style="padding: 20px;">
<div>
<div class="dividePDF" style="margin: 0; display: grid; grid-template-columns: 1fr 50px">
<input type="text" id="livro" name="livro" placeholder="Livro" class="inputV" readonly><button class="btnAbreMoldalLivro">...</button>
<input type="hidden" name="livroCodigo" id="livroCodigo">
</div>
<br><span class="spanAlerta">Selecione um livro</span><br><br>
</div>
<div class="divide">
<div>
<div class="inputFlexContainer">
<input type="number" name="exemplares" placeholder="Exemplares" class="inputV" min="1">
</div>
<br><span class="spanAlerta">Digite os exemplares</span><br><br>
</div>
<div>
<div>
<select name="instituicao">
<?php echo $instituicoesOP; ?>
</select>
<br><br><br>
</div>
</div>
</div>
<div>
<div class="inputComBTN">
<select size='5' id='editorasSelecionados'></select>
<input type="hidden" name="editoras" id="editoras">
<button class="btnAbreMoldal">Adicionar Editora</button>
</div>
<br><span class="spanAlerta">Selecione pelo menos uma editora</span><br><br>
</div>
<div style="overflow: hidden;">
<div class="g-recaptcha" <?php echo "data-sitekey='$codChaveDiv'"; ?>></div>
</div>
</div>
<div id="btnCad">
<input type="submit" name="btnCadLivro" value="Adicionar Exemplares" onclick="adicionaExemplares()">
</div>
</form>
</section>
<!--Botão para ajuda-->
<a href="ajuda.php#AdicionarExemplares"><div id="btnhelp" title="Ajuda" style="bottom: 40px"><i class="fas fa-question"></i></div></a>
<footer><h5><?php echo Info::$copyright; ?></h5></footer>
</body>
</html>