geethareddy commited on
Commit
53b3c20
·
verified ·
1 Parent(s): 77ab4b9

Update templates/menu.html

Browse files
Files changed (1) hide show
  1. templates/menu.html +935 -354
templates/menu.html CHANGED
@@ -7,397 +7,978 @@
7
  <!-- Bootstrap CSS -->
8
  <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet">
9
  <link href="https://cdn.jsdelivr.net/npm/bootstrap-icons/font/bootstrap-icons.css" rel="stylesheet">
10
- <style>
11
- body {
12
- font-family: Arial, sans-serif;
13
- background-color: #fdf4e3;
14
- margin: 0;
15
- padding: 0;
16
- display: flex;
17
- flex-direction: column;
18
- }
19
- .container {
20
- max-width: 900px;
21
- }
22
- .menu-card {
23
- max-width: 350px;
24
- border-radius: 15px;
25
- overflow: hidden;
26
- background-color: #fff;
27
- margin: auto;
28
- display: flex;
29
- flex-direction: column;
30
- }
31
- .menu-image {
32
- height: 200px;
33
- width: 100%;
34
- object-fit: fill;
35
- border-radius: 15px 15px 0 0;
36
- }
37
- .card-title {
38
- font-size: 1.2rem;
39
- font-weight: bold;
40
- margin: 10px 0;
41
- }
42
- .card-text {
43
- font-size: 1rem;
44
- color: #6c757d;
45
- }
46
- .customisable-text {
47
- font-size: 0.8rem;
48
- color: #6c757d;
49
- text-align: right;
50
- margin-top: 5px;
51
- }
52
- .btn-primary {
53
- font-size: 13px;
54
- font-weight: bold;
55
- border-radius: 5px;
56
- width: 100px;
57
- background-color: #0FAA39;
58
- border-color: #0FAA39;
59
- text-transform: uppercase;
60
- margin-top: 10px;
61
- margin-left: auto;
62
- margin-right: 0;
63
- display: block;
64
- }
65
- .btn-primary:hover, .btn-primary:active, .btn-primary:focus {
66
- background-color: #0FAA39;
67
- border-color: #0FAA39;
68
- box-shadow: none;
69
- }
70
- .view-cart-container {
71
- position: fixed;
72
- bottom: 20px;
73
- right: 20px;
74
- z-index: 999;
75
- }
76
- .view-cart-button {
77
- background-color: #0FAA39;
78
- color: #fff;
79
- padding: 10px 20px;
80
- border-radius: 30px;
81
- font-size: 1rem;
82
- font-weight: bold;
83
- text-decoration: none;
84
- box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.1);
85
- display: flex;
86
- align-items: center;
87
- justify-content: center;
88
- }
89
- .view-cart-button:hover {
90
- background-color: #109835;
91
- text-decoration: none;
92
- }
93
- .container {
94
- margin-top: 10px;
95
- }
96
- h1.text-center {
97
- margin-top: 10px;
98
- padding-top: 0 !important;
99
- font-weight: semi-bold;
100
- }
101
- .fixed-top-bar {
102
- position: relative;
103
- top: 0;
104
- left: 0;
105
- width: 100%;
106
- height: 54px;
107
- background-color: #FF6B35;
108
- color: white;
109
- padding: 15px;
110
- display: flex;
111
- justify-content: space-between;
112
- align-items: center;
113
- z-index: 1000;
114
- }
115
- .search-bar-container {
116
- padding: 10px;
117
- position: absolute;
118
- left: 20px;
119
- top: 50%;
120
- transform: translateY(-50%);
121
- display: flex;
122
- justify-content: flex-start;
123
- align-items: center;
124
- width: 300px;
125
- }
126
- .search-bar-container input {
127
- width: 85%;
128
- padding: 8px 10px 8px 30px;
129
- font-size: 16px;
130
- border-radius: 10px;
131
- border: none;
132
- }
133
- .search-icon {
134
- position: absolute;
135
- left: 15px;
136
- font-size: 20px;
137
- color: #888;
138
- }
139
- .addon-section {
140
- background-color: #fff;
141
- border: 2px solid #6c757d;
142
- border-radius: 8px;
143
- padding: 12px;
144
- margin-bottom: 10px;
145
- }
146
- .addon-section h6 {
147
- margin-bottom: 10px;
148
- font-size: 1.1rem;
149
- font-weight: bold;
150
- color: #343a40;
151
- }
152
- .addon-section .form-check {
153
- display: inline-flex;
154
- align-items: center;
155
- margin-left: 10px;
156
- color: #343a40;
157
- }
158
- .addon-section .form-check-input {
159
- -webkit-appearance: none;
160
- -moz-appearance: none;
161
- appearance: none;
162
- width: 20px;
163
- height: 20px;
164
- border: 2px solid #343a40;
165
- border-radius: 5px;
166
- background-color: #f0f0f0;
167
- position: relative;
168
- margin-right: 10px;
169
- }
170
- .addon-section .form-check-input:checked {
171
- background-color: #006400;
172
- border-color: #006400;
173
- }
174
- .addon-section .form-check-input:checked::before {
175
- content: '';
176
- font-size: 14px;
177
- position: absolute;
178
- top: 3px;
179
- left: 4px;
180
- color: white;
181
- }
182
- .addon-section .form-check-input:focus {
183
- outline: none;
184
- box-shadow: 0 0 0 2px #006400;
185
- }
186
- .addon-section .form-check-label {
187
- font-size: 16px;
188
- margin-left: 5px;
189
- cursor: pointer;
190
- }
191
- .cart-container {
192
- display: flex;
193
- align-items: center;
194
- gap: 10px;
195
- }
196
- .modal-footer {
197
- display: flex;
198
- align-items: center;
199
- justify-content: space-between;
200
- padding: 10px;
201
- }
202
- .modal-footer .d-flex {
203
- display: flex;
204
- align-items: center;
205
- gap: 10px;
206
- }
207
- .modal-footer .btn {
208
- height: 40px;
209
- padding: 0 15px;
210
- }
211
- .modal-footer .form-control {
212
- width: 50px;
213
- height: 40px;
214
- text-align: center;
215
- }
216
- .modal-footer .btn-primary {
217
- background-color: #0FAA39;
218
- border-color: #0FAA39;
219
- font-weight: bold;
220
- padding: 10px 20px;
221
- height: 40px;
222
- display: flex;
223
- justify-content: center;
224
- align-items: center;
225
- width: auto;
226
- }
227
- .modal-footer .btn-outline-secondary {
228
- height: 40px;
229
- width: 40px;
230
- }
231
- @media (max-width: 576px) {
232
- .modal-dialog {
233
- max-width: 98%;
234
- }
235
- .modal-footer .btn {
236
- height: 35px;
237
- }
238
- .modal-footer .form-control {
239
- width: 40px;
240
- height: 35px;
241
- }
242
- }
243
- </style>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
244
  </head>
245
  <body>
