-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathchamado.html
229 lines (171 loc) · 7.63 KB
/
chamado.html
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
<html>
<meta charset="UTF-8">
<head>
<title> Painel | chamado </title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<!-- Compiled and minified CSS -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.2/css/materialize.min.css">
<!-- Compiled and minified JavaScript -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.2/js/materialize.min.js"></script>
<style>
label {
color: white;
}
</style>
</head>
<body style="background-color: rgba(31, 178, 72,1)">
<br>
<div class="container">
<div class="row">
<div class="col s6">
<div class="card orange">
<div style="text-align: center; padding-top: 20px; text-transform: uppercase">
<span class="card-title white-text" style="font-size: 50px;font-weight: bold; ">SENHAS</span>
</div>
<div class="card-content">
<div class="row">
<div class="col s6">
<label>Local</label>
<select name="local" id="local" class="browser-default">
<!-- <option value="" disabled selected>Escolha Uma opção:</option>> -->
<option value="Mesa">Mesa</option>
<option value="Escritório">Escritorio</option>
<option value="Sala">Sala</option>
</select>
</div>
<div class="col s6">
<label>Numero</label>
<select id="numero" name="numero" class="browser-default">
<option value="01">01</option>
<option value="02">02</option>
<option value="03">03</option>
<option value="04">04</option>
<option value="05">05</option>
<option value="06">06</option>
<option value="07">07</option>
<option value="08">08</option>
<option value="09">09</option>
<option value="10">10</option>
</select>
</div>
</div>
<div class="row">
<div class="col s12">
<style>
.switch label input[type=checkbox]:checked+.lever:after {
background-color: #e65100;
}
.switch label input[type=checkbox]:checked+.lever {
background-color: red;
}
</style>
<div class="switch">
<label>
Desligar
<input type="checkbox" id="switch">
<span class="lever"></span>
Ligar
</label>
</div>
</div>
</div>
<div class="row">
<div class="col s12">
<a id="btn" class="waves-effect waves-light btn orange darken-4" style="width: 100%;"
onclick="chamarProximo()">Chamar
Próximo!</a>
</div>
</div>
</div>
</div>
</div>
<div class="col s6">
<div class="card yellow">
<div style="padding-top: 10px; text-align: center; text-transform: uppercase; ">
<span style="font-size: 30px; color:gray;">Meus Chamados</span>
</div>
<ul class="collection with-header">
</ul>
</div>
</div>
</div>
<div class="row">
<div class="col s4">
<div class="card">
<div style="padding-top: 20px; text-align: center; text-transform: uppercase; ">
<span style="font-size: 20px; color:gray;">Setar Senha</span>
</div>
<div class="card-content">
<input id="setarSenha" type="number" min="0" class="validate">
<a id="btnSetar" class="waves-effect waves-light btn green darken-4" style="width: 100%;"
onclick="setarSenha()">Setar!</a>
</div>
</div>
</div>
</div>
</div>
</body>
<script src="http://127.0.0.1:3001/socket.io/socket.io.js"></script>
<script>
var socket = io.connect("http://127.0.0.1:3001");
var contador = 0;
socket.on('senhasUsuario', function (content) {
console.log(content);
$('.collection').prepend('<li class="collection-item" id="i' + contador + '">' + tempo() + ' >> <b>Senha:' + content + '</b></li>');
var localizar = "#i" + (contador - 6);
$(localizar).remove();
contador++;
});
$("#btn").addClass("disabled");
$('#switch').change(function () {
var confirmar = $('#switch').is(":checked");
if (confirmar === true) {
$("#numero").prop("disabled", true);
$("#local").prop("disabled", true);
$("#btn").removeClass("disabled");
socket.emit("entrar", 'Local : ' + $('#local').val() + $('#numero').val());
} else {
$("#numero").prop("disabled", false);
$("#local").prop("disabled", false);
$("#btn").addClass("disabled");
}
});
function setarSenha() {
var valorSenha = $('#setarSenha').val();
$("#btnSetar").addClass("disabled");
$("#btnSetar").text('Aguarde!');
if( valorSenha.length > 0){
socket.emit("setarSenha", parseInt(valorSenha));
}
setTimeout(function () {
$("#btnSetar").removeClass("disabled");
$("#btnSetar").text('Setar!');
}, 5000);
}
function chamarProximo() {
local = $('#local').val();
numero = $('#numero option:selected').val();
$("#btn").addClass("disabled");
$("#btn").text('Aguarde...');
$("#switch").prop("disabled", true);
setTimeout(function () {
$("#btn").removeClass("disabled");
$("#switch").prop("disabled", false);
$("#btn").text('Chamar próximo!');
}, 3000);
socket.emit("proximo", local + ' ' + numero, 0);
}
$(document).ready(function () {
console.log('ready');
});
function tempo() {
var d = new Date(), displayDate;
if (navigator.userAgent.toLowerCase().indexOf('firefox') > -1) {
displayDate = d.toLocaleTimeString('pt-BR');
} else {
displayDate = d.toLocaleTimeString('pt-BR', { timeZone: 'America/sao_paulo' });
}
return displayDate;
}
</script>
</html>