raise(e)
return render_template("error.html", data=e)
+@app.post("/mark")
+def mark():
+ if((ret:=problem())!="go"):
+ return ret
+ try:
+ cursor=get_db().cursor()
+ (ok, data)=vaccination.mark(cursor, request.form["vid"], True)
+ if(not ok):
+ raise Exception(data)
+ return redirect("/vaccination/view/"+str(request.form["vid"]))
+ except Exception as e:
+ raise(e)
+ return render_template("error.html", data=e)
@app.get("/advice/<action>")
@app.get("/advice/<action>/<id>")
</table>
<a href="/vaccination/edit/{{data["vid"]}}" class="btn btn-primary">Edit</a>
<a href="/delete/vaccination/{{data["vid"]}}" class="btn btn-danger delete-link">Delete</a>
- </table>
+ {%if not data["given"]%}
+ <form action="/mark" method="post" class="mt-4"><input type="hidden" name="vid" value="{{data["vid"]}}"><button type="submit" class="btn btn-warning">Mark Administered</button></form>
+ {%endif%}
{% endif %}
</div>
except Exception as e:
return (False, e)
+def mark(cursor, vid, given):
+ try:
+ cursor.execute("UPDATE vaccination SET given=? WHERE vid=?", (given, vid))
+ if(cursor.rowcount==0):
+ return (False, "Failed to update record.")
+ else:
+ return (True, cursor.lastrowid)
+ except Exception as e:
+ return (False, e)
+
def list_by_patient(cursor, pid):
try:
result=cursor.execute("SELECT * FROM vaccination LEFT JOIN inventory ON vaccination.iid=inventory.iid WHERE pid=? ORDER BY vaccination.date", (pid,))