246
 
247
- <div class="fixed-top-bar">
248
- <div class="avatar-dropdown-container">
249
- <div class="avatar-icon">
250
- <span>{{ first_letter }}</span>
251
- </div>
252
- <div class="dropdown-menu">
253
- <a href="{{ url_for('customer_details') }}" class="dropdown-item">View Profile</a>
254
- <a href="{{ url_for('order_history') }}" class="dropdown-item">Order History</a>
255
- <a href="{{ url_for('logout') }}" class="dropdown-item">Logout</a>
256
- </div>
257
  </div>
 
 
258
 
259
- <div class="search-bar-container">
260
- <input type="text" id="searchBar" class="form-control" placeholder="Search items or sections..." onkeyup="filterMenu()">
261
- <i class="bi bi-search search-icon"></i>
262
  </div>
263
  </div>
264
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
265
  <div class="container mt-4">
266
  <h1 class="text-center">Menu</h1>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
267
  {% for section, items in ordered_menu.items() %}
268
  <h3>{{ section }}</h3>
269
  <div class="row">
270
  {% for item in items %}
271
- <!-- For 'Appetizer', 'Customized Dish', and 'Soft Drinks', remove 'Customisable' text and only show 'ADD' button -->
272
- {% if section == 'Appetizer' or section == 'Customized Dish' or section == 'Soft Drinks' %}
273
- <div class="col-md-6 mb-4">
274
- <div class="card menu-card">
275
- <img src="{{ item.Image1__c }}" class="card-img-top menu-image" alt="{{ item.Name }}" onerror="this.src='/static/placeholder.jpg';">
276
- <div class="card-body">
277
- <h5 class="card-title">{{ item.Name }}</h5>
278
- <p class="card-text">${{ item.Price__c }}</p>
279
- <button class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#itemModal"
280
- onclick="showItemDetails('{{ item.Name }}', '{{ item.Price__c }}', '{{ item.Image2__c }}', '{{ item.Description__c }}', '{{ item.Section__c }}','{{ selected_category }}')">
281
- ADD
282
- </button>
283
- </div>
284
  </div>
285
  </div>
286
- {% else %}
287
- <!-- For other sections, display 'ADD' button and 'Customisable' text -->
288
- <div class="col-md-6 mb-4">
289
- <div class="card menu-card">
290
- <img src="{{ item.Image1__c }}" class="card-img-top menu-image" alt="{{ item.Name }}" onerror="this.src='/static/placeholder.jpg';">
291
- <div class="card-body">
292
- <h5 class="card-title">{{ item.Name }}</h5>
293
- <p class="card-text">${{ item.Price__c }}</p>
294
- <button class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#itemModal"
295
- onclick="showItemDetails('{{ item.Name }}', '{{ item.Price__c }}', '{{ item.Image2__c }}', '{{ item.Description__c }}', '{{ item.Section__c }}','{{ selected_category }}')">
296
- ADD
297
- </button>
298
- <div class="customisable-text">Customisable</div>
299
- </div>
300
- </div>
301
- </div>
302
- {% endif %}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
303
  {% endfor %}
304
  </div>
305
  {% endfor %}
306
  </div>
 
 
 
307
 
 
308
  <div class="view-cart-container">
309
- <a href="/cart" class="view-cart-button">
310
  View Cart
311
  </a>
312
  </div>
313
 
314
- <div class="modal fade" id="itemModal" tabindex="-1" aria-labelledby="itemModalLabel" aria-hidden="true">
315
- <div class="modal-dialog modal-dialog-centered">
316
- <div class="modal-content">
317
- <div class="modal-header">
318
- <h5 class="modal-title" id="itemModalLabel">Item Details</h5>
319
- <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
320
  </div>
321
- <div class="modal-body">
322
- <img id="modal-img" class="img-fluid rounded mb-3 d-block mx-auto" alt="Item Image" style="max-height: 200px; object-fit: cover;">
323
- <h5 id="modal-name" class="fw-bold text-center"></h5>
324
- <p id="modal-price" class="text-muted text-center"></p>
325
- <p id="modal-description" class="text-secondary"></p>
326
- <div id="modal-addons" class="modal-addons mt-4">
327
- <h6>Customization Options</h6>
328
- <div id="addons-list" class="addons-container">Loading customization options...</div>
329
- </div>
330
- <div class="mt-4">
331
- <h6>Custom Request</h6>
332
- <textarea id="modal-instructions" class="form-control" placeholder="Enter any special instructions here..."></textarea>
333
- </div>
334
- <span id="modal-section" data-section="" data-category="" style="display: none;"></span>
335
  </div>
336
- <div class="modal-footer d-flex align-items-center justify-content-between">
337
- <div class="d-flex align-items-center gap-2">
338
- <button type="button" class="btn btn-outline-secondary" id="decreaseQuantity">-</button>
339
- <input type="text" class="form-control text-center" id="quantityInput" value="1" readonly style="width: 50px;"/>
340
- <button type="button" class="btn btn-outline-secondary" id="increaseQuantity">+</button>
341
- </div>
342
- <button type="button" class="btn btn-primary" onclick="addToCartFromModal()">Add to Cart</button>
 
 
343
  </div>
 
 
344
  </div>
345
  </div>
346
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
347
 
