2021-09-09 06:29:31 -07:00
|
|
|
|
<!DOCTYPE html>
|
|
|
|
|
<html>
|
|
|
|
|
|
|
|
|
|
<head>
|
|
|
|
|
<meta charset="utf-8">
|
|
|
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
|
|
|
<title>Group_Teach_View</title>
|
|
|
|
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.1/dist/css/bootstrap.min.css" rel="stylesheet"
|
|
|
|
|
integrity="sha384-F3w7mX95PdgyTmZZMECAngseQB83DfGTowi0iMjiWaeVhAn4FJkqJByhZMI3AhiU" crossorigin="anonymous">
|
|
|
|
|
<link rel="stylesheet" href="/static/allpages.css">
|
|
|
|
|
<link rel="stylesheet" href="/static/login.css">
|
|
|
|
|
</head>
|
|
|
|
|
|
|
|
|
|
<body>
|
2021-09-10 07:30:39 -07:00
|
|
|
|
<div class="container">
|
|
|
|
|
<h1>Group_Teach_View</h1>
|
|
|
|
|
<h2>{{cclass['category']}}: {{cclass['class_id']}}: {{cclass['name']}}</h2>
|
2021-09-12 02:39:09 -07:00
|
|
|
|
<h2>({{currDate}}) ({{dow}})</h2>
|
|
|
|
|
<a href="/logout"><button class="btn btn-primary">Logout 登出</button></a>
|
2021-09-10 07:30:39 -07:00
|
|
|
|
<form action="/manage/date" id="dateSelForm" method="post">
|
|
|
|
|
<select name="date" id="date" class="form-select" onchange="chgDate(this);">
|
2021-09-12 02:39:09 -07:00
|
|
|
|
{% for date in tmpAbsData %}
|
2021-09-10 07:30:39 -07:00
|
|
|
|
{% if date == currDate %}
|
|
|
|
|
<option value="{{date}}" selected="selected">{{date}}</option>
|
|
|
|
|
{% else %}
|
|
|
|
|
<option value="{{date}}">{{date}}</option>
|
|
|
|
|
{% endif %}
|
|
|
|
|
{% endfor %}
|
|
|
|
|
</select>
|
|
|
|
|
</form>
|
2021-09-12 02:39:09 -07:00
|
|
|
|
{% for i in absData %}
|
2021-09-14 02:49:16 -07:00
|
|
|
|
{% set alr_fill = namespace(found=false) %}
|
2021-09-12 02:39:09 -07:00
|
|
|
|
<form action="/manage/group_teach_publish" id="attendanceData^{{i}}" method="post">
|
2021-09-10 07:30:39 -07:00
|
|
|
|
<input type="hidden" name="date" value="{{currDate}}">
|
2021-09-12 02:39:09 -07:00
|
|
|
|
<input type="hidden" name="period" value="{{i}}">
|
|
|
|
|
<input type="hidden" class="signatureData" name="signatureData" value="">
|
2021-09-10 07:30:39 -07:00
|
|
|
|
<div class="col">
|
2021-09-13 07:42:12 -07:00
|
|
|
|
<div class="row title sticky-top" style="background-color: white">
|
2021-09-10 07:30:39 -07:00
|
|
|
|
<div class="col">Grade</div>
|
|
|
|
|
<div class="col">Class Code</div>
|
|
|
|
|
<div class="col">Number</div>
|
|
|
|
|
<div class="col">Name</div>
|
|
|
|
|
<div class="col">Eng Name</div>
|
2021-09-12 02:39:09 -07:00
|
|
|
|
<div class="col">Period {{i}}</div>
|
2021-09-10 07:30:39 -07:00
|
|
|
|
</div>
|
|
|
|
|
{% if data != None %}
|
2021-09-12 02:39:09 -07:00
|
|
|
|
{% for grade in absData[i] %}
|
|
|
|
|
{% for homeroom in absData[i][grade] %}
|
|
|
|
|
{% for student in absData[i][grade][homeroom] %}
|
2021-09-14 03:42:17 -07:00
|
|
|
|
{% if student != 'notes' %}
|
2021-09-10 07:30:39 -07:00
|
|
|
|
<div class="row">
|
|
|
|
|
<div class="col">{{grade}}</div>
|
|
|
|
|
<div class="col">{{homeroom}}</div>
|
|
|
|
|
<div class="col">{{ student }}</div>
|
2021-09-12 02:39:09 -07:00
|
|
|
|
<div class="col">{{ absData[i][grade][homeroom][student]['name'] }}</div>
|
|
|
|
|
<div class="col">{{ absData[i][grade][homeroom][student]['eng_name'] }}</div>
|
|
|
|
|
{% if absData[i][grade][homeroom][student]['alr_fill'] %}
|
|
|
|
|
{% set alr_fill.found = true %}
|
2021-09-13 07:42:12 -07:00
|
|
|
|
{% if absData[i][grade][homeroom][student]['absent'] == 1 %}
|
2021-09-12 02:39:09 -07:00
|
|
|
|
<div class="col">
|
|
|
|
|
<p class="highlightAbs n-2">X</p>
|
|
|
|
|
</div>
|
2021-09-13 07:42:12 -07:00
|
|
|
|
{% elif absData[i][grade][homeroom][student]['absent'] == 2 %}
|
|
|
|
|
<div class="col">
|
|
|
|
|
<p class="highlightAbs n-3">φ</p>
|
|
|
|
|
</div>
|
2021-09-12 02:39:09 -07:00
|
|
|
|
{% else %}
|
|
|
|
|
<div class="col">
|
|
|
|
|
<p class="highlightAbs n-1">V</p>
|
|
|
|
|
</div>
|
|
|
|
|
{% endif %}
|
|
|
|
|
{% else %}
|
|
|
|
|
<div class="col">
|
2021-09-12 05:15:19 -07:00
|
|
|
|
{% if [grade,homeroom] in confirmed %}
|
2021-09-12 02:39:09 -07:00
|
|
|
|
<p class="highlightAbs">--</p>
|
|
|
|
|
{% else %}
|
2021-09-13 07:42:12 -07:00
|
|
|
|
<input type="checkbox" class="tobeform {{grade}}^{{homeroom}}^{{student}} late"
|
|
|
|
|
id="late^{{i}}^{{grade}}^{{homeroom}}^{{student}}"
|
|
|
|
|
name="2^{{grade}}^{{homeroom}}^{{student}}"
|
|
|
|
|
onchange="unCheckAbs('{{i}}^{{grade}}^{{homeroom}}^{{student}}')">
|
|
|
|
|
<input type="checkbox" class="tobeform {{grade}}^{{homeroom}}^{{student}} absent"
|
|
|
|
|
id="absent^{{i}}^{{grade}}^{{homeroom}}^{{student}}"
|
|
|
|
|
name="1^{{grade}}^{{homeroom}}^{{student}}"
|
|
|
|
|
onchange="unCheckLate('{{i}}^{{grade}}^{{homeroom}}^{{student}}')">
|
2021-09-12 02:39:09 -07:00
|
|
|
|
{% endif %}
|
|
|
|
|
</div>
|
|
|
|
|
{% endif %}
|
2021-09-10 07:30:39 -07:00
|
|
|
|
</div>
|
2021-09-14 03:42:17 -07:00
|
|
|
|
{% endif %}
|
2021-09-10 07:30:39 -07:00
|
|
|
|
{% endfor %}
|
|
|
|
|
{% endfor %}
|
|
|
|
|
{% endfor %}
|
|
|
|
|
{% endif %}
|
2021-09-12 02:39:09 -07:00
|
|
|
|
{% if alr_fill.found %}
|
|
|
|
|
<button class="btn btn-primary margin-bottom viewSignatureBtn" type="button"
|
|
|
|
|
onclick="viewSignature('{{i}}')" disabled="disabled">
|
|
|
|
|
Already Submitted</button>
|
|
|
|
|
{% else %}
|
|
|
|
|
<button class="btn btn-primary margin-bottom viewSignatureBtn" type="button"
|
|
|
|
|
onclick="viewSignature('{{i}}')">
|
|
|
|
|
↑ Confirmed, Sign (Period {{i}}) ↑</button>
|
|
|
|
|
{% endif %}
|
|
|
|
|
<div class="signDiv" id="sign^{{i}}" hidden="hidden">
|
2021-09-12 07:21:10 -07:00
|
|
|
|
<div class="alert alert-warning" id="allPresentWarning" role="alert" hidden="hidden">
|
|
|
|
|
<h4 class="alert-heading">請確認是否全班全到!Please check if everyone is present!</h4>
|
|
|
|
|
</div>
|
2021-09-12 02:39:09 -07:00
|
|
|
|
<h3>Please Sign Below</h3>
|
|
|
|
|
<div class="forSign"><canvas id="signature_pad^{{i}}"></canvas></div>
|
2021-09-14 02:49:16 -07:00
|
|
|
|
<h3>Notes 備註欄</h3>
|
|
|
|
|
<input class="form-control" name="notes" id="subjectNotes^{{i}}" placeholder="Enter Notes 請輸入備註"
|
|
|
|
|
style="width: 80%; margin-left: 10%;">
|
2021-09-12 02:39:09 -07:00
|
|
|
|
<button class="btn btn-secondary" type="button" onclick="signaturePad.clear()">Clear
|
|
|
|
|
Signature</button><button class="btn btn-primary" type="button"
|
|
|
|
|
onclick="submitForm()">Submit</button>
|
|
|
|
|
</div>
|
2021-09-10 07:30:39 -07:00
|
|
|
|
</div>
|
|
|
|
|
</form>
|
2021-09-12 02:39:09 -07:00
|
|
|
|
{% endfor %}
|
2021-09-10 07:30:39 -07:00
|
|
|
|
</div>
|
2021-09-12 02:39:09 -07:00
|
|
|
|
<script src=" https://cdn.jsdelivr.net/npm/signature_pad@2.3.2/dist/signature_pad.min.js"></script>
|
2021-09-12 02:44:27 -07:00
|
|
|
|
<script type="text/javascript" src="/static/jquery.min.js"></script>
|
2021-09-10 07:30:39 -07:00
|
|
|
|
<script>
|
2021-09-12 02:39:09 -07:00
|
|
|
|
var signaturePad, selPeriod;
|
2021-09-10 07:30:39 -07:00
|
|
|
|
function submitForm() {
|
|
|
|
|
if (!signaturePad.isEmpty()) {
|
2021-09-13 07:42:12 -07:00
|
|
|
|
loadingAnimation();
|
2021-09-10 07:30:39 -07:00
|
|
|
|
signaturePad.off();
|
|
|
|
|
var data = signaturePad.toDataURL('image/png');
|
2021-09-12 02:39:09 -07:00
|
|
|
|
document.getElementById("attendanceData^" + selPeriod).getElementsByClassName("signatureData")[0].value = data;
|
|
|
|
|
document.getElementById("attendanceData^" + selPeriod).submit();
|
2021-09-10 07:30:39 -07:00
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
alert("Please sign first");
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-09-12 02:39:09 -07:00
|
|
|
|
function viewSignature(period) {
|
|
|
|
|
selPeriod = period
|
|
|
|
|
$('.viewSignatureBtn').attr({ 'disabled': 'disabled' });
|
|
|
|
|
$('.viewSignatureBtn').removeClass('margin-bottom');
|
|
|
|
|
document.getElementById('sign^' + period).removeAttribute('hidden');
|
2021-09-12 07:21:10 -07:00
|
|
|
|
var cnt = 0;
|
|
|
|
|
$('.tobeform').each(function (i, obj) {
|
|
|
|
|
if ($(this).is(":checked")) {
|
|
|
|
|
cnt++;
|
|
|
|
|
$('#postHomeroomAbs').append('<input type="checkbox" name="' + $(this).attr('class').split(' ')[1].split('^')[1]
|
|
|
|
|
+ '" checked="checked">');
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
if (cnt == 0) {
|
|
|
|
|
$('#allPresentWarning').removeAttr('hidden');
|
|
|
|
|
}
|
|
|
|
|
|
2021-09-12 02:39:09 -07:00
|
|
|
|
var canvas = document.getElementById("signature_pad^" + period);
|
|
|
|
|
signaturePad = new SignaturePad(canvas);
|
|
|
|
|
function resizeCanvas() {
|
|
|
|
|
var ratio = Math.max(window.devicePixelRatio || 1, 1);
|
|
|
|
|
canvas.width = canvas.offsetWidth * ratio;
|
|
|
|
|
canvas.height = canvas.offsetHeight * ratio;
|
|
|
|
|
canvas.getContext("2d").scale(ratio, ratio);
|
|
|
|
|
signaturePad.clear(); // otherwise isEmpty() might return incorrect value
|
|
|
|
|
}
|
|
|
|
|
window.addEventListener("resize", resizeCanvas);
|
|
|
|
|
resizeCanvas();
|
|
|
|
|
}
|
2021-09-13 07:42:12 -07:00
|
|
|
|
function unCheckAbs(string) {
|
|
|
|
|
document.getElementById('absent^' + string).checked = false;
|
|
|
|
|
}
|
|
|
|
|
function unCheckLate(string) {
|
|
|
|
|
document.getElementById('late^' + string).checked = false;
|
|
|
|
|
}
|
2021-09-10 07:30:39 -07:00
|
|
|
|
</script>
|
|
|
|
|
<div id="loading" style="text-align:center; width:100%; display:none;"><img src="/static/loading.gif" alt=""
|
2021-09-14 03:42:17 -07:00
|
|
|
|
style="width:100%;" />
|
2021-09-09 06:29:31 -07:00
|
|
|
|
</div>
|
2021-09-12 05:15:19 -07:00
|
|
|
|
<footer>
|
|
|
|
|
<hr>
|
|
|
|
|
<p style="text-align: center;">© 2021 Attendance (β) | Made by <a target="_blank"
|
2021-09-13 07:42:12 -07:00
|
|
|
|
href="https://github.com/aaronleetw">Aaron Lee 李翊愷</a> for <a target="_blank"
|
2021-09-12 05:15:19 -07:00
|
|
|
|
href="https://www.fhjh.tp.edu.tw">Taipei Fuhsing Private School</a>
|
2021-09-12 05:31:32 -07:00
|
|
|
|
<br>
|
2021-09-13 07:42:12 -07:00
|
|
|
|
Consultants: Mr. Raymond Tsai 蔡瑋倫老師, Alvin Tsao 曹庭睿
|
2021-09-12 05:15:19 -07:00
|
|
|
|
</p>
|
|
|
|
|
</footer>
|
2021-09-10 07:30:39 -07:00
|
|
|
|
<script>
|
|
|
|
|
function loadingAnimation() {
|
|
|
|
|
$("div.container").hide();
|
|
|
|
|
$('#loading').show();
|
|
|
|
|
}
|
|
|
|
|
function chgDate(sel) {
|
|
|
|
|
loadingAnimation();
|
|
|
|
|
document.getElementById('dateSelForm').submit();
|
|
|
|
|
}
|
|
|
|
|
</script>
|
2021-09-09 06:29:31 -07:00
|
|
|
|
</body>
|
|
|
|
|
|
|
|
|
|
</html>
|