geethareddy commited on
Commit
eb88f8b
·
verified ·
1 Parent(s): 4d0a5a5

Create cart_page.html

Browse files
Files changed (1) hide show
  1. templates/cart_page.html +110 -0
templates/cart_page.html ADDED
@@ -0,0 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Cart - Biryani Hub</title>
7
+ <style>
8
+ body {
9
+ font-family: Arial, sans-serif;
10
+ background-color: #f8f8f8;
11
+ margin: 0;
12
+ padding: 0;
13
+ }
14
+
15
+ .cart-container {
16
+ max-width: 800px;
17
+ margin: 0 auto;
18
+ padding: 20px;
19
+ background-color: #fff;
20
+ box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
21
+ border-radius: 8px;
22
+ margin-top: 50px;
23
+ }
24
+
25
+ h1 {
26
+ text-align: center;
27
+ font-size: 2.5rem;
28
+ color: #333;
29
+ margin-bottom: 20px;
30
+ }
31
+
32
+ .cart-item {
33
+ border-bottom: 1px solid #eee;
34
+ padding: 15px 0;
35
+ }
36
+
37
+ .cart-total {
38
+ font-size: 1.5rem;
39
+ font-weight: bold;
40
+ text-align: right;
41
+ margin-top: 20px;
42
+ }
43
+
44
+ .checkout-btn {
45
+ display: block;
46
+ width: 100%;
47
+ padding: 15px;
48
+ font-size: 1.2rem;
49
+ background-color: #4CAF50;
50
+ color: white;
51
+ border: none;
52
+ border-radius: 5px;
53
+ cursor: pointer;
54
+ text-align: center;
55
+ }
56
+
57
+ .checkout-btn:hover {
58
+ background-color: #45a049;
59
+ }
60
+ </style>
61
+ </head>
62
+ <body>
63
+
64
+ <div class="cart-container">
65
+ <h1>Your Cart</h1>
66
+
67
+ <div id="cart-items">
68
+ <!-- Cart items will be inserted here dynamically -->
69
+ </div>
70
+
71
+ <div class="cart-total" id="cart-total">Total: $0.00</div>
72
+
73
+ <button class="checkout-btn" onclick="proceedToCheckout()">Proceed to Checkout</button>
74
+ </div>
75
+
76
+ <script>
77
+ let cart = JSON.parse(localStorage.getItem("cart")) || [];
78
+
79
+ function loadCart() {
80
+ let cartHTML = "";
81
+ let total = 0;
82
+
83
+ cart.forEach((item, index) => {
84
+ total += item.price * item.quantity;
85
+ cartHTML += `
86
+ <div class="cart-item">
87
+ <h3>${item.name}</h3>
88
+ <p>Quantity: ${item.quantity}</p>
89
+ <p>Price: $${item.price.toFixed(2)}</p>
90
+ </div>
91
+ `;
92
+ });
93
+
94
+ document.getElementById("cart-items").innerHTML = cartHTML;
95
+ document.getElementById("cart-total").innerText = `Total: $${total.toFixed(2)}`;
96
+ }
97
+
98
+ function proceedToCheckout() {
99
+ if (cart.length === 0) {
100
+ alert("Your cart is empty!");
101
+ return;
102
+ }
103
+ window.location.href = "/order-summary";
104
+ }
105
+
106
+ window.onload = loadCart;
107
+ </script>
108
+
109
+ </body>
110
+ </html>