348
- <script>
349
- function showItemDetails(name, price, image, description, section, selectedCategory) {
350
- document.getElementById('modal-name').innerText = name;
351
- document.getElementById('modal-price').innerText = `$${price}`;
352
- document.getElementById('modal-img').src = image || '/static/placeholder.jpg';
353
- document.getElementById('modal-description').innerText = description || 'No description available.';
354
- document.getElementById('addons-list').innerHTML = 'Loading customization options...';
355
- document.getElementById('modal-instructions').value = '';
356
-
357
- const modalSectionEl = document.getElementById('modal-section');
358
- modalSectionEl.setAttribute('data-section', section);
359
- modalSectionEl.setAttribute('data-category', selectedCategory);
360
- document.getElementById('quantityInput').value = 1;
361
-
362
- fetch(`/api/addons?item_name=${encodeURIComponent(name)}&item_section=${encodeURIComponent(section)}`)
363
- .then(response => response.json())
364
- .then(data => {
365
- const addonsList = document.getElementById('addons-list');
366
- addonsList.innerHTML = '';
367
- if (!data.success || !data.addons || data.addons.length === 0) {
368
- addonsList.innerHTML = '<p>No customization options available.</p>';
369
- return;
370
- }
371
 
372
- data.addons.forEach(addon => {
373
- const sectionDiv = document.createElement('div');
374
- sectionDiv.classList.add('addon-section');
375
- const title = document.createElement('h6');
376
- title.innerText = addon.name;
377
- sectionDiv.appendChild(title);
378
- const optionsContainer = document.createElement('div');
379
- addon.options.forEach((option, index) => {
380
- const optionId = `addon-${addon.name.replace(/\s+/g, '')}-${index}`;
381
- const listItem = document.createElement('div');
382
- listItem.classList.add('form-check');
383
- listItem.innerHTML = `
384
- <input type="checkbox" class="form-check-input addon-option" id="${optionId}" value="${option}"
385
- data-name="${option}" data-group="${addon.name}" data-price="${addon.extra_charge ? addon.extra_charge_amount : 0}">
386
- <label class="form-check-label" for="${optionId}">
387
- ${option} ${addon.extra_charge ? `($${addon.extra_charge_amount})` : ''}
388
- </label>
389
- `;
390
- optionsContainer.appendChild(listItem);
391
- });
392
- sectionDiv.appendChild(optionsContainer);
393
- addonsList.appendChild(sectionDiv);
394
  });
395
- })
396
- .catch(err => {
397
- console.error('Error fetching add-ons:', err);
398
- document.getElementById('addons-list').innerHTML = '<p>Error loading customization options.</p>';
399
  });
 
 
 
 
 
 
 
 
 
 
 
400
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
401
  </script>
402
 
403
  <!-- Bootstrap JS -->
 
7
  <!-- Bootstrap CSS -->
8
  <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet">
9
  <link href="https://cdn.jsdelivr.net/npm/bootstrap-icons/font/bootstrap-icons.css" rel="stylesheet">
10
+ <style>
11
+
12
+
13
+ /* subbu */
14
+ .addbutton .btn {
15
+ background: linear-gradient(135deg, #ffffff, #f0f0f0); /* Gradient white background */
16
+ color: green; /* Make text color transparent */
17
+ background-clip: text; /* Apply the gradient to the text */
18
+ -webkit-background-clip: text; /* For Safari compatibility */
19
+ border: 1px solid #90ee90; /* Light green border */
20
+ padding: 6px 15px; /* Smaller padding */
21
+ font-size: 14px; /* Smaller font size */
22
+ font-weight:bold;
23
+ border-radius: 5px; /* Optional: round the corners */
24
+ transition: background 0.3s ease, border-color 0.3s ease; /* Add transition effect for hover */
25
+ margin-left: 13px; /* Margin for positioning */
26
+ }
27
+
28
+ .addbutton .btn:hover {
29
+ background: linear-gradient(135deg, #f0f0f0, #ffffff); /* Reverse gradient for hover effect */
30
+ border-color: #28a745; /* Darker green border on hover */
31
+ background-clip: text; /* Ensure the gradient is clipped to the text on hover */
32
+ -webkit-background-clip: text; /* Safari compatibility */
33
+ }
34
+
35
+
36
+
37
+ .customisable-text {
38
+ color: #28a745; /* Same color as the "ADD" button */
39
+ font-size: 12px; /* Same font size as the "ADD" button */
40
+ margin-left: 5px;
41
+ margin-top:1px;
42
+ }
43
+
44
+ /* model */
45
+ /* .modal-footer {
46
+ display: flex;
47
+ align-items: center;
48
+ justify-content: space-between; /* Space between quantity controls and Add to Cart button */
49
+ padding: 10px;
50
+ }
51
+
52
+ .modal-footer .d-flex {
53
+ display: flex;
54
+ align-items: center;
55
+ gap: 10px; /* Space between quantity buttons */
56
+ }
57
+
58
+ .modal-footer .btn {
59
+ height: 40px; /* Set consistent button height */
60
+ padding: 0 15px; /* Adjust padding to fit inside the buttons */
61
+ }
62
+
63
+ .modal-footer .form-control {
64
+ width: 50px; /* Fixed width for quantity input */
65
+ height: 40px; /* Match the height of buttons */
66
+ text-align: center; /* Center the value inside the input */
67
+ }
68
+
69
+ .modal-footer .btn-primary {
70
+ background-color: #0FAA39; /* Green background for Add to Cart button */
71
+ border-color: #0FAA39; /* Border color to match button background */
72
+ font-weight: bold; /* Bold text */
73
+ padding: 10px 20px; /* Adjust padding to make the button look better */
74
+ height: 40px; /* Match the height with quantity buttons */
75
+ display: flex;
76
+ justify-content: center;
77
+ align-items: center;
78
+ width: auto; /* Auto width to adjust to button text */
79
+ border-radius: 5px; /* Rounded corners for the button */
80
+ }
81
+
82
+ .modal-footer .btn-outline-secondary {
83
+ height: 40px; /* Ensure quantity buttons are the same size */
84
+ width: 40px; /* Make sure the buttons are square */
85
+ border-radius: 5px; /* Rounded corners for the buttons */
86
+ }
87
+
88
+ @media (max-width: 576px) {
89
+ /* Responsive adjustments for smaller screens */
90
+ .modal-dialog {
91
+ max-width: 98%; /* Adjust modal width for smaller screens */
92
+ }
93
+
94
+ .modal-footer .btn {
95
+ height: 35px; /* Smaller buttons for small screens */
96
+ padding: 0 12px; /* Adjust padding to make the button look proportional */
97
+ }
98
+
99
+ .modal-footer .form-control {
100
+ width: 40px; /* Adjust input size for smaller screens */
101
+ height: 35px;
102
+ }
103
+
104
+ .modal-footer .d-flex {
105
+ gap: 8px; /* Reduce space between quantity buttons on smaller screens */
106
+ }
107
+ } */
108
+
109
+
110
+
111
+
112
+
113
+
114
+
115
+
116
+
117
+
118
+
119
+ body {
120
+ font-family: Arial, sans-serif;
121
+ background-color: #fdf4e3; /* Updated background color */
122
+ margin: 0;
123
+ padding: 0;
124
+ display: flex;
125
+ flex-direction: column;
126
+ }
127
+ .container {
128
+ max-width: 900px;
129
+ }
130
+ .menu-card {
131
+ max-width: 350px;
132
+ border-radius: 15px;
133
+ overflow: hidden;
134
+ background-color: #fff;
135
+ margin: auto;
136
+ display: flex;
137
+ flex-direction: column;
138
+ }
139
+ .menu-image {
140
+ height: 200px; /* Fixed height */
141
+ width: 100%; /* Full width of the card */
142
+ object-fit: fill; /* Ensure the image covers the area and maintains the aspect ratio */
143
+ border-radius: 15px 15px 0 0; /* Rounded top corners */
144
+ }
145
+ .card-title {
146
+ font-size: 1.2rem;
147
+ font-weight: bold;
148
+ margin: 10px 0;
149
+ }
150
+ .card-text {
151
+ font-size: 1rem;
152
+ color: #6c757d;
153
+ }
154
+
155
+
156
+ .customize-btn {
157
+ position: absolute;
158
+ top: 50%;
159
+ right: 0;
160
+ transform: translateY(-50%);
161
+ z-index: 2;
162
+ background: linear-gradient(92.29deg, rgba(63, 63, 63, 0.7) 4.75%, rgba(0, 0, 0, 0.7) 93.57%);
163
+ color: #fff;
164
+ border: none;
165
+ padding: 4px 12px; /* Reduced padding for smaller height */
166
+ border-radius: 5px 0px 0px 5px ;
167
+ display: flex;
168
+ align-items: center;
169
+ font-size: 12px; /* Slightly smaller text */
170
+ }
171
+
172
+ .customize-btn i {
173
+ margin-left: 5px; /* Icon spacing */
174
+ }
175
+
176
+ /* .customize-btn:hover {
177
+ background-color: #e08c00; /* Darker shade for hover effect */
178
+ transition: background-color 0.3s ease;
179
+ } *
180
+
181
+
182
+
183
+
184
+
185
+
186
+
187
+
188
+
189
+
190
+
191
+ .btn-primary {
192
+ font-size: 13px;
193
+ font-weight: bold;
194
+ border-radius: 5px;
195
+ width: 100px;
196
+ background-color: #0FAA39; /* Updated button background color */
197
+ border-color: #0FAA39;
198
+ }
199
+ .btn-primary:hover {
200
+ background-color: #0FAA39;
201
+ border-color: #0FAA39;
202
+ }
203
+ .btn-primary:active,
204
+ .btn-primary:focus {
205
+ background-color: #0FAA39;
206
+ border-color: #ffffff;
207
+ box-shadow: none;
208
+ }
209
+ .view-cart-container {
210
+ position: fixed;
211
+ bottom: 20px;
212
+ right: 20px;
213
+ z-index: 999;
214
+ }
215
+ .view-cart-button {
216
+ background-color: #0FAA39; /* Updated View Cart button background color */
217
+ color: #fff;
218
+ padding: 10px 20px;
219
+ border-radius: 30px;
220
+ font-size: 1rem;
221
+ font-weight: bold;
222
+ text-decoration: none;
223
+ box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.1);
224
+ display: flex;
225
+ align-items: center;
226
+ justify-content: center;
227
+ }
228
+ .view-cart-button:hover {
229
+ background-color: #109835; /* Slightly darker shade for hover effect */
230
+ text-decoration: none;
231
+ }
232
+ .avatar-dropdown-container {
233
+ position: relative;
234
+ }
235
+ .avatar-icon {
236
+ width: 40px;
237
+ height: 40px;
238
+ border-radius: 50%;
239
+ background-color: #5bbfc1;
240
+ cursor: pointer;
241
+ display: flex;
242
+ align-items: center;
243
+ justify-content: center;
244
+ color: white;
245
+ font-size: 20px;
246
+ font-weight: bold;
247
+ }
248
+ .dropdown-menu {
249
+ position: absolute;
250
+ right: 0;
251
+ top: 100%;
252
+ background-color: #fff;
253
+ border-radius: 5px;
254
+ width: 200px; /* Adjust width as needed */
255
+ box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.1);
256
+ display: none;
257
+ }
258
+ .avatar-dropdown-container:hover .dropdown-menu {
259
+ display: block;
260
+ }
261
+ .avatar-dropdown-container {
262
+ position: absolute;
263
+ right: 20px; /* Adjust the value as needed to position it properly */
264
+ top: 50%; /* Adjust top to place it within the header */
265
+ transform: translateY(-50%); /* Correct the alignment to be perfectly centered */
266
+ display: flex;
267
+ align-items: right;
268
+ justify-content: center;
269
+ }
270
+
271
+ .dropdown-menu .dropdown-item {
272
+ padding: 10px 15px;
273
+ text-decoration: none;
274
+ color: #333;
275
+ border-bottom: 1px solid #ddd;
276
+ display: block; /* Make each item stack vertically */
277
+ }
278
+ .dropdown-menu .dropdown-item:last-child {
279
+ border-bottom: none; /* Remove the bottom border from the last item */
280
+ }
281
+ .dropdown-menu .dropdown-item:hover {
282
+ background-color: #f1f1f1;
283
+ }
284
+ .fixed-search-container {
285
+ position: absolute;
286
+ top: 90px; /* Move it slightly lower */
287
+ left: 50%;
288
+ transform: translateX(-50%);
289
+ width: 80%;
290
+ max-width: 600px;
291
+ z-index: 999; /* Keep it above content */
292
+ background-color: white;
293
+ padding: 10px;
294
+ border-radius: 25px;
295
+ box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.2);
296
+ }
297
+ /* Ensure the category filter dropdown does not overlap */
298
+ form.text-center.mb-4 {
299
+ margin-top: 10px; /* No margin at the top */
300
+ margin-bottom: 0px; /* Small space at the bottom */
301
+ }
302
+ /* Ensure the container has enough margin so nothing is overlapped */
303
+ .container {
304
+ margin-top: 10px; /* Adjust spacing based on navbar and search bar */
305
+ padding-top: 0 !important; /* Ensure no padding is added by default */
306
+ }
307
+ h1.text-center {
308
+ margin-top: 10px; /* Reduced space above */
309
+ padding-top: 0 !important; /* Removed padding */
310
+ font-weight: semi-bold; /* Make the "Menu" text bold */
311
+ }
312
+ .fixed-top-bar {
313
+ /* Remove the fixed positioning */
314
+ position: relative; /* Change from fixed to relative */
315
+ top: 0;
316
+ left: 0;
317
+ width: 100%;
318
+ height: 54px;
319
+ background-color: #FF6B35;
320
+ color: white;
321
+ padding: 15px;
322
+ display: flex;
323
+ justify-content: space-between;
324
+ align-items: center; /* Vertically align items */
325
+ z-index: 1000; /* Make sure it's still above other content */
326
+ }
327
+ .search-bar-container {
328
+ padding: 10px;
329
+ position: absolute;
330
+ left: 20px;
331
+ top: 50%;
332
+ transform: translateY(-50%);
333
+ display: flex;
334
+ justify-content: flex-start;
335
+ align-items: center;
336
+ width: 300px; /* Adjust width as needed */
337
+ }
338
+ .search-bar-container input {
339
+ width: 85%;
340
+ padding: 8px 10px 8px 30px; /* Add padding for the icon */
341
+ font-size: 16px;
342
+ border-radius: 10px;
343
+ border: none;
344
+ }
345
+ .search-icon {
346
+ position: absolute;
347
+ left: 15px; /* Position the icon inside the input box */
348
+ font-size: 20px;
349
+ color: #888; /* Icon color */
350
+ }
351
+ /* Style for customization sections */
352
+ .addon-section {
353
+ background-color: #fff; /* Light gray background */
354
+ border: 2px solid #6c757d; /* Border color */
355
+ border-radius: 8px;
356
+ padding: 12px;
357
+ margin-bottom: 10px; /* Spacing between sections */
358
+ }
359
+ /* Customization section title */
360
+ .addon-section h6 {
361
+ margin-bottom: 10px;
362
+ font-size: 1.1rem;
363
+ font-weight: bold;
364
+ color: #343a40; /* Darker title text */
365
+ }
366
+ /* Style for add-on checkboxes */
367
+ .addon-section .form-check {
368
+ display: inline-flex; /* Display checkboxes horizontally */
369
+ align-items: center; /* Align checkboxes and labels */
370
+ margin-left: 10px; /* Space between checkboxes */
371
+ color: #343a40; /* Darker text color */
372
+ }
373
+ /* Customize the default checkbox */
374
+ .addon-section .form-check-input {
375
+ -webkit-appearance: none; /* Remove default checkbox styling in Webkit browsers (e.g. Chrome, Safari) */
376
+ -moz-appearance: none; /* Remove default checkbox styling in Firefox */
377
+ appearance: none; /* Remove default checkbox styling in all browsers */
378
+ width: 20px;
379
+ height: 20px;
380
+ border: 2px solid #343a40; /* Darker border color */
381
+ border-radius: 5px; /* Rounded corners */
382
+ background-color: #f0f0f0; /* Lighter gray background when unchecked */
383
+ position: relative;
384
+ margin-right: 10px; /* Add space between the checkbox and label */
385
+ }
386
+
387
+ /* Checked state for the custom checkbox */
388
+ .addon-section .form-check-input:checked {
389
+ background-color: #006400; /* Dark green background when checked */
390
+ border-color: #006400; /* Dark green border when checked */
391
+ }
392
+ /* Add the check mark when checkbox is checked */
393
+ .addon-section .form-check-input:checked::before {
394
+ content: ''; /* Unicode check mark */
395
+ font-size: 14px;
396
+ position: absolute;
397
+ top: 3px;
398
+ left: 4px;
399
+ color: white; /* White color for the check mark */
400
+ }
401
+ /* Hover effect for the checkboxes */
402
+ .addon-section .form-check-input:hover {
403
+ /* background-color: #006400; /* Slightly darker background on hover */
404
+ }
405
+ /* Focus effect on custom checkbox */
406
+ .addon-section .form-check-input:focus {
407
+ outline: none;
408
+ box-shadow: 0 0 0 2px #006400; /* Green focus outline */
409
+ }
410
+ /* Custom checkbox label styles */
411
+ .addon-section .form-check-label {
412
+ font-size: 16px;
413
+ margin-left: 5px;
414
+ cursor: pointer;
415
+ display: inline-block; /* Ensure label aligns correctly with checkbox */
416
+ vertical-align: middle; /* Align text vertically with the checkbox */
417
+ }
418
+ /* Fix alignment of text and checkbox */
419
+ .addon-section .form-check input[type="checkbox"],
420
+ .addon-section .form-check label {
421
+ display: inline-block;
422
+ /* vertical-align: middle; /* Align text and checkboxes vertically */
423
+ }
424
+ /* Category Filter with Custom Radio Buttons */
425
+ form.text-center.mb-4 {
426
+ display: flex;
427
+ flex-direction: column;
428
+ align-items: center;
429
+ justify-content: center;
430
+ margin-bottom: 5px; /* Reduce bottom margin */
431
+ }
432
+ .form-check {
433
+ display: inline-block;
434
+ margin-right: 5px; /* Reduced space between radio button and label */
435
+ margin-bottom: 0; /* Remove bottom margin */
436
+ margin-top: 10px; /* Adds space between categories and Customized Dish */
437
+ vertical-align: middle; /* Align radio buttons vertically */
438
+ }
439
+ .form-check-inline {
440
+ display: inline-block;
441
+ margin-right: 5px; /* Decrease space between each radio button */
442
+ }
443
+ .form-check-label {
444
+ display: inline-block;
445
+ font-size: 16px;
446
+ margin-left: 5px; /* Spacing between radio button and label */
447
+ vertical-align: middle; /* Align label vertically */
448
+ }
449
+ form-check-input addon-option{
450
+ color: #333d47;
451
+ }
452
+ .custom-radio {
453
+ appearance: none;
454
+ -webkit-appearance: none;
455
+ -moz-appearance: none;
456
+ width: 20px;
457
+ height: 20px;
458
+ border: 3px solid #4CAF50; /* Green border */
459
+ border-radius: 50%;
460
+ margin-right: -5px; /* Reduced spacing between button and label */
461
+ outline: none;
462
+ cursor: pointer;
463
+ position: relative;
464
+ display: inline-block;
465
+ vertical-align: middle; /* Align vertically with text */
466
+ }
467
+ .custom-radio:checked {
468
+ background-color: #4CAF50; /* Green color when checked */
469
+ border-color: #4CAF50; /* Matching border color */
470
+ }
471
+ .custom-radio:checked::after {
472
+ content: '';
473
+ position: relative;
474
+ top: 5px;
475
+ left: 5px;
476
+ border-radius: 50%;
477
+ }
478
+ .custom-radio:hover {
479
+ border-color: #388E3C;
480
+ }
481
+ /* Optional: Style the labels */
482
+ .form-check-label {
483
+ font-size: 16px;
484
+ margin-left: 8px; /* Space between the radio button and the label */
485
+ }
486
+ .cart-container {
487
+ display: flex;
488
+ align-items: center;
489
+ gap: 10px;
490
+ }
491
+
492
+ /* modal################## */
493
+ .modal-footer {
494
+ display: flex;
495
+ align-items: center;
496
+ justify-content: space-between; /* Space between quantity and Add to Cart button */
497
+ padding: 10px;
498
+ }
499
+ .modal-footer .d-flex {
500
+ display: flex;
501
+ align-items: center;
502
+ gap: 10px; /* Space between quantity buttons */
503
+ }
504
+ .modal-footer .btn {
505
+ height: 40px; /* Set consistent button height */
506
+ padding: 0 15px; /* Adjust padding to fit inside the buttons */
507
+ }
508
+ .modal-footer .form-control {
509
+ width: 50px; /* Fixed width for quantity input */
510
+ height: 40px; /* Match the height of buttons */
511
+ text-align: center; /* Center the value inside the input */
512
+ }
513
+ .modal-footer .btn-primary {
514
+ background-color: #0FAA39; /* Green background for Add to Cart button */
515
+ border-color: #0FAA39; /* Border color to match button background */
516
+ font-weight: bold; /* Bold text */
517
+ padding: 10px 20px; /* Adjust padding to make the button look better */
518
+ height: 40px; /* Match the height with quantity buttons */
519
+ display: flex;
520
+ justify-content: center;
521
+ align-items: center;
522
+ width: auto; /* Auto width to adjust to button text */
523
+ }
524
+ .modal-footer .btn-outline-secondary {
525
+ height: 40px; /* Ensure quantity buttons are the same size */
526
+ width: 40px; /* Make sure the buttons are square */
527
+ }
528
+ @media (max-width: 576px) {
529
+ /* Responsive adjustments for smaller screens */
530
+ .modal-dialog {
531
+ max-width: 98%; /* Adjust modal width for smaller screens */
532
+ }
533
+ .modal-footer .btn {
534
+ height: 35px; /* Smaller buttons for small screens */
535
+ }
536
+ .modal-footer .form-control {
537
+ width: 40px; /* Adjust input size for smaller screens */
538
+ height: 35px;
539
+ }
540
+ }
541
+ </style>
542
  </head>
