-
Notifications
You must be signed in to change notification settings - Fork 0
/
AsearchByPerson.html
437 lines (357 loc) · 14.9 KB
/
AsearchByPerson.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
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
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta content="width=device-width, initial-scale=1.0" name="viewport">
<title>BoB 0x10</title>
<meta content="" name="descriptison">
<meta content="" name="keywords">
<!-- Google Fonts -->
<link href="https://fonts.googleapis.com/css?family=Open+Sans:300,300i,400,400i,600,600i,700,700i|Roboto:300,300i,400,400i,500,500i,700,700i&display=swap" rel="stylesheet">
<!-- Vendor CSS Files -->
<link href="assets/vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<link href="assets/vendor/animate.css/animate.min.css" rel="stylesheet">
<link href="assets/vendor/icofont/icofont.min.css" rel="stylesheet">
<link href="assets/vendor/boxicons/css/boxicons.min.css" rel="stylesheet">
<link href="assets/vendor/venobox/venobox.css" rel="stylesheet">
<link href="assets/vendor/owl.carousel/assets/owl.carousel.min.css" rel="stylesheet">
<link href="assets/vendor/aos/aos.css" rel="stylesheet">
<link href="assets/css/bootstrap.min.css" rel = "stylesheet">
<!-- Template Main CSS File -->
<link href="assets/css/searchByPerson.css" rel="stylesheet">
<!--donught css-->
<link type="text/css" rel="stylesheet" href="assets/css/default.css"/>
<!-- calendar -->
<link href='assets/fullcalendar-5.3.2/lib/main.css' rel='stylesheet' />
<script src='assets/fullcalendar-5.3.2/lib/main.js'></script>
<script src = "assets/js/calendar.js"></script>
<link rel="shortcut icon" href="assets/img/icon_temp.ico" type="image/x-icon" />
</head>
<body>
<!-- ======= Header ======= -->
<header id="header" class="fixed-top ">
<div class="container">
<div class="logo float-left">
<h1 class="text-light"><a href="index.html"><img src="assets/img/whiteicon.png" alt="" class="img-fluid"></a><a href="index.html"><span> BoB 0x10</span></a></h1>
</div>
<nav class="nav-menu float-right d-none d-lg-block">
<ul>
<li><a href="index.html">Home</a></li>
<li><a href="AsearchByDate.html">Date</a></li>
<li><a href="AsearchByMonth.html">Month</a></li>
<li class="active"><a href="AsearchByPerson.html">Name</a></li>
<li><a href="AsearchByMAC.html">MAC</a></li>
<li><a href="AviewAll.html">View All</a></li>
<li><a href="Amap.html">Map</a></li>
<li><a href="Aregister.html">REGISTER</a></li>
<li><a id="topUserId" href= "BackendConn_out.html" style="color:whitesmoke; font-style: italic; font-size: 15px;"></a></li>
</ul>
</nav><!-- .nav-menu -->
</div>
</header><!-- End Header -->
<main id="main">
<!-- ======= Intro Section ======= -->
<section class="breadcrumbs">
<div class="container">
<div class="d-flex justify-content-between align-items-center">
<h2>Search By Name</h2>
<ol>
<li><a href="Aindex.html">Home</a></li>
<li>By Name</li>
</ol>
</div>
</div>
</section><!-- End Intro Section -->
<!-- ======= Search Section ======= -->
<section class="pricing section-bg" data-aos="fade-up">
<div class="container">
<div class="section-title">
<h2>Enter the Date and Name</h2>
<p>You can check specific one's attendance and detail information.</p>
</div>
<div class="input-group">
<input type="text" name = "name" id = "inputname" class="form-control" placeholder="Name" style="margin-bottom: 20px; margin-top: 20px;">
<input type="text" id = "inputdate" class="form-control" placeholder="Date" style="margin-bottom: 20px; margin-top: 20px;">
<button onclick="input()" style="margin-bottom: 20px; margin-top: 20px;">SEARCH</button>
</div>
<div class="container-M"
style="background-image: URL(assets/img/tempBG.jpg);
background-repeat: no-repeat;
background-size: cover;">
<div class="M1">
<div class="section-title" style="padding-bottom: 10px;">
<p>Device List</p>
</div>
<table id="target" class="list-table" style="margin-left: 0px; margin-right: 0px;">
<tr class="list-info">
<th>Mac Address</th>
<th>Device ID</th>
</table>
<br>
<br>
<div class="section-title" style="padding-bottom: 10px;">
<p>Details about Time spent</p>
</div>
<table id="target2" class="list-table" style="margin-left: 0px; margin-right: 0px;">
<tr class="list-info">
<th>Room Number</th>
<th>Enter Time</th>
<th>Exit Time</th>
<th>Time Spent</th>
</table>
<br>
</div>
<div class="M2">
<div class="chart-container" >
<div class="doughnut-chart-container">
<br>
<br>
<canvas id="doughnut-chartcanvas-2"></canvas>
</div>
</div>
<br>
<br>
<br>
<div class="section-title" style="padding-bottom: 10px; padding-left: 75px;">
<p>Attendance Rate</p>
</div>
<br>
</div>
</div>
</div>
</section>
</main><!-- End #main -->
<!-- ======= Footer ======= -->
<footer id="footer" data-aos-easing="ease-in-out" data-aos-duration="500">
<div class="container">
<div class="credits">
BEST OF THE BEST <a href="https://www.kitribob.kr">KITRI</a>
</div>
</div>
</footer><!-- End Footer -->
<a href="#" class="back-to-top"><i class="icofont-simple-up"></i></a>
<!-- Vendor JS Files -->
<script src="assets/vendor/jquery/jquery.min.js"></script>
<script src="assets/vendor/bootstrap/js/bootstrap.bundle.min.js"></script>
<script src="assets/vendor/jquery.easing/jquery.easing.min.js"></script>
<script src="assets/vendor/php-email-form/validate.js"></script>
<script src="assets/vendor/venobox/venobox.min.js"></script>
<script src="assets/vendor/waypoints/jquery.waypoints.min.js"></script>
<script src="assets/vendor/counterup/counterup.min.js"></script>
<script src="assets/vendor/owl.carousel/owl.carousel.min.js"></script>
<script src="assets/vendor/isotope-layout/isotope.pkgd.min.js"></script>
<script src="assets/vendor/aos/aos.js"></script>
<!-- Template Main JS File -->
<script src="assets/js/main.js"></script>
<script src="assets/js/jquery.min.js"></script>
<script src="assets/js/Chart.min.js"></script>
<script src="assets/js/bootstrap.min.js"></script>
<!--datepicker-->
<link rel = "stylesheet" href="assets/jquery-ui/jquery-ui.css" type ="text/css"/>
<script src="assets/jquery-ui/jquery-ui.min.js"></script>
<script type="text/javascript">
var searchname;
var searchdate;
var searchid;
function input(){
var inputname = document.getElementById("inputname").value;
var inputdate = document.getElementById("inputdate").value;
searchname = inputname;
searchdate = inputdate;
var progID = localStorage.getItem("progID");
var donuturl = 'https://'+ progID + '/api/date/'+searchname+'/date/'+searchdate;
var newsearchURL = 'https://' + progID + '/api/getdevice/name/'+ searchname;
$.getJSON(newsearchURL,function(data){
$('#target').css("visibility", "visible").css("border", "1px solid green");
$("#target > tbody > tr > td").remove();
$("#target").append("<tbody>");
for(var j = 0; j < data['deviceList'].length; j++){
$('#target').append("<tr><td>"+data['deviceList'][j].macaddr+"</td><td>"
+data['deviceList'][j].deviceid+"</td><tr>"
);
}
$('#target').append("</tbody>");
});
$.getJSON(donuturl,function(data){
let keys = Object.keys(data);
var chart2;
var timeData = new Array(data['count']*2 + 1); //도넛나뉘는 개수만큼 array에 넣음.
timeData[0] = 0;
timeData[data['count']*2+1] = 86400; //하루를 초로 환산
for( var i=0 ; i<data['count'] ; i++){
timeData[2*(i)+1] = data['data'][i].entertime;
timeData[2*(i)+2] = data['data'][i].exittime;
}
var donutData = new Array(timeData.length-1);
//시간값들 차이만큼 donutData에 넣었음.
//도넛 시간 차이값들이 timedata - 1만큼 나옴
for( var i=0; i<timeData.length; i++){
donutData[i] = Math.round( ((-1)* (timeData[i] - timeData[i+1]))/86400 *100); //소수 둘째짜리까지
//donutData[i].push(Math.round( ((-1)* (timeData[i] - timeData[i+1]))/86400 *100));
}
$('#target2').css("visibility", "visible").css("border", "1px solid green");
$("#target2 > tbody > tr > td").remove();
$("#target2").append("<tbody>");
for(var j = 0; j < data['count']; j++){
var roomid = data['data'][j].roomid
var h = String(parseInt(data['data'][j].entertime/3600))
var m = String(parseInt((data['data'][j].entertime%3600)/60))
var s = String(((data['data'][j].entertime%3600)%60))
var entertime = h + "h " + m + "m " + s + "s";
var h = String(parseInt(data['data'][j].exittime/3600))
var m = String(parseInt((data['data'][j].exittime%3600)/60))
var s = String(((data['data'][j].exittime%3600)%60))
var exittime = h + "h " + m + "m " + s + "s";
var tempspent = data['data'][j].exittime - data['data'][j].entertime;
var h = String(parseInt(tempspent/3600))
var m = String(parseInt((tempspent%3600)/60))
var s = String(((tempspent%3600)%60))
var spenttime = h + "h " + m + "m " + s + "s";
$('#target2').append("<tr><td>"+roomid+"</td><td>"
+entertime+"</td><td>"
+exittime+"</td><td>"
+spenttime+"</td><tr>"
);
}
$('#target2').append("</tbody>");
//도넛 데이터 라벨 및 색깔 배치
var label = new Array(timeData.length-1);
label[0]= "Absence Ratio";
var color = new Array(timeData.length-1);
color[0]="#FFFFFF";
if ( timeData.length > 0 )
{
for( var i=1; i<timeData.length-1; i++){
if ( i % 2 != 0){
var h = String(parseInt(timeData[i]/3600))
var m = String(parseInt((timeData[i]%3600)/60))
var enterTime = h + "h " + m + "m ";
var h = String(parseInt(timeData[i+1]/3600))
var m = String(parseInt((timeData[i+1]%3600)/60))
var exitTime = h + "h " + m + "m ";
label[i] ="Enter: "+ enterTime + "\n Exit: "+exitTime + "\n Ratio";
color[i] = "#DCDCDC";
}
if ( i % 2 == 0){
label[i] ="Absence Ratio";
color[i] = "#FFFFFF";
}
}
var brcolor = new Array(timeData.length-1);
var brwidth = new Array(timeData.length-1);
for ( var i=0; i<timeData.length-1; i++){
brcolor[i] = "#CBCBCB";
brwidth[i] = "1";
}
console.log(label);
//get the doughnut chart canvas
var ctx2 = $("#doughnut-chartcanvas-2");
//doughnut chart data
var data2 = {
labels: label,
datasets: [
{
label: "",
data: donutData,
backgroundColor: color,
borderColor: brcolor,
borderWidth: brwidth
}
]
};
//options
var options = {
respoznsive: true,
title: {
display: true,
position: "bottom",
text: " ",
fontSize: 25,
fontColor: "#111"
},
legend: {
display: false,
position: "bottom",
labels: {
fontColor: "#333",
fontSize: 16
}
}
};
//create Chart class object
chart2 = new Chart(ctx2, {
type: "doughnut",
data: data2,
options: options
});
}
//else 문 자리
}).fail(function(){
alert("There is no attendance record on that date.")
console.log("can not found this url");
history.go(0);
})
var progID = localStorage.getItem("progID");
var calendarurl = 'https://' + progID + '/api/name/' + searchname;
var datelist = [];
var datecnt;
$.ajax({
type:"get",
url : calendarurl,
async: false,
dataType: "json",
success: function(data){
for (var i = 0; i < data[0]['datelist'].length; i++){
datelist[i] = data[0]['datelist'][i]; ;
}
var events = [];
$.each(data, function() {
for(var j = 0; j<data[0]['datelist'].length; j++){
events.push({
title: "attend",
start: datelist[j], // will be parsed
end: datelist[j] // will be parsed
});
}
});
}
})
}
$(function(){
$("#inputdate").datepicker({
showButtonPannel: true,
currentText: 'today',
closeText: 'exit',
dateFormat: "yymmdd"
});
});
//로그인되어있는지 확인
console.log(localStorage.getItem("progID"))
var progID = localStorage.getItem("progID");
if(!localStorage.getItem("proID")){ //새로고침 방지
localStorage.setItem("progID", progID);
}
function logoutProcess(){
console.log("logoutProcess");
localStorage.removeItem("progID");
alert('Logout!');
location.replace('BackendConn.html');
}
function checkStatus(){
console.log("checkStatus");
if(progID == 'null'){ //null 인 아이디 사용불가
alert('Invalid access. Please connect again');
location.replace('BackendConn.html');
}
}
function init(){
checkStatus();
}
init();
$(document).ready(function() {
var progID = localStorage.getItem("progID");
$('#topUserId').text("Accessed ");//progID
});
</script>
</body>
</html>