Skip to content

Commit

Permalink
Final Commit
Browse files Browse the repository at this point in the history
Ensuring everything is on the backup git before the deadline
  • Loading branch information
nagrag4 committed Dec 3, 2024
1 parent 85774c9 commit 631135a
Show file tree
Hide file tree
Showing 30 changed files with 1,079 additions and 0 deletions.
39 changes: 39 additions & 0 deletions Templates/addstock.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Stock inventory update</title>
</head>
<body>
<H1>Stock inventory update</H1>
<!--This is the code for the form of adding new stock, what it contains is basically html form where user inputs their desired values and it provides them to the updatenewstock() function from main.py to do further actions-->
<p><a href="{{url_for('stocklevel')}}"><button>Return to previous screen</button></a></p>
<P>Please enter your desired book to add to stock, please note you can only add genuine books without a duplicate code:</P>
<form action="{{page}}" method="post">
<label for="aiidd">ID:</label><br>
<input type="text" id="aiidd" name="aiidd"><br>
<label for="bname">Book name:</label><br>
<input type="text" id="bname" name="bname"><br>
<label for="aauth">Author:</label><br>
<input type="text" id="aauth" name="aauth"><br>
<label for="ddate">Publication date:</label><br>
<input type="date" id="ddate" name="ddate"><br>
<label for="ccode">ISBN-13:</label><br>
<input type="text" id="ccode" name="ccode"><br><br>
<label for="ddscr">Description:</label><br>
<textarea id="ddscr" name="ddscr" rows="4" cols="30"></textarea><br>
<label for="iidir">Image directory:</label><br>
<input type="text" id="iidir" name="iidir" value='product-images/'><br>
<label for="tprice">Trading price:</label><br>
<input type="range" min="1" max="100" id="tprice" name="tprice" oninput="this.nextElementSibling.value = this.value"><output>50</output><br> <!--oninput shows the value of the slider to the user, to reference this thing was taken from this website https://stackoverflow.com/questions/10004723/html5-input-type-range-show-range-value-->
<label for="aprice">Retail price:</label><br>
<input type="range" id="aprice" name="aprice" oninput="this.nextElementSibling.value = this.value"><output>50</output><br><!--oninput shows the value of the slider to the user, to reference this thing was taken from this website https://stackoverflow.com/questions/10004723/html5-input-type-range-show-range-value-->
<label for="quant">Quantity:</label><br>
<input type="range" min="1" max="20" id="quant" name="quant" oninput="this.nextElementSibling.value = this.value"><output>10</output><br><!--oninput shows the value of the slider to the user, to reference this thing was taken from this website https://stackoverflow.com/questions/10004723/html5-input-type-range-show-range-value-->
<input type="submit" value="Submit">
</form>
<!-- Below are buttons which will redirect the user to the main stock page and the home page if they click them, by doing this it will return them to the url for a different page -->
<p><a href="{{url_for('.stocklevel')}}"><button>Stock</button></a></p>
<p><a href="{{url_for('.home')}}"><button>Home</button></a></p>

</body>
</html>
209 changes: 209 additions & 0 deletions Templates/adminProducts.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,209 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>BookShop - Admin Page</title>
<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">
<link href="{{ url_for('static', filename='css/style.css') }}" rel="stylesheet" type="text/css" />
<style>
body {
font-family: Arial, sans-serif;
background-color: #f8f8f8;
margin: 0;
padding: 20px;
}
#admin-header {
background-color: #4CAF50;
color: white;
padding: 10px;
text-align: center;
margin-bottom: 20px;
}
h1 {
margin: 0;
}
#shopping-cart {
background-color: #fff;
padding: 15px;
border-radius: 5px;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
margin-bottom: 20px;
}
.txt-heading {
font-size: 24px;
margin-bottom: 10px;
}
table {
width: 100%;
border-collapse: collapse;
margin-bottom: 20px;
}
th, td {
padding: 12px;
text-align: left;
border-bottom: 1px solid #ddd;
}
th {
background-color: #f2f2f2;
}
#payment-form {
background-color: #f9f9f9;
padding: 15px;
border-radius: 5px;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}
label {
display: block;
margin: 10px 0 5px;
}
input[type="text"], input[type="submit"] {
width: calc(100% - 20px);
padding: 10px;
margin-bottom: 15px;
border: 1px solid #ccc;
border-radius: 4px;
}
input[type="submit"] {
background-color: #4CAF50;
color: white;
border: none;
cursor: pointer;
}
input[type="submit"]:hover {
background-color: #45a049;
}
.product-item {
display: inline-block;
width: 30%;
margin: 1%;
background-color: #fff;
border-radius: 5px;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
padding: 10px;
text-align: center;
}
.product-title {
font-size: 18px;
margin: 10px 0;
}
.product-price {
font-size: 16px;
color: #333;
}
.btnRemoveAction {
text-decoration: none;
}
.no-records {
text-align: center;
margin: 20px;
font-size: 18px;
}
</style>
</head>
<body>
<div>
{% with messages = get_flashed_messages() %}
{% if messages %}
<ul class="flashes">
{% for message in messages %}
<li>{{ message }}</li>
{% endfor %}
</ul>
{% endif %}
{% endwith %}
</div>