543
  <body>
544
 
545
+ <div class="fixed-top-bar">
546
+ <!-- Avatar and Dropdown -->
547
+ <div class="avatar-dropdown-container">
548
+ <div class="avatar-icon">
549
+ <span>{{ first_letter }}</span> <!-- Display the first letter of the customer's name -->
 
 
 
 
 
550
  </div>
551
+ <div class="dropdown-menu">
552
+ <a href="{{ url_for('user_details.customer_details') }}" class="dropdown-item">View Profile</a>
553
 
554
+ <a href="{{ url_for('orderhistory.order_history') }}" class="dropdown-item">Order History</a>
555
+ <a href="{{ url_for('logout') }}" class="dropdown-item">Logout</a>
 
556
  </div>
557
  </div>
558
 
559
+ <!-- Search Bar Section -->
560
+ <div class="search-bar-container">
561
+ <input type="text" id="searchBar" class="form-control" placeholder="Search items or sections..." onkeyup="filterMenu()">
562
+ <i class="bi bi-search search-icon"></i> <!-- Search icon inside the input -->
563
+ </div>
564
+ </div>
565
+
566
+ <!-- Category Filter with Custom Radio Buttons -->
567
+ <form method="get" action="/menu" class="text-center mb-4">
568
+ <label class="form-label fw-bold">Select a Category:</label>
569
+ <div class="form-check form-check-inline">
570
+ {% for category in categories %}
571
+ <input type="radio" id="category-{{ category }}" name="category" value="{{ category }}" class="custom-radio"
572
+ {% if selected_category == category %}checked{% endif %} onchange="this.form.submit()">
573
+ <label class="form-check-label" for="category-{{ category }}">{{ category }}</label>
574
+ {% endfor %}
575
+ </div>
576
+ <!-- Separate Customized Dish radio button in a new div to align it properly -->
577
+ <div class="form-check">
578
+ <input type="radio" id="category-CustomizedDish" name="category" value="Customized Dish" class="custom-radio"
579
+ {% if selected_category == "Customized Dish" %}checked{% endif %} onchange="this.form.submit()">
580
+ <label class="form-check-label" for="category-CustomizedDish">Customized Dish</label>
581
+ </div>
582
+ </form>
583
+
584
+ <!-- Show menu items only when Customized Dish is not selected -->
585
  <div class="container mt-4">
