diff --git a/app.py b/app.py index 873b002..7566248 100644 --- a/app.py +++ b/app.py @@ -1,4 +1,5 @@ from flask import Flask, render_template +from markupsafe import escape app = Flask(__name__) @@ -6,3 +7,6 @@ app = Flask(__name__) def start(): return render_template('index.jinja') +@app.route("/pay_cash/") +def pay_cash(price: int): + return render_template('paycash.jinja', price=escape(price)) diff --git a/static/scripts/main.js b/static/scripts/main.js index 591eeb8..b6007b9 100644 --- a/static/scripts/main.js +++ b/static/scripts/main.js @@ -18,6 +18,25 @@ async function makeAPIRequest(request) { } } +async function loadCash(price) { + const cashAmountRequest = new Request(api_url + '/price_to_cash/' + price) + const cashAmount = await makeAPIRequest(cashAmountRequest) + + const cash_bills_row = document.getElementById('cash_bills') + + for (var bill_type in cashAmount){ + bill_amount = cashAmount[bill_type] + console.log(bill_type, bill_amount) + for (var x = 0; x < bill_amount; x++){ + const new_column = document.createElement('div') + new_column.classList.add('col') + new_column.innerHTML = bill_type + cash_bills_row.appendChild(new_column) + } + } + +} + async function loadProducts() { const loadProductRequest = new Request(api_url + "/products") all_products = await makeAPIRequest(loadProductRequest) diff --git a/static/style/main.css b/static/style/main.css index 29b9a00..4a10be8 100644 --- a/static/style/main.css +++ b/static/style/main.css @@ -1,3 +1,7 @@ +body{ + background-color: #D9F2D0; +} + div.card{ background-color: #afda8e; } diff --git a/templates/index.jinja b/templates/index.jinja index 1ddba30..de4c69f 100644 --- a/templates/index.jinja +++ b/templates/index.jinja @@ -7,11 +7,11 @@ Toddler Shop - + - +
diff --git a/templates/paycash.jinja b/templates/paycash.jinja new file mode 100644 index 0000000..b62790b --- /dev/null +++ b/templates/paycash.jinja @@ -0,0 +1,48 @@ + + + + + + + Toddler Shop + + + + + + + +
+
+
+ +
+
+
+
+
+
+
+ +
+
+

€ {{price}}

+
+
+
+
+
+
+
+ +
+
+
+ +
+
+ + + + + \ No newline at end of file