-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPayment.html
More file actions
337 lines (317 loc) · 11.5 KB
/
Payment.html
File metadata and controls
337 lines (317 loc) · 11.5 KB
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
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Payment - AliMAN TechShop</title>
<link rel="stylesheet" href="https://pro.fontawesome.com/releases/v5.10.0/css/all.css">
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
background-color: #f4f4f4;
}
#header {
background: #333;
color: #fff;
padding: 10px 0;
text-align: center;
}
#header ul {
list-style: none;
padding: 0;
}
#header ul li {
display: inline;
margin: 0 10px;
}
#header ul li a {
color: #fff;
text-decoration: none;
}
.container {
padding: 20px;
}
.cart-summary {
background: #fff;
border: 1px solid #ddd;
border-radius: 5px;
padding: 20px;
margin-bottom: 20px;
}
.cart-summary h2 {
margin-top: 0;
}
.cart-summary ul {
list-style: none;
padding: 0;
}
.cart-summary ul li {
display: flex;
justify-content: space-between;
margin-bottom: 10px;
}
.payment-methods {
background: #fff;
border: 1px solid #ddd;
border-radius: 5px;
padding: 20px;
}
.payment-methods h2 {
margin-top: 0;
}
.payment-option {
margin-bottom: 20px;
}
.payment-option input[type="radio"] {
margin-right: 10px;
}
.credit-card-form {
display: none;
margin-top: 10px;
}
.credit-card-form input {
width: 100%;
padding: 10px;
margin-bottom: 10px;
border: 1px solid #ddd;
border-radius: 4px;
}
.proceed-btn {
display: none;
margin-top: 20px;
padding: 15px;
background-color: #088178;
color: #fff;
border: none;
cursor: pointer;
width: 100%;
border-radius: 4px;
font-size: 16px;
}
.proceed-btn:hover {
background-color: #066d63;
}
footer{
display: flex;
flex-wrap: wrap;
justify-content: space-between;
background-color: #fff;
padding: 20px;
border-top: 1px solid #ddd;
}
footer .col{
display: flex;
flex-direction: column;
align-items: flex-start;
margin-bottom: 20px;
}
footer .logo{
margin-bottom: 30px;
}
footer h4{
font-size: 14px;
padding-bottom: 20px;
}
footer p{
font-size: 13px;
margin: 0 0 8px 0;
}
footer a{
font: 13px;
text-decoration: none;
color: #222;
margin-bottom: 10px;
}
footer .follow{
margin-top: 20px;
}
footer .follow i{
color: #465b52;
padding-right: 4px;
cursor: pointer;
}
footer .install .row img{
border: 1px solid #088178;
border-radius: 6px;
}
footer .install img{
margin: 10px 0 15px 0;
}
footer .follow i:hover,
footer a:hover{
color: #088178;
}
</style>
</head>
<body>
<section id="header">
<a href="#"><img src="Images/new Logo.png" class="logo" alt="AliMAN TechShop Logo"></a>
<div>
<ul id="navbar">
<li><a href="index.html">Home</a></li>
<li><a href="Shop.html">Shop</a></li>
<li><a href="LogIn.html">Login</a></li>
<li><a href="SignUp.html">Sign Up</a></li>
<li><a href="About.html">About Us</a></li>
<li><a href="Contact.html">Contact us</a></li>
<li><a href="#" id="cart-icon"><i class="far fa-shopping-bag"></i></a></li>
</ul>
</div>
</section>
<div class="container">
<div class="cart-summary">
<h2>Shopping Cart</h2>
<ul id="cart-items">
<!-- Cart items will be populated here -->
</ul>
<div class="total">Total: Ksh. <span id="total-price">0</span></div>
</div>
<div class="payment-methods">
<h2>Select Payment Method</h2>
<div class="payment-option">
<input type="radio" id="mpesa" name="payment" value="mpesa">
<label for="mpesa">M-PESA</label>
</div>
<div class="payment-option">
<input type="radio" id="credit-card" name="payment" value="credit-card">
<label for="credit-card">Credit Card (Equity Bank)</label>
<div class="credit-card-form" id="credit-card-form">
<input type="text" id="card-number" placeholder="Card Number">
<input type="text" id="card-holder" placeholder="Card Holder Name">
<input type="text" id="expiry-date" placeholder="Expiry Date (MM/YY)">
<input type="text" id="cvv" placeholder="CVV">
<button id="submit-card" style="padding:10px; background-color:#088178; color:#fff; border:none; cursor:pointer;">Submit</button>
</div>
</div>
</div>
<button class="proceed-btn" id="proceed-btn">Proceed to Checkout</button>
</div>
<footer class="section-p1">
<div class="col">
<img class="logo" src="Images/new Logo.png" alt="AliMAN TechShop Logo">
<h4>Contact Us</h4>
<p><strong>Location: </strong> Moi Avenue Next to SimLaw Seeds, Opposite Koja Mosque</p>
<p><strong>Phone: </strong>+254 797 090646 / +254 104 626289</p>
<p><strong>Opening Hours: </strong>08:30 - 19:00, Mon - Sat</p>
<div class="follow">
<h4>Follow Us</h4>
<div class="icon">
<i class="fab fa-facebook-f"></i>
<i class="fab fa-twitter"></i>
<i class="fab fa-instagram"></i>
<i class="fab fa-pinterest-p"></i>
<i class="fab fa-youtube"></i>
</div>
</div>
</div>
<div class="col">
<h4>About Us</h4>
<a href="#">About Us</a>
<a href="#">Terms And Conditions</a>
<a href="#">Delivery Information</a>
</div>
<div class="col">
<h4>My Account</h4>
<a href="#">Sign In</a>
<a href="#">View My Cart</a>
<a href="#">Track My Order</a>
<a href="#">Help</a>
</div>
<div class="col install">
<h4>Install Our App</h4>
<p>From Google Play Store</p>
<div class="row">
<!-- App store badges can be added here -->
</div>
<p>Secure Payment methods include: M-PESA and Equity Bank</p>
</div>
<div class="copyright">
<p>© Copyright, AliMAN TechShop @2024 </p>
</div>
</footer>
<script>
// Function to retrieve cart from localStorage
function getCart() {
return JSON.parse(localStorage.getItem('cart')) || [];
}
// Function to retrieve total from localStorage
function getTotal() {
return parseInt(localStorage.getItem('total')) || 0;
}
// Populate cart summary
function populateCart() {
const cartItems = getCart();
const total = getTotal();
const cartItemsContainer = document.getElementById('cart-items');
cartItemsContainer.innerHTML = '';
cartItems.forEach(item => {
const li = document.createElement('li');
li.textContent = `${item.name} - Ksh. ${item.price}`;
cartItemsContainer.appendChild(li);
});
document.getElementById('total-price').textContent = total;
}
// Handle payment method selection
document.querySelectorAll('input[name="payment"]').forEach(radio => {
radio.addEventListener('change', function() {
if (this.value === 'credit-card') {
document.getElementById('credit-card-form').style.display = 'block';
} else {
document.getElementById('credit-card-form').style.display = 'none';
}
});
});
// Handle M-PESA payment
document.getElementById('mpesa').addEventListener('click', function() {
if (confirm('Are you sure you want to pay with M-PESA?')) {
const total = getTotal();
const referral = prompt(`Please enter the referral code from M-PESA services for confirmation of payment of Ksh. ${total}:`);
if (referral) {
alert('Payment successful!');
document.getElementById('proceed-btn').style.display = 'block';
window.scrollTo({
top: document.getElementById('proceed-btn').offsetTop,
behavior: 'smooth'
});
}
}
});
// Handle Credit Card submission
document.getElementById('submit-card').addEventListener('click', function() {
const cardNumber = document.getElementById('card-number').value;
const cardHolder = document.getElementById('card-holder').value;
const expiryDate = document.getElementById('expiry-date').value;
const cvv = document.getElementById('cvv').value;
if (cardNumber && cardHolder && expiryDate && cvv) {
// Here you would normally handle the credit card payment processing
alert('Payment successful!');
document.getElementById('proceed-btn').style.display = 'block';
window.scrollTo({
top: document.getElementById('proceed-btn').offsetTop,
behavior: 'smooth'
});
} else {
alert('Please fill in all credit card details.');
}
});
// Handle Proceed to Checkout
document.getElementById('proceed-btn').addEventListener('click', function() {
// Clear cart after checkout
localStorage.removeItem('cart');
localStorage.removeItem('total');
window.location.href = 'index.html';
});
// Initialize cart on page load
window.onload = function() {
populateCart();
};
// Cart Icon Functionality (Optional)
document.getElementById('cart-icon').addEventListener('click', () => {
const cart = document.getElementById('cart');
cart.style.display = cart.style.display === 'none' || cart.style.display === '' ? 'block' : 'none';
});
</script>
</body>
</html>