586
  <h1 class="text-center">Menu</h1>
587
+
588
+ <!-- Display text boxes for Customized Dish -->
589
+ {% if selected_category == "Customized Dish" %}
590
+ <div id="custom-dish-form" class="mt-4">
591
+ <h3>Create Your Custom Dish</h3>
592
+ <form method="POST" action="/customdish/generate_custom_dish">
593
+ <div class="mb-3">
594
+ <label for="custom-dish-name" class="form-label">Dish Name</label>
595
+ <input type="text" class="form-control" id="custom-dish-name" name="name" required>
596
+ </div>
597
+ <div class="mb-3">
598
+ <label for="custom-dish-description" class="form-label">Dish Description</label>
599
+ <textarea class="form-control" id="custom-dish-description" name="description" required></textarea>
600
+ </div>
601
+ <button type="submit" class="btn btn-primary">Submit</button>
602
+ </form>
603
+ </div>
604
+ {% else %}
605
+
606
+ <!-- Menu Sections -->
607
  {% for section, items in ordered_menu.items() %}
608
  <h3>{{ section }}</h3>
609
  <div class="row">
610
  {% for item in items %}
611
+ <!-- <div class="col-md-6 mb-4">
612
+ <div class="card menu-card">
613
+ <img src="{{ item.Image1__c }}" class="card-img-top menu-image" alt="{{ item.Name }}" onerror="this.src='/static/placeholder.jpg';" "loading="lazy">
614
+ <div class="card-body">
615
+ <h5 class="card-title">{{ item.Name }}</h5>
616
+ <p class="card-text">${{ item.Price__c }}</p>
617
+ <button class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#itemModal"
618
+ onclick="showItemDetails('{{ item.Name }}', '{{ item.Price__c }}', '{{ item.Image2__c }}', '{{ item.Description__c }}', '{{ item.Section__c }}','{{ selected_category }}')">
619
+ Add
620
+ </button>
 
 
 
