-
Notifications
You must be signed in to change notification settings - Fork 2
/
Menu.html
260 lines (245 loc) · 13 KB
/
Menu.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
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Canteen Menu</title>
<link rel="stylesheet" href="css files/menu.css">
<link rel="stylesheet" href="footer.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
<link href="https://fonts.googleapis.com/css2?family=DynaPuff:[email protected]&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Afacad+Flux:[email protected]&family=DynaPuff:[email protected]&display=swap" rel="stylesheet">
</head>
<body>
<nav class="navbar">
<div class="brand">
<i class="fas fa-utensils"></i> चमmuch
</div>
<ul class="nav-links">
<li><a href="index.html">Home</a></li>
<li id="login-signup">
<a href="login.html">Login</a> | <a href="signup.html">Signup</a>
</li>
<li id="logout-profile" style="display: none;">
<a href="profile.html">Profile</a> | <a href="#" id="logout">Logout</a>
</li>
</ul>
</nav>
<div class="menu-container">
<h2 class="menu-header">Canteen Menu</h2>
<div class="menu-grid">
<!-- Sample Menu Items -->
<div class="menu-item"
data-name="Red Sauce Pasta"
data-price="50"
data-image="https://mccormick.widen.net/content/scns3cge4r/original/simple_tomato__basil_637390546079422235_800x800.jpg">
<div class="menu-img-container">
<img src="https://mccormick.widen.net/content/scns3cge4r/original/simple_tomato__basil_637390546079422235_800x800.jpg" alt="Red Sauce Pasta" class="menu-img">
</div>
<div class="menu-details">
<h3>Red Sauce Pasta</h3>
<p>Delicious pasta tossed in a tangy red sauce</p>
</div>
<div class="menu-action">
<span class="menu-price">₹ 50.00</span>
<button class="add-btn">Add to Cart</button>
</div>
</div>
<!-- White Sauce Pasta -->
<div class="menu-item"
data-name="White Sauce Pasta"
data-price="50"
data-image="https://www.cookwithmanali.com/wp-content/uploads/2018/12/White-Sauce-Pasta-768x1164.jpg">
<div class="menu-img-container">
<img src="https://www.cookwithmanali.com/wp-content/uploads/2018/12/White-Sauce-Pasta-768x1164.jpg" alt="White Sauce Pasta" class="menu-img">
</div>
<div class="menu-details">
<h3>White Sauce Pasta</h3>
<p>Rich and creamy white sauce pasta</p>
</div>
<div class="menu-action">
<span class="menu-price">₹ 50.00</span>
<button class="add-btn">Add to Cart</button>
</div>
</div>
<!-- Mixed Sauce Pasta -->
<div class="menu-item"
data-name="Mixed Sauce Pasta"
data-price="50"
data-image="https://www.momswhothink.com/wp-content/uploads/2023/05/shutterstock-2077134928-huge-licensed-scaled-1200x800.jpg">
<div class="menu-img-container">
<img src="https://www.momswhothink.com/wp-content/uploads/2023/05/shutterstock-2077134928-huge-licensed-scaled-1200x800.jpg" alt="Mixed Sauce Pasta" class="menu-img">
</div>
<div class="menu-details">
<h3>Mixed Sauce Pasta</h3>
<p>Perfect blend of red and white sauces</p>
</div>
<div class="menu-action">
<span class="menu-price">₹ 50.00</span>
<button class="add-btn">Add to Cart</button>
</div>
</div>
<!-- Fried Momos -->
<div class="menu-item"
data-name="Fried Momos"
data-price="50"
data-image="https://pragativadi.com/wp-content/uploads/2021/07/Fried-veg-momos.jpg">
<div class="menu-img-container">
<img src="https://pragativadi.com/wp-content/uploads/2021/07/Fried-veg-momos.jpg" alt="Fried Momos" class="menu-img">
</div>
<div class="menu-details">
<h3>Fried Momos</h3>
<p>Golden fried momos served with spicy dip</p>
</div>
<div class="menu-action">
<span class="menu-price">₹ 50.00</span>
<button class="add-btn">Add to Cart</button>
</div>
</div>
<!-- Steamed Momos -->
<div class="menu-item"
data-name="Steamed Momos"
data-price="50"
data-image="https://img.freepik.com/premium-photo/veg-steam-momo-nepalese-traditional-dish-momo-stuffed-with-vegetables-then-cooked-served-with-sauce-mayonnaise-rustic-wooden-background-selective-focus_726363-1148.jpg">
<div class="menu-img-container">
<img src="https://img.freepik.com/premium-photo/veg-steam-momo-nepalese-traditional-dish-momo-stuffed-with-vegetables-then-cooked-served-with-sauce-mayonnaise-rustic-wooden-background-selective-focus_726363-1148.jpg" alt="Steamed Momos" class="menu-img">
</div>
<div class="menu-details">
<h3>Steamed Momos</h3>
<p>Classic steamed momos filled with veggies</p>
</div>
<div class="menu-action">
<span class="menu-price">₹ 50.00</span>
<button class="add-btn">Add to Cart</button>
</div>
</div>
<!-- Kurkure Momos -->
<div class="menu-item"
data-name="Kurkure Momos"
data-price="50"
data-image="https://res.cloudinary.com/purnesh/image/upload/f_auto/v1516875472/papavegchinesefood.jpg">
<div class="menu-img-container">
<img src="https://res.cloudinary.com/purnesh/image/upload/f_auto/v1516875472/papavegchinesefood.jpg" alt="Kurkure Momos" class="menu-img">
</div>
<div class="menu-details">
<h3>Kurkure Momos</h3>
<p>Crispy coated momos with a crunchy bite</p>
</div>
<div class="menu-action">
<span class="menu-price">₹ 50.00</span>
<button class="add-btn">Add to Cart</button>
</div>
</div>
<!-- Masala Maggie -->
<div class="menu-item"
data-name="Masala Maggie"
data-price="50"
data-image="https://madhurasrecipe.com/wp-content/uploads/2020/10/Kolhapuri-Maggi-Masala-Marathi-Recipe-post-585x390.jpg">
<div class="menu-img-container">
<img src="https://madhurasrecipe.com/wp-content/uploads/2020/10/Kolhapuri-Maggi-Masala-Marathi-Recipe-post-585x390.jpg" alt="Masala Maggie" class="menu-img">
</div>
<div class="menu-details">
<h3>Masala Maggie</h3>
<p>Spicy and flavorful masala Maggie noodles</p>
</div>
<div class="menu-action">
<span class="menu-price">₹ 50.00</span>
<button class="add-btn">Add to Cart</button>
</div>
</div>
<!-- Cheese Maggie -->
<div class="menu-item"
data-name="Cheese Maggie"
data-price="50"
data-image="https://i.pinimg.com/originals/26/f5/27/26f527cf4f56cdbd648005ba00b46f67.jpg">
<div class="menu-img-container">
<img src="https://i.pinimg.com/originals/26/f5/27/26f527cf4f56cdbd648005ba00b46f67.jpg" alt="Cheese Maggie" class="menu-img">
</div>
<div class="menu-details">
<h3>Cheese Maggie</h3>
<p>Cheesy and delicious Maggie noodles</p>
</div>
<div class="menu-action">
<span class="menu-price">₹ 50.00</span>
<button class="add-btn">Add to Cart</button>
</div>
</div>
<!-- Springroll -->
<div class="menu-item"
data-name="Springroll"
data-price="50"
data-image="https://cdn3.didevelop.com/public/product_images/3237/533_268264c8bdc7fd2ef2c76c1d8028cdd9.jpg">
<div class="menu-img-container">
<img src="https://cdn3.didevelop.com/public/product_images/3237/533_268264c8bdc7fd2ef2c76c1d8028cdd9.jpg" alt="Springroll" class="menu-img">
</div>
<div class="menu-details">
<h3>Springroll</h3>
<p>Crispy and delicious vegetable springrolls</p>
</div>
<div class="menu-action">
<span class="menu-price">₹ 50.00</span>
<button class="add-btn">Add to Cart</button>
</div>
</div>
<!-- Veg Roll -->
<div class="menu-item"
data-name="Veg Roll"
data-price="50"
data-image="https://images.deliveryhero.io/image/talabat/MenuItems/Veg_Spring_Roll638003488699451784.jpg">
<div class="menu-img-container">
<img src="https://images.deliveryhero.io/image/talabat/MenuItems/Veg_Spring_Roll638003488699451784.jpg" alt="Veg Roll" class="menu-img">
</div>
<div class="menu-details">
<h3>Veg Roll</h3>
<p>Stuffed with fresh veggies and spices</p>
</div>
<div class="menu-action">
<span class="menu-price">₹ 50.00</span>
<button class="add-btn">Add to Cart</button>
</div>
</div>
</div>
<!-- Redirect to Cart -->
<div class="cart-redirect">
<p>Ready to order? <a href="Cart.html">Go to Cart</a></p>
</div>
</div>
<!--footer --->
<div id="footer"></div>
<script>
fetch('footer.html')
.then(response => response.text())
.then(data => {
document.getElementById('footer').innerHTML = data;
});
</script>
<script>
const addToCartButtons = document.querySelectorAll('.add-btn');
addToCartButtons.forEach(button => {
button.addEventListener('click', () => {
console.log("Button clicked"); // Debug log
const item = button.closest('.menu-item');
const name = item.getAttribute('data-name');
const price = parseFloat(item.getAttribute('data-price'));
const image = item.getAttribute('data-image');
console.log(`Item Name: ${name}, Price: ${price}, Image: ${image}`); // Debug log
// Load existing cart or create a new one
let cart = JSON.parse(localStorage.getItem('cart')) || [];
// Check if item is already in the cart
const itemIndex = cart.findIndex(cartItem => cartItem.name === name);
if (itemIndex > -1) {
// Increment quantity if the item already exists in the cart
cart[itemIndex].quantity += 1;
} else {
// Add new item to cart with an initial quantity of 1
cart.push({ name: name, price: price, quantity: 1, image: image });
}
// Save updated cart back to localStorage
localStorage.setItem('cart', JSON.stringify(cart));
alert(`${name} added to cart`);
});
});
</script>
<script src="./js files/navbar.js"></script>
</body>
</html>