forked from Ducks404/IP-Assignment
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconcessions.html
More file actions
276 lines (248 loc) · 10.3 KB
/
concessions.html
File metadata and controls
276 lines (248 loc) · 10.3 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
<!--
This HTML file represents a concessions page for a movie theater website.
It contains various sections such as combo deals, food items, and a cart for adding items.
Users can add items to the cart, increase or decrease the quantity, and proceed to checkout.
The page also includes a header, footer, and social media links.
-->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Concessions</title>
<link rel="stylesheet" href="style.css">
<style>
/* Media query for phone screens */
@media only screen and (max-width: 600px) {
main {
padding: 20px 20px;
}
.movielist img {
margin-right: 10px;
margin-bottom: 10px;
}
.search-container {
width: 100%;
}
.nav-bar {
display: flex;
flex-direction: column;
align-items: center;
}
.login-box {
display: none;
}
}
#cart table th, #cart table td {
border: 1px solid #000; /* Black border */
color: #f00; /* Black text */
}
#cart table th {
background-color: #000; /* Black background */
color: #f00; /* Red text */
}
#cart {
margin-top: 20px;
padding: 20px;
border: 1px transparent; /* transparent border */
background-color: transparent; /* Transparent background */
color: white; /* Black text */
}
#cart table th, #cart table td {
border: 1px transparent; /* Black border */
color: white; /* white text */
}
#cart table th {
background-color: transparent;
color: white; /* White text */
}
#total {
color: white; /* White text */
}
</style>
</head>
<body>
<header>
<header>
<div style="flex-grow: 1">
<figure>
<img alt="logo" title="MOViE LAND" width="300" src="images/logo.png" />
</figure>
</div>
<div style="flex-grow: 9">
<div class="search-container">
<img src="images/search.jpg" width="15" alt="Search" /> <input type="text" id="search-bar" placeholder="Type here to search..." style="width:60%;">
</div>
<div class="nav-bar">
<a href="index.html" class="nav-link">Home</a>
<a href="contact.html" class="nav-link">Contact Us</a>
<a href="#" class="nav-link">About us</a>
</div>
</div>
<div class="login-box">
<a href="login2.html" class="login-link"><img src="images/profile.jpg" width="20" alt="login_profile" /></a>
</div>
<div class="login-box">
<a href="login.html" class="login-link"><img src="images/signup.jpg" width="20" alt="settings" /></a>
</div>
</header>
</header>
<main>
<section>
<h2>Combo Deals</h2>
<div class="carousel">
<div class="carousel-item">
<img src="images/deal1.png" alt="Food item" style="width: 80px; height: 100px;">
<p class="price">$3.99</p>
<div class="quantity">
<button class="decrease">-</button>
<input type="number" value="1" min="1">
<button class="increase">+</button>
</div>
<button class="add-to-cart" data-id="combo1" data-price="3.99">Add to Cart</button>
</div>
<!-- Add more items as needed -->
</div>
</section>
<section>
<h2>Food</h2>
<div class="carousel" style="display: flex; justify-content: left;">
<div class="carousel-item">
<img src="images/popcorn.1png.png" alt="Popcorn" style="width: 80px; height: 100px;">
<p class="price">$5.99</p>
<div class="quantity">
<button class="decrease">-</button>
<input type="number" value="1" min="1">
<button class="increase">+</button>
</div>
<button class="add-to-cart" data-id="popcorn" data-price="5.99">Add to Cart</button>
</div>
<div class="carousel-item">
<img src="images/soda.png" alt="Soda" style="width: 80px; height: 100px;">
<p class="price">$0.99</p>
<div class="quantity">
<button class="decrease">-</button>
<input type="number" value="1" min="1">
<button class="increase">+</button>
</div>
<button class="add-to-cart" data-id="soda" data-price="0.99">Add to Cart</button>
</div>
</div>
</section>
<!-- Add this to your HTML where the cart is displayed -->
<div id="cart">
<!-- Cart items will be added here -->
</div>
<div id="checkout">
<h2>Checkout</h2>
<div id="total"></div>
<button id="checkout-button">Proceed to Checkout</button>
</div>
</main>
<script>// script.js
let cart = {};
document.querySelectorAll('.add-to-cart').forEach(button => {
button.addEventListener('click', event => {
const price = parseFloat(event.target.dataset.price);
const quantityInput = event.target.previousElementSibling.querySelector('input');
const quantity = parseInt(quantityInput.value);
const total = price * quantity;
const itemId = event.target.dataset.id;
if (cart[itemId]) {
cart[itemId].quantity += quantity;
cart[itemId].total += total;
} else {
cart[itemId] = {
price,
quantity,
total
};
}
updateCart();
announce(`Added ${quantity} of Item ${itemId} to the cart. Total bill is now $${total.toFixed(2)}`); // Announce changes for screen readers
});
});
document.querySelectorAll('.decrease').forEach(button => {
button.addEventListener('click', event => {
const input = event.target.nextElementSibling;
if (input.value > 1) {
input.value = parseInt(input.value) - 1;
}
});
});
document.querySelectorAll('.increase').forEach(button => {
button.addEventListener('click', event => {
const input = event.target.previousElementSibling;
input.value = parseInt(input.value) + 1;
});
});
function updateCart() {
const cartElement = document.getElementById('cart');
cartElement.innerHTML = '';
let total = 0;
let table = document.createElement('table');
// Add table header
let header = table.insertRow();
header.insertCell().textContent = 'Item Name';
header.insertCell().textContent = 'Price';
header.insertCell().textContent = 'Quantity';
header.insertCell().textContent = 'Total';
for (const itemId in cart) {
const item = cart[itemId];
let row = table.insertRow();
row.insertCell().textContent = `${itemId}`;
row.insertCell().textContent = `$${item.price.toFixed(2)}`;
row.insertCell().textContent = item.quantity;
row.insertCell().textContent = `$${item.total.toFixed(2)}`;
total += item.total;
}
cartElement.appendChild(table);
document.getElementById('total').textContent = `Total Bill: $${total.toFixed(2)}`;
announce(`Total bill is now $${total.toFixed(2)}`); // Announce updated total bill
}
</script>
</script>
<footer>
<div id="footer-top">
<div id="connect">
<h6><b>Connect with us</b></h6>
<p>Reach us at <a href="mailto:some_account!!!">*@gmail.com</a> or through our <a href="contact-us.html">online contact form</a>.</p>
<div id="social-media">
<a href="youtube.com"><img src="images/youtube.jpg" width="40" alt="Youtube"></a>
<a href="instagram.com"><img src="images/instagram.jpg" width="40" alt="Instagram"></a>
<a href="facebook.com"><img src="images/facebook.jpg" width="40" alt="Facebook"></a>
<a href="linkedin.com"><img src="images/linkedin.jpg" width="40" alt="Linkedin"></a>
<a href="x.com"><img src="images/twitter.jpg" width="40" alt="X"></a>
</div>
<p>Have questions? Check our <a href="Frequent_questions.html">frequently asked questions</a>!</p>
</div>
<hr>
<div id="member">
<h6><b>Become a member!</b></h6>
<p>Join our 500,000 community members and get a decent discount on your weekend's movie nights!</p>
<div class="form-box">
<form>
<label for="email">Email:</label>
<input type="email" id='email' name='email' placeholder='Enter your email address...' required>
<button type="submit">Subscribe</button>
</form>
</div>
</div>
</div>
<hr style="width:100%;margin:0;">
<div id="footer-bottom">
<div>
<figure>
<img alt="logo" title="MOViE LAND" width="200" src="images/logo.jpg">
</figure>
</div>
<div id="extras">
<p><a href="About-us.html">About us</a></p>
<p><a href="Privacy_policy.html">Terms of use and privacy policy</a></p>
<p><u>© 2024 MOViE LAND</u></p>
</div>
</div>
</footer>
</body>
</html>