621
  </div>
622
  </div>
623
+ </div> -->
624
+ <div class="col-md-6 mb-4">
625
+ <div class="card menu-card">
626
+ <img src="{{ item.Image1__c }}" class="card-img-top menu-image" alt="{{ item.Name }}"
627
+ onerror="this.src='/static/placeholder.jpg';" loading="lazy">
628
+
629
+ <!-- Customize Button on Image -->
630
+ <!-- <button class="btn customize-btn"
631
+ data-bs-toggle="modal" data-bs-target="#itemModal"
632
+ onclick="showItemDetails('{{ item.Name }}', '{{ item.Price__c }}', '{{ item.Image2__c }}', '{{ item.Description__c }}', '{{ item.Section__c }}','{{ selected_category }}')">
633
+ Customize <i class="bi bi-caret-right-fill"></i>
634
+ </button> -->
635
+
636
+ <!-- <div class="card-body">
637
+ <h5 class="card-title">{{ item.Name }}</h5>
638
+ <p class="card-text">${{ item.Price__c }}</p>
639
+ </div> -->
640
+ <div class="addbutton">
641
+ <div class="card-body d-flex align-items-center justify-content-between">
642
+ <div>
643
+ <h5 class="card-title">{{ item.Name }}</h5>
644
+ <p class="card-text">${{ item.Price__c }}</p>
645
+ </div>
646
+ <div class= "d-flex flex-column align-item-center justify-content-center">
647
+ <!-- <button class="btn btn-primary>ADD</button> -->
648
+
649
+ <div >
650
+ <button class="btn btn btn-primary "
651
+ data-bs-toggle="modal" data-bs-target="#itemModal"
652
+ onclick="showItemDetails('{{ item.Name }}', '{{ item.Price__c }}', '{{ item.Image2__c }}', '{{ item.Description__c }}', '{{ item.Section__c }}','{{ selected_category }}')">
653
+ ADD
654
+ </button>
655
+ </div>
656
+ <div class="w-100 text-center">
657
+
658
+
659
+
660
+ {% if item.Section__c != 'Apetizer' and item.Section__c != 'Customized dish' %}
661
+ <h5 class="customisable-text">Customisable</h5>
662
+ {% endif %}
663
+ </div>
664
+
665
+
666
+
667
+ </div>
668
+
669
+
670
+
671
+
672
+ </div>
673
+ </div>
674
+
675
+
676
+ </div>
677
+ </div>
678
  {% endfor %}
