-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
148 lines (115 loc) · 4.24 KB
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
from flask import Flask, render_template, session, redirect, url_for, request
app = Flask(__name__, static_url_path="/static")
app.secret_key = "mereallywannaloveAWSrn"
def get_username():
if "username" in session: return session["username"]
return False
@app.route("/")
def index():
username = get_username()
if not username:
return redirect(url_for("login"))
return redirect(url_for("setup"))
#return render_template("index.html")
@app.route("/setup", methods=["GET", "POST"])
def setup():
username = get_username()
if not username:
return redirect(url_for("login"))
if request.method == "GET":
#return render_template("setup.html",myname = session["name"])
return render_template("details.html")
else:
session["name"] = request.form["name"]
session["date"] = request.form["date"]
return redirect(url_for("loading",functiontocall = "medicalsummary"))
@app.route("/loading/<functiontocall>")
def loading(functiontocall):
return render_template("loader.html",nextfunc = functiontocall, themessage="Getting your details")
@app.route("/loading2/<functiontocall>")
def loading2(functiontocall):
return render_template("loader.html",nextfunc = functiontocall,themessage="Processing... hold tight!")
@app.route("/medicalsummary")
def medicalsummary():
return render_template("medicalsummary.html",myname = session["name"],mydate = session["date"])
@app.route("/budget", methods=["GET", "POST"])
def budget():
if request.method == "GET":
return render_template("budget.html")
else:
session["budget"] = request.form["budget"]
return redirect(url_for("singpass_and_dbs"))
@app.route("/pullexternaldata")
def singpass_and_dbs():
return render_template("externaldata.html")
@app.route("/datasummary")
def summary_data():
return render_template("datasummary.html")
@app.route("/dashboard_intro")
def dashboard_intro():
return render_template("dashboard_intro.html")
@app.route("/view/<scheme_name>")
def view_schemes(scheme_name):
if scheme_name == "CareshieldLife":
return render_template("scheme1.html")
elif scheme_name == "MedishieldLife":
return render_template("scheme2.html")
elif scheme_name == "Eldershield":
return render_template("scheme3.html")
@app.route("/dashboard")
def dashboard2():
return render_template("dashboard.html")
@app.route("/reminder")
def remind():
return render_template("reminder.html")
@app.route("/login", methods=["GET", "POST"])
def login():
username = get_username()
if username:
return redirect(url_for("index"))
if request.method == "GET":
return render_template("login.html")
else:
session["username"] = username = request.form["username"]
password = request.form["password"]
return redirect(url_for("index"))
#if db.login(username, hash(password)):
# session["username"] = username
# return redirect(url_for("index"))
#return render_template("login.html", error="Invalid Username or Password")
@app.route("/logout")
def logout():
session.pop("username", None)
return redirect(url_for("login"))
@app.route("/register", methods=["GET", "POST"])
def register():
username = get_username()
if username:
return redirect(url_for("index"))
if request.method == "GET":
return redirect(url_for("login"))
else:
username = request.form["username"]
password = request.form["password"]
password = request.form["confirm"]
return redirect(url_for("login"))
#password = hash(password)
#if db.register(username, pnumber, email, password):
# return redirect(url_for("login"))
#return render_template("signup.html", error="Username taken!")
"""
@app.route("/details", methods=["GET", "POST"])
def details():
if request.method == "GET":
return render_template("details.html")
else:
return redirect(url_for("bills"))
@app.route("/bills", methods=["GET", "POST"])
def bills():
if request.method == "GET":
return render_template("bills.html")
else:
return redirect(url_for("bills"))
"""
if __name__ == "__main__":
app.run(debug=True)