-
Notifications
You must be signed in to change notification settings - Fork 0
/
log.html
106 lines (92 loc) · 3.01 KB
/
log.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
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css" integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk" crossorigin="anonymous">
<!-- style -->
<style type='text/css'>
html, body{
height: 100%;
}
.place-list {
position: fixed;
height: calc(100% - 48px);
left: 0;
right: 0;
bottom: 48px;
overflow: auto;
}
.place-list .welcome {
display: flex;
align-items: center;
justify-content: center;
height: 100%;
}
.place-list .row {
padding: .75rem 1.25rem;
border-bottom: 1px solid rgba(0,0,0,.125);
margin: 0px;
}
.place-list .row:first-child {
border-top: 1px solid rgba(0,0,0,.125);
}
.bottom {
position: fixed;
height: 48px;
left: 0;
right: 0;
bottom: 0px;
}
.bottom .btn {
border-radius: 0px;
}
</style>
<title>บันทึกไทยชนะ</title>
</head>
<body>
<!-- list -->
<div class='place-list'>
<div class='welcome'>
<h3>ไม่พบประวัติการสแกน</h3>
</div>
</div>
<!-- back bottom -->
<div class='bottom'>
<a class='btn btn-back btn-lg btn-secondary w-100' href='./list.html'>ถอยกลับ</a>
</div>
<!-- bottom scripts -->
<script src="https://code.jquery.com/jquery-3.5.1.min.js" integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0=" crossorigin="anonymous"></script>
<!-- app scripts -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.26.0/moment.min.js"></script>
<script src="https://diewland.github.io/disk.js/dist/disk.js"></script>
<script src="./app.js"></script>
<script>
// query data from disk
let data = Db.list_history();
// prepare place list
if (data.length > 0) $('.place-list').html('');
// render places
data.reverse(); // latest on top
data.forEach(place => {
let last_timestamp = moment(place.timestamp).format(FMT_DATETIME);
let checked_in = place.checked_in || false;
let badge = checked_in ? "<span class='badge badge-success'>เช็คอิน</span>"
: "<span class='badge badge-warning'>เช็คเอาท์</span>";
$('.place-list').append(`
<div class='row align-items-center>
<div class='col px-0'>
<div class='w-100'>
${badge}
${last_timestamp}
</div>
<span class='place-title'>${place.title}</span>
</div>
</div>
`);
});
</script>
</body>
</html>