679
  </div>
680
  {% endfor %}
681
  </div>
682
+ {% endif %}
683
+
684
+ </div>
685
 
686
+ <!-- View Cart Button -->
687
  <div class="view-cart-container">
688
+ <a href="{{ url_for('cart.cart') }}" class="view-cart-button">
689
  View Cart
690
  </a>
691
  </div>
692
 
693
+ <!-- Modal for Item Details -->
694
+ <div class="modal fade" id="itemModal" tabindex="-1" aria-labelledby="itemModalLabel" aria-hidden="true">
695
+ <div class="modal-dialog modal-dialog-centered">
696
+ <div class="modal-content">
697
+ <div class="modal-header">
698
+ <h5 class="modal-title" id="itemModalLabel">Item Details</h5>
699
+ <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
700
+ </div>
701
+ <div class="modal-body">
702
+ <!-- Item Image -->
703
+ <img id="modal-img" class="img-fluid rounded mb-3 d-block mx-auto" alt="Item Image" style="max-height: 200px; object-fit: cover;">
704
+ <!-- Item Name -->
705
+ <h5 id="modal-name" class="fw-bold text-center"></h5>
706
+ <!-- Item Price -->
707
+ <p id="modal-price" class="text-muted text-center"></p>
708
+ <!-- Item Description -->
709
+ <p id="modal-description" class="text-secondary"></p>
710
+ <!-- Add-ons -->
711
+ <div id="modal-addons" class="modal-addons mt-4">
712
+ <h6>Customization Options</h6>
713
+ <div id="addons-list" class="addons-container">Loading customization options...</div>
714
  </div>
715
+ <div class="mt-4">
716
+ <h6>Custom Request</h6>
717
+ <textarea id="modal-instructions" class="form-control" placeholder="Enter any special instructions here..."></textarea>
 
 
 
 
 
 
 
 
 
 
 
718
  </div>
719
+ <span id="modal-section" data-section="" data-category="" style="display: none;"></span>
720
+ </div>
721
+ <!-- Quantity Controls and Add to Cart Button -->
722
+ <div class="modal-footer d-flex align-items-center justify-content-between">
723
+ <!-- Quantity Controls -->
724
+ <div class="d-flex align-items-center gap-2">
725
+ <button type="button" class="btn btn-outline-secondary" id="decreaseQuantity">-</button>
726
+ <input type="text" class="form-control text-center" id="quantityInput" value="1" readonly style="width: 50px;"/>
727
+ <button type="button" class="btn btn-outline-secondary" id="increaseQuantity">+</button>
728
  </div>
729
+ <!-- Add to Cart Button -->
730
+ <button type="button" class="btn btn-primary" onclick="addToCartFromModal()">Add to Cart</button>
731
  </div>
732
  </div>
733
  </div>