<!-- Admin Page Heading and Stock Button -->
<div id="admin-header">
<h1>Administrator Page</h1>
<p><a href="{{url_for('.stocklevel')}}"><button>Stock</button></a></p>
</div>

<!-- Shopping Cart Section -->
<div id="shopping-cart">
<div class="txt-heading">Shopping Cart</div>

{% if 'cart_item' in session %}
<a id="btnEmpty" href="{{ url_for('.empty_cart') }}">Empty Cart</a>
<table class="tbl-cart">
<tbody>
<tr>
<th>Name</th>
<th>Code</th>
<th style="text-align:right;" width="5%">Quantity</th>
<th style="text-align:right;" width="10%">Unit Price</th>
<th style="text-align:right;" width="10%">Price</th>
<th style="text-align:center;" width="5%">Remove</th>
</tr>
{% for key, val in session['cart_item'].items() %}
{% set quantity = session['cart_item'][key]['quantity'] %}
{% set price = session['cart_item'][key]['price'] %}
{% set item_price = session['cart_item'][key]['total_price'] %}
<tr>
<td><img src="/static/images/{{ session['cart_item'][key]['image'] }}" class="cart-item-image" />{{ session['cart_item'][key]['name'] }}</td>
<td>{{ session['cart_item'][key]['code'] }}</td>
<td style="text-align:right;">{{ quantity }}</td>
<td style="text-align:right;">&#8356; {{ price }}</td>
<td style="text-align:right;">&#8356; {{ item_price }}</td>
<td style="text-align:center;">
<a href="{{ url_for('.delete_product', code=session['cart_item'][key]['code']) }}" class="btnRemoveAction">
<img src="./images/product-images/product-images/hobbit.jpg/" alt="Remove Item" />
</a>
</td>
</tr>
{% endfor %}
<tr>
<td colspan="2" align="right">Total:</td>
<td align="right">{{ session['all_total_quantity'] }}</td>
<td align="right" colspan="2"><strong>&#8356; {{ session['all_total_price'] }}</strong></td>
<td></td>
</tr>
</tbody>
</table>

<!-- Payment Form -->
<div id="payment-form">
<h2>Enter Payment Information</h2>
<form action="{{ url_for('checkout') }}" method="POST">
<label for="card_number">Card Number:</label>
<input type="text" id="card_number" name="card_number" maxlength="16" placeholder="1234 5678 9012 3456" required>

<label for="expiry_date">Expiry Date:</label>
<input type="text" id="expiry_date" name="expiry_date" placeholder="MM/YY" required>

<label for="cvv">CVV:</label>
<input type="text" id="cvv" name="cvv" maxlength="3" placeholder="123" required>

<input type="submit" value="Pay Now">
<p>Amount to be paid: &#163; {{ session['all_total_price'] }}</p>
</form>
</div>

{% else %}
<div class="no-records">Your Cart is Empty</div>
{% endif %}
</div>

<!-- Product Display Section -->
<div id="product-grid">
<div class="txt-heading">Products</div>
{% for product in products %}
<div class="product-item">
<form method="post" action="/add">
<div><img src="/static/images/{{ product[3] }}" class="product-image"></div>
<div class="product-tile-footer">
<div class="product-title">{{ product[1] }}</div>
<div class="product-price">&#163; {{ product[4] }}</div>
<div class="cart-action">
<input type="hidden" name="code" value="{{ product[2] }}"/>
<input type="text" class="product-quantity" name="quantity" value="1" size="2" />
<input type="submit" value="Add to Cart" class="btnAddAction" />
</div>
</div>
</form>
</div>
{% endfor %}
</div>
</body>
</html>
18 changes: 18 additions & 0 deletions Templates/login.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Login</title>
</head>
<body>
<!-- This will generate a small form in which the user is able to enter details and submit them for the main app to then check -->
<H1>Login</H1>
<P>Please enter your username and password:</P>
<form action="{{page}}" method="post">
<label for="uname">Username:</label><br>
<input type="text" id="uname" name="uname" value="Logger"><br>
<label for="pwd">Password:</label><br>
<input type="text" id="pwd" name="pwd" value="Password"><br><br>
<input type="submit" value="Submit">
</form>
</body>
</html>
14 changes: 14 additions & 0 deletions Templates/payment_success.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!DOCTYPE html>
<html>
<head>
<title>Payment Success</title>
<link href="{{ url_for('static', filename='css/style.css') }}" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="payment-success">
<h1>Payment Successful!</h1>
<p>Thank you for your purchase. Your order has been successfully placed.</p>
<a href="{{ url_for('.home') }}">Return to Home</a>
</div>
</body>
</html>
105 changes: 105 additions & 0 deletions Templates/products.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
<!DOCTYPE html>
<html>
<head>
<title>BookShop - Checkout</title>
<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">
<link href="{{ url_for('static', filename='css/style.css') }}" rel="stylesheet" type="text/css" />
</head>
<body>
<div>
{% with messages = get_flashed_messages() %}
{% if messages %}
<ul class=flashes>
{% for message in messages %}
<li>{{ message }}</li>
{% endfor %}
</ul>
{% endif %}
{% endwith %}
</div>

