2021-09-10 07:30:39 -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>Homeroom_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">
|
2021-09-12 02:39:09 -07:00
|
|
|
<link rel="stylesheet" href="/static/homeroom.css">
|
2021-09-10 07:30:39 -07:00
|
|
|
</head>
|
|
|
|
|
|
|
|
<body>
|
|
|
|
<div class="container">
|
|
|
|
<h1>Homeroom_View</h1>
|
|
|
|
<h2>{{homeroomCode[0]}}: {{homeroomCode[1]}}</h2>
|
2021-09-12 02:39:09 -07:00
|
|
|
<h2>Status: ({{currDate}}, 星期{{absData[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();">
|
2021-09-12 02:39:09 -07:00
|
|
|
{% for date in absData %}
|
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>
|
|
|
|
<form action="/manage/homeroom_confirm" id="homeroom_confirm" method="post">
|
|
|
|
<input type="hidden" name="date" value="{{currDate}}">
|
2021-09-12 02:39:09 -07:00
|
|
|
<input type="hidden" name="homeroom" value="{{homeroomCode[0]}}^{{homeroomCode[1]}}">
|
|
|
|
<input type="hidden" id="hrCfrm-sign" name="signatureData" value="">
|
2021-09-10 07:30:39 -07:00
|
|
|
</form>
|
|
|
|
<div class="col">
|
|
|
|
<div class="row title">
|
2021-09-12 02:39:09 -07:00
|
|
|
<div class="col">HR</div>
|
2021-09-10 07:30:39 -07:00
|
|
|
<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">Morning</div>
|
|
|
|
<div class="col">1</div>
|
|
|
|
<div class="col">2</div>
|
|
|
|
<div class="col">3</div>
|
|
|
|
<div class="col">4</div>
|
|
|
|
<div class="col">Nap</div>
|
|
|
|
<div class="col">5</div>
|
|
|
|
<div class="col">6</div>
|
|
|
|
<div class="col">7</div>
|
|
|
|
<div class="col">8</div>
|
|
|
|
<div class="col">9</div>
|
|
|
|
</div>
|
|
|
|
<div class="row title">
|
|
|
|
<div class="col"></div>
|
|
|
|
<div class="col"></div>
|
|
|
|
<div class="col"></div>
|
|
|
|
<div class="col"></div>
|
|
|
|
{% for i in periods %}
|
|
|
|
<div class="col">{{absData[currDate][i]['name']}}</div>
|
|
|
|
{% endfor %}
|
|
|
|
</div>
|
|
|
|
<div class="row title">
|
|
|
|
<div class="col"></div>
|
|
|
|
<div class="col"></div>
|
|
|
|
<div class="col"></div>
|
|
|
|
<div class="col"></div>
|
|
|
|
{% for i in periods %}
|
|
|
|
<div class="col">{{absData[currDate][i]['teacher']}}</div>
|
|
|
|
{% endfor %}
|
2021-09-10 07:30:39 -07:00
|
|
|
</div>
|
|
|
|
{% if data != None %}
|
2021-09-12 02:39:09 -07:00
|
|
|
{% for i in homeroomData %}
|
2021-09-10 07:30:39 -07:00
|
|
|
<div class="row">
|
|
|
|
<div class="col">{{homeroomCode[0]}}{{homeroomCode[1]}}</div>
|
|
|
|
<div class="col">{{i}}</div>
|
2021-09-12 02:39:09 -07:00
|
|
|
<div class="col">{{ homeroomData[i]['name'] }}</div>
|
|
|
|
<div class="col">{{ homeroomData[i]['eng_name'] }}</div>
|
|
|
|
{% for j in periods %}
|
|
|
|
{% if 'signature' in absData[currDate][j] %}
|
|
|
|
{% if i in absData[currDate][j] %}
|
|
|
|
<div class="col">
|
|
|
|
<p class="highlightAbs n-2">X</p>
|
|
|
|
</div>
|
|
|
|
{% else %}
|
|
|
|
{% if absData[currDate][j]['name'] != 'GP' %}
|
2021-09-10 07:30:39 -07:00
|
|
|
<div class="col">
|
2021-09-12 02:39:09 -07:00
|
|
|
<p class="highlightAbs n-1">V</p>
|
2021-09-10 07:30:39 -07:00
|
|
|
</div>
|
2021-09-12 02:39:09 -07:00
|
|
|
{% else %}
|
|
|
|
{% if (homeroomData[i]['GP_Class'][absData[currDate][j]['teacher']] in
|
|
|
|
absData[currDate][j]['signature'])%}
|
|
|
|
<div class="col">
|
|
|
|
<p class="highlightAbs n-1">V</p>
|
|
|
|
</div>
|
|
|
|
{% else %}
|
|
|
|
<div class="col">
|
|
|
|
<p class="highlightAbs n-2"></p>
|
|
|
|
</div>
|
|
|
|
{% endif %}
|
|
|
|
{% endif %}
|
|
|
|
{% endif %}
|
|
|
|
{% elif absData[currDate][j]['name'] == 'GP' %}
|
|
|
|
<div class="col">
|
|
|
|
<p class="highlightAbs"></p>
|
|
|
|
</div>
|
|
|
|
{% else %}
|
|
|
|
<div class="col">
|
|
|
|
{% if 'confirm' in absData[currDate] %}
|
|
|
|
<p class="highlightAbs"></p>
|
|
|
|
{% else %}
|
|
|
|
<input type="checkbox" class="tobeform {{j}}^{{i}}">
|
|
|
|
{% endif %}
|
|
|
|
</div>
|
|
|
|
{% endif %}
|
|
|
|
{% endfor %}
|
2021-09-10 07:30:39 -07:00
|
|
|
</div>
|
|
|
|
{% endfor %}
|
2021-09-12 02:39:09 -07:00
|
|
|
<div class="row">
|
|
|
|
<div class="col"></div>
|
|
|
|
<div class="col"></div>
|
|
|
|
<div class="col"></div>
|
|
|
|
<div class="col"></div>
|
|
|
|
{% for i in periods %}
|
|
|
|
<div class="col">
|
|
|
|
{% if ('signature' in absData[currDate][i] or absData[currDate][i]['name'] == 'GP' or
|
|
|
|
'confirm' in absData[currDate]) %}
|
|
|
|
<button class="btn btn-primary afterSelButton" disabled="disabled"
|
|
|
|
onclick="afterSelAbs('{{i|string}}')">Confirm</button>
|
|
|
|
{% else %}
|
|
|
|
<button class="btn btn-primary afterSelButton"
|
|
|
|
onclick="afterSelAbs('{{i|string}}')">Confirm</button>
|
|
|
|
{% endif %}
|
|
|
|
</div>
|
|
|
|
{% endfor %}
|
|
|
|
</div>
|
|
|
|
{% endif %}
|
|
|
|
<form action="/manage/homeroom_abs" id="postHomeroomAbs" hidden="hidden" method="post">
|
|
|
|
<input type="text" id="HR-date" name="date" value="{{currDate}}">
|
|
|
|
<input type="text" id="HR-period" name="period" value="">
|
|
|
|
<input type="text" id="HR-signatureData" name="signatureData" value="">
|
|
|
|
<input type="text" id="HR-homeroom" name="homeroom" value="{{homeroomCode[0]}}^{{homeroomCode[1]}}">
|
|
|
|
</form>
|
|
|
|
{% if 'confirm' in absData[currDate] %}
|
|
|
|
<button class="btn btn-primary margin-top afterSelButton" onclick="homeroomCfrm()" disabled="disabled">
|
|
|
|
Already Confirmed</button>
|
|
|
|
{% else %}
|
|
|
|
<button class="btn btn-primary margin-top afterSelButton" onclick="homeroomCfrm()">Homeroom
|
|
|
|
Teacher Confirm</button>
|
2021-09-10 07:30:39 -07:00
|
|
|
{% endif %}
|
2021-09-12 02:39:09 -07:00
|
|
|
<div id="finalCheck" hidden="hidden">
|
|
|
|
<h3>Please Sign Below</h3>
|
|
|
|
<div class="forSign"><canvas id="signature_pad"></canvas></div>
|
|
|
|
<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>
|
|
|
|
{% for c in range(periods|length + 1) %}
|
2021-09-10 07:30:39 -07:00
|
|
|
{% if c % 2 == 0 %}
|
|
|
|
<div class="row signatures">
|
|
|
|
{% endif %}
|
|
|
|
<div class="col half">
|
2021-09-12 02:39:09 -07:00
|
|
|
{% if c == 0 %}
|
|
|
|
<div class="row">Homeroom Teacher</div>
|
|
|
|
<div class="row"><img src="{{absData[currDate]['confirm']}}" alt=""></div>
|
|
|
|
{% else %}
|
|
|
|
{% if absData[currDate][periods[c-1]]['name'] == 'GP' %}
|
|
|
|
{% if 'signature' in absData[currDate][periods[c-1]] %}
|
|
|
|
{% for i in absData[currDate][periods[c-1]]['signature'] %}
|
|
|
|
<div class="row">{{periods[c-1]}}: {{absData[currDate][periods[c-1]]['teacher']}}: {{i}}</div>
|
|
|
|
<div class="row"><img src="{{absData[currDate][periods[c-1]]['signature'][i]}}" alt=""></div>
|
|
|
|
{% endfor %}
|
|
|
|
{% else %}
|
|
|
|
<div class="row">{{periods[c-1]}}: {{absData[currDate][periods[c-1]]['teacher']}}: No Signature
|
|
|
|
</div>
|
|
|
|
<div class="row"></div>
|
|
|
|
{% endif %}
|
|
|
|
{% else %}
|
|
|
|
<div class="row">{{periods[c-1]}}: {{absData[currDate][periods[c-1]]['name']}}:
|
|
|
|
{{absData[currDate][periods[c-1]]['teacher']}}
|
2021-09-10 07:30:39 -07:00
|
|
|
</div>
|
2021-09-12 02:39:09 -07:00
|
|
|
<div class="row"><img src="{{absData[currDate][periods[c-1]]['signature']}}" alt=""></div>
|
|
|
|
{% endif %}
|
|
|
|
{% endif %}
|
2021-09-10 07:30:39 -07:00
|
|
|
</div>
|
|
|
|
{% if c % 2 == 1 %}
|
|
|
|
</div>
|
|
|
|
{% endif %}
|
|
|
|
{% endfor %}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<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
|
|
|
<div id="loading" style="text-align:center; width:100%; display:none;"><img src="/static/loading.gif" alt=""
|
|
|
|
style="height:100%;" />
|
|
|
|
</div>
|
2021-09-12 02:39:09 -07:00
|
|
|
|
2021-09-10 07:30:39 -07:00
|
|
|
<script>
|
2021-09-12 02:39:09 -07:00
|
|
|
var signaturePad, hrCfrm = false;
|
2021-09-10 07:30:39 -07:00
|
|
|
function loadingAnimation() {
|
|
|
|
$('.container').hide();
|
|
|
|
$('#loading').show();
|
|
|
|
}
|
|
|
|
function chgDate() {
|
|
|
|
loadingAnimation();
|
|
|
|
document.getElementById('dateSelForm').submit();
|
|
|
|
}
|
2021-09-12 02:39:09 -07:00
|
|
|
function submitForm() {
|
|
|
|
if (!signaturePad.isEmpty()) {
|
|
|
|
loadingAnimation()
|
|
|
|
signaturePad.off();
|
|
|
|
var data = signaturePad.toDataURL('image/png');
|
|
|
|
if (hrCfrm) {
|
|
|
|
$('#hrCfrm-sign').val(data);
|
|
|
|
document.getElementById('homeroom_confirm').submit()
|
|
|
|
} else {
|
|
|
|
document.getElementById('HR-signatureData').value = data;
|
|
|
|
document.getElementById('postHomeroomAbs').submit();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
alert("Please sign first");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
function showSignaturePad() {
|
|
|
|
$('#finalCheck').removeAttr('hidden');
|
|
|
|
var canvas = document.getElementById("signature_pad");
|
|
|
|
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();
|
|
|
|
}
|
|
|
|
function afterSelAbs(period) {
|
|
|
|
var tobeformArr = [];
|
|
|
|
$('#postHomeroomAbs #HR-period').val(period);
|
|
|
|
$('.tobeform').attr('disabled', 'disabled');
|
|
|
|
$('.afterSelButton').attr('disabled', 'disabled');
|
|
|
|
$('.tobeform').each(function (i, obj) {
|
|
|
|
if ($(this).attr('class').split(' ')[1].split('^')[0] == period &&
|
|
|
|
$(this).is(":checked")) {
|
|
|
|
$('#postHomeroomAbs').append('<input type="checkbox" name="' + $(this).attr('class').split(' ')[1].split('^')[1]
|
|
|
|
+ '" checked="checked">');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
// show signature pad
|
|
|
|
showSignaturePad()
|
|
|
|
}
|
|
|
|
function homeroomCfrm() {
|
|
|
|
hrCfrm = true;
|
|
|
|
showSignaturePad();
|
|
|
|
}
|
2021-09-10 07:30:39 -07:00
|
|
|
</script>
|
|
|
|
</body>
|
|
|
|
|
|
|
|
</html>
|