734
+ </div>
735
+
736
+
737
+
738
+ <!-- JavaScript -->
739
+ <script>
740
+ // Show item details and fetch customization options
741
+ function showItemDetails(name, price, image, description, section, selectedCategory) {
742
+ document.getElementById('modal-name').innerText = name;
743
+ document.getElementById('modal-price').innerText = `$${price}`;
744
+ document.getElementById('modal-img').src = image || '/static/placeholder.jpg';
745
+ document.getElementById('modal-description').innerText = description || 'No description available.';
746
+ document.getElementById('addons-list').innerHTML = 'Loading customization options...';
747
+ document.getElementById('modal-instructions').value = '';
748
+
749
+ const modalSectionEl = document.getElementById('modal-section');
750
+ modalSectionEl.setAttribute('data-section', section);
751
+ modalSectionEl.setAttribute('data-category', selectedCategory);
752
+
753
+ // Set the default quantity to 1
754
+ document.getElementById('quantityInput').value = 1;
755
+
756
+ // Fetch customization options based on the section
757
+ fetch(`/api/addons?item_name=${encodeURIComponent(name)}&item_section=${encodeURIComponent(section)}`)
758
+ .then(response => response.json())
759
+ .then(data => {
760
+ const addonsList = document.getElementById('addons-list');
761
+ addonsList.innerHTML = ''; // Clear previous content
762
 
763
+ if (!data.success || !data.addons || data.addons.length === 0) {
764
+ addonsList.innerHTML = '<p>No customization options available.</p>';
765
+ return;
766
+ }
767
+
768
+ // Display customization options inside styled divs
769
+ data.addons.forEach(addon => {
770
+ const sectionDiv = document.createElement('div');
771
+ sectionDiv.classList.add('addon-section'); // Add styling class
 
 
 
 
 
 
 
 
 
 
 
 
 
 
772
 
773
+ // Add section title
774
+ const title = document.createElement('h6');
775
+ title.innerText = addon.name;
776
+ sectionDiv.appendChild(title);
777
+
778
+ // Create options list
779
+ const optionsContainer = document.createElement('div');
780
+ addon.options.forEach((option, index) => {
781
+ const optionId = `addon-${addon.name.replace(/\s+/g, '')}-${index}`;
782
+ const listItem = document.createElement('div');
783
+ listItem.classList.add('form-check');
784
+ listItem.innerHTML = `
785
+ <input type="checkbox" class="form-check-input addon-option" id="${optionId}" value="${option}"
786
+ data-name="${option}" data-group="${addon.name}" data-price="${addon.extra_charge ? addon.extra_charge_amount : 0}">
787
+ <label class="form-check-label" for="${optionId}">
788
+ ${option} ${addon.extra_charge ? `($${addon.extra_charge_amount})` : ''}
789
+ </label>
790
+ `;
791
+ optionsContainer.appendChild(listItem);
 
 
 
792
  });
793
+ sectionDiv.appendChild(optionsContainer);
794
+ addonsList.appendChild(sectionDiv);
 
 
795
  });
796
+ })
797
+ .catch(err => {
798
+ console.error('Error fetching add-ons:', err);
799
+ document.getElementById('addons-list').innerHTML = '<p>Error loading customization options.</p>';
800
+ });
801
+ }
802
+
803
+ // Handle single-select/deselect logic for checkbox groups in all modals
804
+ document.addEventListener('click', function(event) {
805
+ if (event.target.classList.contains('addon-option')) {
806
+ handleAddonClick(event.target);
807
  }
808
+ });
809
+
810
+ // Handle checkbox selection logic
811
+ function handleAddonClick(checkbox) {
812
+ const groupName = checkbox.getAttribute('data-group');
813
+ const isMultiSelectGroup = ["Extra Toppings", "Choose Raita/Sides","Select Dip/Sauce","Extra Add-ons","Make it a Combo"].includes(groupName);
814
+
815
+ // If it's not multi-select, uncheck all other checkboxes in the same group
816
+ if (!isMultiSelectGroup) {
817
+ const checkboxes = document.querySelectorAll(`.addon-option[data-group="${groupName}"]`);
818
+ checkboxes.forEach(otherCheckbox => {
819
+ if (otherCheckbox !== checkbox) {
820
+ otherCheckbox.checked = false;
821
+ }
822
+ });
823
+ }
824
+ }
825
+ function filterMenu() {
826
+ let input = document.getElementById('searchBar').value.toLowerCase(); // Get the value from search bar
827
+ let sections = document.querySelectorAll('h3'); // Select section headers
828
+ let items = document.querySelectorAll('.menu-card'); // Select all items
829
+ let matchedSections = new Set(); // Store matched sections
830
+
831
+ // Hide all items initially
832
+ items.forEach(item => {
833
+ let itemName = item.querySelector('.card-title').innerText.toLowerCase(); // Get item name
834
+ let itemSection = item.closest('.row').previousElementSibling.innerText.toLowerCase(); // Get section name
835
+
836
+ // If the search matches item name or section, show the item
837
+ if (itemName.includes(input) || (itemSection && itemSection.includes(input))) {
838
+ item.style.display = 'block'; // Show item if it matches search
839
+ matchedSections.add(item.closest('.row')); // Add section to matched list
840
+ } else {
841
+ item.style.display = 'none'; // Hide item if not matched
842
+ }
843
+ });
844
+
845
+ // Show or hide sections based on matched items
846
+ sections.forEach(section => {
847
+ let sectionRow = section.nextElementSibling; // The row containing items
848
+ if (matchedSections.has(sectionRow)) {
849
+ section.style.display = 'block'; // Show section header
850
+ sectionRow.style.display = 'flex'; // Show section items
851
+ } else {
852
+ section.style.display = 'none'; // Hide section header
853
+ sectionRow.style.display = 'none'; // Hide section items
854
+ }
855
+ });
856
+ }
857
+
858
+ function addToCartFromModal() {
859
+ const itemName = document.getElementById('modal-name').innerText;
860
+ let itemPrice = parseFloat(document.getElementById('modal-price').innerText.replace('$', ''));
861
+
862
+ // Validate item price
863
+ if (isNaN(itemPrice)) {
864
+ alert('Invalid price for the item. Please check the item details.');
865
+ return;
866
+ }
867
+
868
+ const itemImage = document.getElementById('modal-img').src;
869
+ console.log(itemName, itemPrice, itemImage); // Log values for debugging
870
+ const modalSectionEl = document.getElementById('modal-section');
871
+ const section = modalSectionEl.getAttribute('data-section');
872
+ const selectedCategory = modalSectionEl.getAttribute('data-category');
873
+ if (!itemName || !itemPrice || !section || !itemImage) {
874
+ console.error('Missing data for cart item:', { itemName, itemPrice, section, itemImage});
875
+ return;
876
+ }
877
+
878
+ // Collect selected add-ons
879
+ let selectedAddOns = Array.from(
880
+ document.querySelectorAll('#addons-list input[type="checkbox"]:checked')
881
+ ).map(addon => ({
882
+ name: addon.getAttribute('data-name') || 'Default Name', // Fallback Name
883
+ price: parseFloat(addon.getAttribute('data-price') || 0)
884
+ }));
885
+
886
+ // Get the selected quantity
887
+ const quantity = parseInt(document.getElementById('quantityInput').value) || 1; // Default to 1 if invalid
888
+
889
+ const instructions = document.getElementById('modal-instructions').value;
890
+
891
+ // Prepare data for the cart
892
+ const cartPayload = {
893
+ itemName: itemName,
894
+ itemPrice: itemPrice,
895
+ itemImage: itemImage,
896
+ section: section,
897
+ category: selectedCategory,
898
+ addons: selectedAddOns,
899
+ instructions: instructions,
900
+ quantity: quantity // Include the quantity
901
+ };
902
+
903
+ // Send the cart data to the server
904
+ fetch('/cart/add', {
905
+ method: 'POST',
906
+ headers: {
907
+ 'Content-Type': 'application/json',
908
+ },
909
+ body: JSON.stringify(cartPayload)
910
+ })
911
+ .then(response => response.json())
912
+ .then(data => {
913
+ if (data.success) {
914
+ alert('Item added to cart successfully!');
915
+ updateCartUI(data.cart); // Update cart UI after adding an item
916
+ const modal = document.getElementById('itemModal');
917
+ const modalInstance = bootstrap.Modal.getInstance(modal);
918
+ modalInstance.hide();
919
+ } else {
920
+ alert(data.error || 'Failed to add item to cart.');
921
+ }
922
+ })
923
+ .catch(err => {
924
+ console.error('Error adding item to cart:', err);
925
+ alert('An error occurred while adding the item to the cart.');
926
+ });
927
+ }
928
+
929
+ function updateCartUI(cart) {
930
+ if (!Array.isArray(cart)) {
931
+ console.error('Invalid cart data:', cart);
932
+ return;
933
+ }
934
+ const cartIcon = document.getElementById('cart-icon');
935
+ cartIcon.innerText = cart.length; // Assuming cart is an array of items
936
+ }
937
+
938
+ function updateCartDisplay(cart) {
939
+ if (!Array.isArray(cart)) {
940
+ console.error('Invalid cart data:', cart);
941
+ return;
942
+ }
943
+ // Optional: Update quantity on the cart page
944
+ const cartCountElement = document.getElementById('cart-count');
945
+ cartCountElement.innerText = cart.reduce((total, item)=> total+item.quantity,0); // Update cart item count //Sum of all quantities
946
+
947
+ // Optionally, show a small success notification that the item was added
948
+ const successNotification = document.createElement('div');
949
+ successNotification.classList.add('success-notification');
950
+ successNotification.innerText = 'Item added to cart!';
951
+ document.body.appendChild(successNotification);
952
+ setTimeout(() => {
953
+ successNotification.remove(); // Remove success notification after a few seconds
954
+ }, 2000);
955
+ }
956
+
957
+ document.addEventListener('DOMContentLoaded', function () {
958
+ // Get references to the quantity buttons and the input field
959
+ const decreaseBtn = document.getElementById('decreaseQuantity');
960
+ const increaseBtn = document.getElementById('increaseQuantity');
961
+ const quantityInput = document.getElementById('quantityInput');
962
+
963
+ // Add event listener to decrease button
964
+ decreaseBtn.addEventListener('click', function () {
965
+ let currentQuantity = parseInt(quantityInput.value);
966
+ if (currentQuantity > 1) {
967
+ currentQuantity--;
968
+ quantityInput.value = currentQuantity;
969
+ }
970
+ });
971
+
972
+ // Add event listener to increase button
973
+ increaseBtn.addEventListener('click', function () {
974
+ let currentQuantity = parseInt(quantityInput.value);
975
+ currentQuantity++;
976
+ quantityInput.value = currentQuantity;
977
+ });
978
+ });
979
+
980
+
981
+
982
  </script>
983
 
984
  <!-- Bootstrap JS -->