-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from diewland/dev
fix #13 add check in / check out history
- Loading branch information
Showing
3 changed files
with
134 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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> |