-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprodutos.htm
139 lines (129 loc) · 3.68 KB
/
produtos.htm
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
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="utf-8">
<title>Produtos</title>
<link rel="stylesheet" href="css/w3.css">
<script src="data/appml.js"></script>
<script src="js/menu.js"></script>
</head>
<body>
<div appml-include-html="incluso/inc_header.htm"></div>
<div class="w3-container w3-content">
<h1>Produtos</h1>
<div id="Form01" class="w3-container w3-light-grey w3-padding-large w3-margin-bottom" style="display:none;" appml-controller="myFormController">
<div appml-include-html="incluso/inc_formcommands.htm"></div>
<p>
<label>Nome do produto:</label>
<input id="Nomeprod" class="w3-input w3-border">
</p>
<p>
<label>Fornecedor:</label>
<div appml-data="data/appml.php?model=model_list/model_dropdown_suppliers">
<select id="IDforn" class="w3-select w3-border">
<option appml-repeat="records" value="{{IDforn}}">{{Nomeforn}}</option>
</select>
</div>
</p>
<p>
<label>Categoria:</label>
<div appml-data="data/appml.php?model=model_list/model_dropdown_categories">
<select id="IDcat" class="w3-select w3-border">
<option appml-repeat="records" value="{{IDcat}}">{{Nomecat}}</option>
</select>
</div>
</p>
<p>
<label>Unidadea:</label>
<input id="Unidade" class="w3-input w3-border">
</p>
<p>
<label>Preço:</label>
<input id="Preco" onchange="myValidator(this)" class="w3-input w3-border">
</p>
</div>
<div appml-data="data/appml.php?model=model_list/model_productslist" appml-controller="myListController">
<div appml-include-html="incluso/inc_listcommands.htm"></div>
<div appml-include-html="incluso/inc_productsquery.htm"></div>
<table class="w3-table-all">
<tr>
<th></th>
<th>Nome do produto</th>
<th>Categoria</th>
<th>Fornecedor</th>
<th>Preço</th>
</tr>
<tr appml-repeat="records">
<td style="cursor:pointer" onclick="appml('Form01').run({{IDprod}})">✎</td>
<td>{{NomeProd}}</td>
<td>{{nomecat}}</td>
<td>{{nomeforn}}</td>
<td>{{Preco}}</td>
</tr>
</table>
</div>
<h3 id="sumprice"></h3>
</div>
<script>
function myValidator(item) {
var obj = appml("Form01");
obj.message = "validate";
obj.validate = {};
obj.validate.item = item.id;
obj.validate.value = item.value;
myFormController(obj);
}
function myListController($appml) {
if ($appml.message == "done") {
var i, x, tot = 0;
x = $appml.data.records;
for (i = 0; i < x.length; i++) {
tot += Number(x[i].Preco);
}
document.getElementById("sumprice").innerHTML = x.length + " produtos. Total Preço: R$" + tot.toFixed(2);
}
if ($appml.message == "display") {
if ($appml.display.name == "NomeProd") {
$appml.display.value = $appml.display.value.toUpperCase();
}
}
}
function myFormController($appml) {
if ($appml.message == "ready") {
$appml.appName = "Form01";
$appml.dataSource = "data/appml.php?model=model_form/model_productsform";
return -1;
}
if ($appml.message == "loaded") {
document.getElementById("Form01").style.display = "";
}
if ($appml.message == "submit") {
if (isNaN(document.getElementById("Preco").value)) {
$appml.setError(15, "Price must be a number");
return -1;
}
}
if ($appml.message == "validate") {
if ($appml.validate.item == "Preco") {
if (isNaN($appml.validate.value)) {
$appml.setError(15, "Price must be a number");
return;
}
}
}
}
</script>
<div appml-include-html="incluso/inc_footer.htm"></div>
<script>
function versenha(y) {
y.classList.toggle("fa-eye-slash");
var x = document.getElementById("myInput");
if (x.type === "password") {
x.type = "text";
} else {
x.type = "password";
}
}
</script>
</body>
</html>