-
Notifications
You must be signed in to change notification settings - Fork 1
/
checkout.html
216 lines (188 loc) · 10.1 KB
/
checkout.html
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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Checkout - BestBites</title>
<link rel="icon" type="image/x-icon" href="logo.png">
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/font/bootstrap-icons.css">
<link rel="stylesheet" href="style.css">
<link rel='stylesheet' href='https://cdn-uicons.flaticon.com/uicons-regular-rounded/css/uicons-regular-rounded.css'>
</head>
<body>
<!-- Navbar -->
<header class="sticky-top">
<nav class="navbar bg-body-tertiary navbar-expand-lg w-100">
<div class="container">
<a class="navbar-brand d-flex gap-2 align-items-center" href="index.html" >
<img alt="Free Frontend Logo" class="img-fluid" height="50" src="logo.png" width="50">
<h2 class="m-0 text-warning">Best</h2>
<h2 class="m-0">Bites</h2>
</a>
<button aria-controls="navbarSupportedContent4" aria-expanded="false" aria-label="Toggle navigation" class="navbar-toggler" data-bs-target="#navbarSupportedContent4" data-bs-toggle="collapse" type="button"><span class="navbar-toggler-icon"></span></button>
<div class="collapse navbar-collapse" id="navbarSupportedContent4">
<ul class="navbar-nav ms-auto my-2 my-lg-0">
<li class="nav-item ms-lg-4">
<a class="nav-link" href="index.html">Home</a>
</li>
<li class="nav-item ms-lg-4">
<a class="nav-link" href="#about">About</a>
</li>
<li class="nav-item ms-lg-4">
<a class="nav-link" href="#menu">Menu</a>
</li>
<li class="nav-item ms-lg-4">
<a class="nav-link active" href="checkout.html">Order</a>
</li>
</ul>
</div>
</div>
</nav>
</header>
<!-- navbar end -->
<main class="container pb-4">
<div class="py-5 text-center">
<h1>Checkout form</h1>
</div>
<div class="row g-5">
<div class="col-md-5 col-lg-4 order-md-last">
<h4 class="d-flex justify-content-between align-items-center mb-3">
<span class="text-warning">Your cart</span>
<span class="badge bg-warning rounded-pill">3</span>
</h4>
<ul class="cart-items list-group mb-3">
</ul>
<form class="card p-2">
<div class="input-group">
<input type="text" class="form-control" placeholder="Promo code">
<button type="submit" class="btn btn-secondary">Redeem</button>
</div>
</form>
<p class="my-3">Total Price: <span class="total-price fw-bold text-warning"></span> </p>
</div>
<div class="col-md-7 col-lg-8">
<h4 class="mb-3">Billing address</h4>
<form class="needs-validation" novalidate>
<div class="row g-3">
<div class="col-sm-6">
<label for="firstName" class="form-label">First name</label>
<input type="text" class="form-control" id="firstName" placeholder="" value="" required>
</div>
<div class="col-sm-6">
<label for="lastName" class="form-label">Last name</label>
<input type="text" class="form-control" id="lastName" placeholder="" value="" required>
</div>
<div class="col-12">
<label for="email" class="form-label">Email</label>
<input type="email" class="form-control" id="email" placeholder="[email protected]">
</div>
<div class="col-12">
<label for="address" class="form-label">Address</label>
<input type="text" class="form-control" id="address" placeholder="1234 Main St" required>
</div>
<div class="col-md-5">
<label for="country" class="form-label">Country</label>
<select class="form-select" id="country" required>
<option value="">Choose...</option>
<option>India</option>
</select>
<div class="invalid-feedback">
Please select a valid country.
</div>
</div>
<div class="col-md-4">
<label for="state" class="form-label">State</label>
<select class="form-select" id="state" required>
<option value="">Choose...</option>
<option>Mumbai</option>
<option>Delhi</option>
<option>Punjab</option>
</select>
<div class="invalid-feedback">
Please provide a valid state.
</div>
</div>
<div class="col-md-3">
<label for="zip" class="form-label">Zip</label>
<input type="text" class="form-control" id="zip" placeholder="" required>
<div class="invalid-feedback">
Zip code required.
</div>
</div>
</div>
<hr class="my-4">
<div class="form-check">
<input type="checkbox" class="form-check-input" id="same-address">
<label class="form-check-label" for="same-address">Shipping address is the same as my billing address</label>
</div>
<div class="form-check">
<input type="checkbox" class="form-check-input" id="save-info">
<label class="form-check-label" for="save-info">Save this information for next time</label>
</div>
<hr class="my-4">
<h4 class="mb-3">Payment</h4>
<div class="row gy-3">
<div class="col-md-6">
<label for="upi" class="form-label">UPI ID</label>
<input type="text" class="form-control" id="upi" placeholder="Enter UPI Id" required>
<div class="invalid-feedback">
Credit card number is required
</div>
</div>
</div>
<hr class="my-4">
<button class="w-100 btn btn-warning btn-lg" type="submit">Proceed</button>
</form>
</div>
</div>
</main>
<!-- Footer -->
<footer class="py-4 border-top">
<div class="container">
<div class="d-lg-flex align-items-center justify-content-between py-3 py-lg-2">
<div class="small mb-2 mb-lg-0 text-muted">
© 2023 BestBites | All rights reserved.
</div>
<div class="small mb-2 mb-lg-0 text-muted">
<span>Designed by Aditya</span>
</div>
</div>
</div>
</footer>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL" crossorigin="anonymous"></script>
<script>
$(document).ready(function () {
// Initialize cart and total cost
let cart = [];
let totalCost = 0;
// Check if there is cart data in local storage
const savedCart = localStorage.getItem('cart');
const savedTotalCost = localStorage.getItem('totalCost');
if (savedTotalCost) totalCost = parseFloat(savedTotalCost);
if (savedCart) {
cart = JSON.parse(savedCart);
updateCart()
}
// Update Cart
function updateCart() {
$('.cart-items').empty();
cart.forEach(function(item, index) {
$('.cart-items').append(`
<li class="list-group-item d-flex align-items-center justify-content-between lh-sm">
<img src=${item.image} width="80" class="object-cover rounded-lg border img-thumbnail">
<div>
<h6 class="my-0">${item.title}</h6>
</div>
<span class="text-body-secondary">₹${item.price}</span>
</li>
`);
});
$('.badge').text(cart.length)
$('.total-price').text(`₹${totalCost}`)
}
})
</script>
</body>
</html>