-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhome.php
184 lines (135 loc) · 6.3 KB
/
home.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
<?php
require_once "bootstrap/bootstrap.php";
// Set config page
$page = array(
'title' => $_config['title'] . ' - ' . $_config['slogan']
);
?>
<!DOCTYPE html>
<html lang="pt-br" dir="ltr">
<head>
<?php include $_path['includes'] . 'head.php'; ?>
</head>
<body class="bg" itemscope="" itemtype="http://schema.org/WebPage" data-spy="scroll" data-target="#navbar" id="home">
<?php include $_path['includes'] . 'header.php'; ?>
<main class="main-view" role="main">
<section id="sobre" class="wrapper">
<article class="container">
<header class="heading">
<div class="add-box" style="float:right;width:70px;">
<a href="#modal" rel="modal" class="add-pedido" style="margin-top:-10px;">+</a>
</div>
<h2 class="title" style="color:#fff; font-weight: bold" itemprop="name">Lista de pedidos
</h2>
</header>
<p id="mensageNullPedidos" class="lead"></p>
<div class="item">
<ul id="listPedidos" class="">
</ul>
</div>
<!-- 32.5 -->
<div class="window" id="modal" style="top: 36px;left: 70.5px;width: 320px;display: none;" >
<a href="#" class="fechar">X </a>
<div>
<h1>Adicionar pedido</h1>
<form id="formCadPedido" class="col s12 form validate">
<fieldset>
<div class="field col s12 ">
<select name="categorias" id="formCadPedido__id_categorias" required>
<option disabled>Selecione uma categoria</option>
</select>
</div>
<div class="field col s12 ">
<input type="text" name="descricao" id="formCadPedido__descricao" placeholder="Descrição" required>
</div>
<div class="field col s12 ">
<input type="number" name="valorMin" id="formCadPedido__valorMin" placeholder="Valor mínimo">
<input type="number" name="valorMax" id="formCadPedido__valorMax" placeholder="Valor máximo">
</div>
<div class="field col s12 ">
<input type="date" name="urgencia" id="formCadPedido__urgencia" placeholder="Urgência">
</div>
<div class="field col s12">
<div class="form-msg alert">
<p class="message"><strong>Por favor,</strong> preencha todos os campos!</p>
<button class="closed" role="button">×</button>
</div>
</div>
<div class="field col s12 ">
<input type="submit" style="width:100%; background: #b71c1c" value="Adicionar">
<input type="hidden" name="action" value="login">
</div>
</fieldset>
</form>
</div>
</div>
<!-- mascara para cobrir o site -->
<div id="mascara"></div>
</article><!-- /.container-->
</section><!-- /.wrapper -->
</main>
<script src="js/vendor/jquery-1.11.2.min.js"></script>
<script src="js/vendor/slick.min.js"></script>
<script src="js/vendor/jquery-scrollspy.min.js"></script>
<script src="js/vendor/simple-lightbox.min.js"></script>
<script src="js/main.min.js"></script>
<script src="js/vendor/jquery.validate.min.js"></script>
<script src="js/validate.min.js"></script>
<script src="js/Sync.js"></script>
<script>
$().ready(function(){
$("#formCadPedido").submit(function(){
var id_categoria = $("#formCadPedido__id_categorias").val();
var descricao = $("#formCadPedido__descricao").val();
var valorMin = $("#formCadPedido__valorMin").val();
var valorMax = $("#formCadPedido__valorMax").val();
var data_final = $("#formCadPedido__urgencia").val();
if(id_categoria && descricao){
RegistraPedido(1, descricao, "2016-06-01", data_final, valorMin, valorMax, null, id_categoria);
location.reload();
} else {
return false;
}
});
/* ___________________________________
CONSULTA CATEGORIAS
___________________________________ */
var objCategorias = ConsultaCategorias();
if(objCategorias.length > 0){
$.each(objCategorias, function(key, row){
$('#formCadPedido__id_categorias').append($('<option>', {
value : row.id_categoria,
text : row.descricao
}));
});
}
/* ___________________________________
CONSULTA PEDIDOS
___________________________________ */
var objPedidos = ConsultaPedidos(1);
var length = objPedidos.length;
// Limpa possiveis registros "lixos"
$("#listPedidos").html("");
$("#mensageNullPedidos").html("");
if(length > 0){
$.each(objPedidos, function(key, row){
$("#listPedidos")
.append('<li>' +
' <a href="single.php?id_pedido=' + row.id_pedido + '">' +
' <span class="name-category">' + row.descricao_categoria + '</span>' +
' <div class="description-category">' + row.descricao_pedido + ' </div>' +
' <div class="right">' +
' <i class="fa fa-pencil" aria-hidden="true"><!-- icone--></i>' +
' <i class="fa fa-trash-o" aria-hidden="true"><!-- icone--></i>' +
' </div>' +
' </a>' +
'</li>'
);
});
} else {
$("#mensageNullPedidos").html("Você ainda não tem pedidos<br> que tal adicionar um?");
}
});
</script>
</body>
</html>