diff --git a/manage.py b/manage.py index 8da7130..e5d60b4 100644 --- a/manage.py +++ b/manage.py @@ -269,6 +269,15 @@ def homeroom_abs_publish(): homeroom = request.form['homeroom'].split('^') period = request.form['period'] signature = request.form['signatureData'] + if (request.form['stype'] == 'edit'): + oldData = list(db.child("Homerooms").child(homeroom[0]).child(homeroom[1]).child( + "Absent").child(date).child(period).shallow().get(session['token']).val()) + print(oldData, type(oldData)) + for k in oldData: + if k == 'name' or k == 'teacher': + continue + db.child("Homerooms").child(homeroom[0]).child(homeroom[1]).child( + "Absent").child(date).child(period).child(k).remove(session['token']) formData = request.form.to_dict() notes = "" if "confirm" in db.child("Homerooms").child(homeroom[0]).child(homeroom[1]).child("Absent").child(date).get(session['token']).val(): @@ -288,6 +297,7 @@ def homeroom_abs_publish(): formData.pop('date') formData.pop('homeroom') formData.pop('period') + formData.pop('stype') for i in formData: i = i.split('^') db.child("Homerooms").child(homeroom[0]).child( diff --git a/templates/homeroom.html b/templates/homeroom.html index 9873ddf..a871caf 100644 --- a/templates/homeroom.html +++ b/templates/homeroom.html @@ -81,23 +81,23 @@
{{ homeroomData[i]['name'] }}
{{ homeroomData[i]['eng_name'] }}
{% for j in periods %} -
+
{% if 'signature' in absData[currDate][j] %} {% if i in absData[currDate][j] %} {% if absData[currDate][j][i] == 1 %} -

X

+

X

{% else %} -

𝜑

+

𝜑

{% endif %} {% else %} {% if absData[currDate][j]['name'] != 'GP' %} -

V

+

V

{% else %} {% if (homeroomData[i]['GP_Class'][absData[currDate][j]['teacher']] in absData[currDate][j]['signature'])%} -

V

+

V

{% else %} -

+

{% endif %} {% endif %} {% endif %} @@ -124,14 +124,15 @@
{% for i in periods %} -
- {% if ('signature' in absData[currDate][i] or absData[currDate][i]['name'] == 'GP' or - 'confirm' in absData[currDate]) %} - +
+ {% if (absData[currDate][i]['name'] == 'GP' or 'confirm' in absData[currDate]) %} + + {% elif ('signature' in absData[currDate][i]) %} + {% else %} + onclick="afterSelAbs('{{i|string}}', 'newSubmit')">Confirm
{{absData[currDate][i]['name']}} {% endif %}
{% endfor %} @@ -142,6 +143,7 @@ + {% if 'confirm' in absData[currDate] %} "); + } + function homeroomCfrm() { + hrCfrm = true; + $('.tobeform').attr('disabled', 'disabled'); + $('.afterSelButton').attr('disabled', 'disabled'); + showSignaturePad(); + } + function unCheckLate(string) { + document.getElementById('late^' + string).checked = false; + } + function unCheckAbs(string) { + document.getElementById('absent^' + string).checked = false; + }