<div id="shopping-cart">
<div class="txt-heading">Shopping Cart</div>

{% if 'cart_item' in session %}
<a id="btnEmpty" href="{{ url_for('.empty_cart') }}">Empty Cart</a>
<table class="tbl-cart" cellpadding="10" cellspacing="1">
<tbody>
<tr>
<th style="text-align:left;">Name</th>
<th style="text-align:left;">Code</th>
<th style="text-align:right;" width="5%">Quantity</th>
<th style="text-align:right;" width="10%">Unit Price</th>
<th style="text-align:right;" width="10%">Price</th>
<th style="text-align:center;" width="5%">Remove</th>
</tr>
{% for key, val in session['cart_item'].items() %}
{% set quantity = session['cart_item'][key]['quantity'] %}
{% set price = session['cart_item'][key]['price'] %}
{% set item_price = session['cart_item'][key]['total_price'] %}
<tr>
<td><img src="/static/images/{{ session['cart_item'][key]['image'] }}" class="cart-item-image" />{{ session['cart_item'][key]['name'] }}</td>
<td>{{ session['cart_item'][key]['code'] }}</td>
<td style="text-align:right;">{{ quantity }}</td>
<td style="text-align:right;">&#8356; {{ price }}</td>
<td style="text-align:right;">&#8356; {{ item_price }}</td>
<td style="text-align:center;">
<a href="{{ url_for('.delete_product', code=session['cart_item'][key]['code']) }}" class="btnRemoveAction">
<img src="/static/images/icon-delete.png" alt="Remove Item" />
</a>
</td>
</tr>
{% endfor %}
<tr>
<td colspan="2" align="right">Total:</td>
<td align="right">{{ session['all_total_quantity'] }}</td>
<td align="right" colspan="2"><strong>&#8356; {{ session['all_total_price'] }}</strong></td>
<td></td>
</tr>
</tbody>
</table>

<!-- Payment Form -->
<div id="payment-form">
<h2>Enter Payment Information</h2>
<form action="{{ url_for('checkout') }}" method="POST">
<label for="card_number">Card Number:</label><br>
<input type="text" id="card_number" name="card_number" maxlength="16" placeholder="1234 5678 9012 3456" required><br><br>

<label for="expiry_date">Expiry Date:</label><br>
<input type="text" id="expiry_date" name="expiry_date" placeholder="MM/YY" required><br><br>

<label for="cvv">CVV:</label><br>
<input type="text" id="cvv" name="cvv" maxlength="3" placeholder="123" required><br><br>

<input type="submit" value="Pay Now">
<p>Amount to be paid: &#163; {{ session['all_total_price'] }}</p>
</form>
</div>

{% else %}
<div class="no-records">Your Cart is Empty</div>
{% endif %}
</div>

<div id="product-grid">
<div class="txt-heading">Products</div>
{% for product in products %}
<div class="product-item">
<form method="post" action="/add">
<div><img src="/static/images/{{ product[3] }}" class="product-image"></div>
<div class="product-tile-footer">
<div class="product-title">{{ product[1] }}</div>
<div class="product-price">&#163; {{ product[4] }}</div>
<div class="cart-action">
<input type="hidden" name="code" value="{{ product[2] }}"/>
<input type="text" class="product-quantity" name="quantity" value="1" size="2" />
<input type="submit" value="Add to Cart" class="btnAddAction" />
</div>
</div>
</form>
</div>
{% endfor %}
</div>
</body>
</html>
1 change: 1 addition & 0 deletions Templates/readme.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
423
Loading

0 comments on commit 631135a

Please sign in to comment.