From dab46b862d4486addc00f059f9f39e0c022f7612 Mon Sep 17 00:00:00 2001 From: Yarne Coppens Date: Wed, 4 Sep 2024 11:34:22 +0200 Subject: [PATCH] Made it possible to switch payment type --- app.py | 4 +++ static/scripts/main.js | 5 ++++ templates/index.jinja | 2 +- templates/paycard.jinja | 60 +++++++++++++++++++++++++++++++++++++++++ templates/paycash.jinja | 4 +-- 5 files changed, 72 insertions(+), 3 deletions(-) create mode 100644 templates/paycard.jinja diff --git a/app.py b/app.py index b59c1e2..915bc87 100644 --- a/app.py +++ b/app.py @@ -12,3 +12,7 @@ def start(): @app.route("/pay_cash/") def pay_cash(price: int): return render_template('paycash.jinja', price=escape(price), api_url=api_url) + +@app.route("/pay_card/") +def pay_card(price: int): + return render_template('paycard.jinja', price=escape(price), api_url=api_url) \ No newline at end of file diff --git a/static/scripts/main.js b/static/scripts/main.js index 3326c6c..2361461 100644 --- a/static/scripts/main.js +++ b/static/scripts/main.js @@ -129,6 +129,11 @@ function payCash() { window.location.href = "/pay_cash/" + total_cost } +function payCard() { + const total_cost = document.getElementById('totalprice').innerHTML.replace('€ ','') + window.location.href = "/pay_card/" + total_cost +} + function toMain() { window.location.href = "/"; } \ No newline at end of file diff --git a/templates/index.jinja b/templates/index.jinja index 314d35b..1723b69 100644 --- a/templates/index.jinja +++ b/templates/index.jinja @@ -84,7 +84,7 @@
- +
diff --git a/templates/paycard.jinja b/templates/paycard.jinja new file mode 100644 index 0000000..20df887 --- /dev/null +++ b/templates/paycard.jinja @@ -0,0 +1,60 @@ + + + + + + + Toddler Shop + + + + + + + +
+
+
+ +
+
+
+
+
+
+
+ +
+
+

€ {{price}}

+
+
+
+
+
+
+
+ +
+
+
+ +
+
+ +
+ +
+ +
+
+
+ +
+
+
+ + + + + \ No newline at end of file diff --git a/templates/paycash.jinja b/templates/paycash.jinja index ec00104..63914ee 100644 --- a/templates/paycash.jinja +++ b/templates/paycash.jinja @@ -15,7 +15,7 @@
- +
@@ -34,7 +34,7 @@
- +