Add homeroom confirm notes functionality

This commit is contained in:
Aaron Lee 2021-10-07 16:27:32 +08:00
parent bb9a5998eb
commit f064fac7ac
3 changed files with 10 additions and 1 deletions

View file

@ -295,8 +295,13 @@ def homeroom_confirm():
if (check_login_status()):
return redirect('/logout')
refresh_token()
date = request.form['date']
homeroom = request.form['homeroom'].split('^')
date = request.form['date']
if 'notes' in request.form:
notes = request.form['notes']
db.child("Homerooms").child(homeroom[0]).child(homeroom[1]).child(
"Absent").child(date).update({"notes": notes}, session['token'])
signature = request.form['signatureData']
signature = removeprefix(signature, 'data:image/png;base64,')
signature = bytes(signature, 'utf-8')

View file

@ -149,6 +149,7 @@
<div class="row needborder">Homeroom Teacher 導師</div>
{% if 'confirm' in absData[currDate] %}
<div class="row"><img src="{{absData[currDate]['confirm']}}" alt=""></div>
<div class="row">備註: {{absData[currDate]['notes']}}</div>
{% else %}
<div class="row"><span style="color:red;">No Signature 導師尚未簽名</span></div>
{% endif %}

View file

@ -46,6 +46,7 @@
<input type="hidden" name="date" value="{{currDate}}">
<input type="hidden" name="homeroom" value="{{homeroomCode[0]}}^{{homeroomCode[1]}}">
<input type="hidden" id="hrCfrm-sign" name="signatureData" value="">
<input type="hidden" id="hrCfrm-notes" name="notes" value="">
</form>
<div class="col">
<div class="sticky-top" style="background-color:white;">
@ -181,6 +182,7 @@
<div class="row needborder">Homeroom Teacher 導師</div>
{% if 'confirm' in absData[currDate] %}
<div class="row"><img src="{{absData[currDate]['confirm']}}" alt=""></div>
<div class="row">備註: {{absData[currDate]['notes']}}</div>
{% else %}
<div class="row"><span style="color:red;">No Signature 導師尚未簽名</span></div>
{% endif %}
@ -246,6 +248,7 @@
var data = signaturePad.toDataURL('image/png');
if (hrCfrm) {
$('#hrCfrm-sign').val(data);
$('#hrCfrm-notes').val($('#subjectNotes').val());
document.getElementById('homeroom_confirm').submit()
} else {
var notes = $('#subjectNotes').val();