-
Notifications
You must be signed in to change notification settings - Fork 0
/
footer.php
85 lines (75 loc) · 3.56 KB
/
footer.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
<!-- Footer -->
<footer>
<!-- Copyright -->
<div class="footer-copyright text-center text-md-left py-4 px-5">Desenvolvido com <i class="fas fa-heart"></i> por
um
bando de geeks.
</div>
<!-- Copyright -->
</footer>
<!-- Footer -->
<!-- Inlui scripts do Boostrap: jQuery first, then Popper.js, then Bootstrap JS -->
<script src="assets/js/jquery-3.4.1.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"
integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q"
crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"
integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl"
crossorigin="anonymous"></script>
<!-- Inicializa tooltips -->
<script>
$(function () {
$('[data-toggle="tooltip"]').tooltip()
})
</script>
<script>
$('#pesquisa').on('keyup', function(){
$('#conteudo').html('');
if(($('#pesquisa').val()).length >= 2){
$.getJSON('filtros.php?item='+$('#pesquisa').val(), function(data){
console.log(data);
if(data!=null)
data.forEach(function(element){
$('#conteudo').append(`
<tr>
<th> `+element.nome+` </th>
<th> `+element.porcao +`</th>
<th> `+element.valor_cal +`</th>
<th> `+element.quantidade_proteina +`</th>
<th> `+element.quantidade_carboidrato +`</th>
<th> `+element.teor_limpidico +`</th>
<th> `+element.teor_fibroso +`</th>
<?php if($isAdmin){ ?>
<th><button class="btn btn-primary" value="`+element.idAlimento+`">Editar</button><button class="btn btn-danger" style="margin-left:10px;" value="`+element.idAlimento+`">Apagar</button></th>
<?php }?>
</tr>
`);
});
});
}else{
$.getJSON('getAlimentos.php', function(data){
console.log(data);
if(data!=null)
data.forEach(function(element){
$('#conteudo').append(`
<tr>
<th> `+element.nome+` </th>
<th> `+element.porcao +`</th>
<th> `+element.valor_cal +`</th>
<th> `+element.quantidade_proteina +`</th>
<th> `+element.quantidade_carboidrato +`</th>
<th> `+element.teor_limpidico +`</th>
<th> `+element.teor_fibroso +`</th>
<?php if($isAdmin){ ?>
<th><button class="btn btn-primary" value="`+element.idAlimento+`">Editar</button><button class="btn btn-danger" style="margin-left:10px;" value="`+element.idAlimento+`">Apagar</button></th>
<?php }?>
</tr>
`);
});
});
}
});
});
</script>
</body>
</html>