mirror of
https://github.com/aaronleetw/Attendance.git
synced 2024-11-14 19:11:39 -08:00
Add homeroom confirm notes functionality
This commit is contained in:
parent
bb9a5998eb
commit
f064fac7ac
3 changed files with 10 additions and 1 deletions
|
@ -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')
|
||||
|
|
|
@ -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 %}
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in a new issue