Subbu1304 commited on
Commit
c7f5471
·
verified ·
1 Parent(s): 87a88b6

Update templates/menu.html

Browse files
Files changed (1) hide show
  1. templates/menu.html +5 -277
templates/menu.html CHANGED
@@ -6,60 +6,7 @@
6
  <title>Menu</title>
7
  <!-- Bootstrap CSS -->
8
  <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet">
9
- <!-- <style>
10
- /* avthar */
11
- .avatar-dropdown-container {
12
- position: relative;
13
- display: inline-block;
14
- }
15
-
16
- .avatar-icon {
17
- width: 50px;
18
- height: 50px;
19
- border-radius: 50%;
20
- overflow: hidden;
21
- display: flex;
22
- justify-content: center;
23
- align-items: center;
24
- background-color: #f0f0f0;
25
- cursor: pointer; /* Allow clicking to upload */
26
- }
27
-
28
- .avatar-img {
29
- width: 100%;
30
- height: 100%;
31
- object-fit: cover;
32
- border-radius: 50%;
33
- }
34
-
35
- .dropdown-menu {
36
- display: none;
37
- position: absolute;
38
- background: white;
39
- box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1);
40
- padding: 10px;
41
- border-radius: 5px;
42
- }
43
-
44
- .avatar-dropdown-container:hover .dropdown-menu {
45
- display: block;
46
- }
47
-
48
- .dropdown-item {
49
- display: block;
50
- padding: 5px 10px;
51
- text-decoration: none;
52
- color: black;
53
- }
54
-
55
- .dropdown-item:hover {
56
- background-color: #f0f0f0;
57
- }
58
-
59
-
60
-
61
-
62
-
63
  body {
64
  font-family: Arial, sans-serif;
65
  background-color: #f8f9fa;
@@ -107,7 +54,6 @@
107
  border-color: #1e7e34;
108
  box-shadow: none;
109
  }
110
-
111
  .view-cart-container {
112
  position: fixed;
113
  bottom: 20px;
@@ -131,11 +77,9 @@
131
  background-color: #4a5d68;
132
  text-decoration: none;
133
  }
134
-
135
  .avatar-dropdown-container {
136
  position: relative;
137
  }
138
-
139
  .avatar-icon {
140
  width: 40px;
141
  height: 40px;
@@ -149,7 +93,6 @@
149
  font-size: 20px;
150
  font-weight: bold;
151
  }
152
-
153
  .dropdown-menu {
154
  position: absolute;
155
  right: 0;
@@ -160,11 +103,9 @@
160
  box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.1);
161
  display: none;
162
  }
163
-
164
  .avatar-dropdown-container:hover .dropdown-menu {
165
  display: block;
166
  }
167
-
168
  .dropdown-menu .dropdown-item {
169
  padding: 10px 15px;
170
  text-decoration: none;
@@ -172,11 +113,9 @@
172
  border-bottom: 1px solid #ddd;
173
  display: block; /* Make each item stack vertically */
174
  }
175
-
176
  .dropdown-menu .dropdown-item:last-child {
177
  border-bottom: none; /* Remove the bottom border from the last item */
178
  }
179
-
180
  .dropdown-menu .dropdown-item:hover {
181
  background-color: #f1f1f1;
182
  }
@@ -193,17 +132,14 @@
193
  border-radius: 25px;
194
  box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.2);
195
  }
196
-
197
  /* Ensure the category filter dropdown does not overlap */
198
  form.text-center.mb-4 {
199
  margin-top: 120px !important; /* Increase spacing below search bar */
200
  }
201
-
202
  /* Ensure the container has enough margin so nothing is overlapped */
203
  .container {
204
  margin-top: 180px; /* Adjust spacing based on navbar and search bar */
205
  }
206
-
207
  .fixed-top-bar {
208
  position: fixed;
209
  top: 0;
@@ -225,7 +161,6 @@
225
  padding: 12px;
226
  margin-bottom: 15px; /* Spacing between sections */
227
  }
228
-
229
  /* Customization section title */
230
  .addon-section h6 {
231
  margin-bottom: 10px;
@@ -233,162 +168,13 @@
233
  font-weight: bold;
234
  color: #333;
235
  }
236
-
237
  /* Style for add-on checkboxes */
238
  .addon-section .form-check {
239
  margin-left: 10px;
240
  }
241
-
242
- </style> -->
243
- <!-- <style>
244
- /* Menu item images and card styling */
245
- .menu-card {
246
- max-width: 100%;
247
- border-radius: 10px;
248
- overflow: hidden;
249
- background-color: #fff;
250
- margin: auto;
251
- }
252
-
253
- .menu-image {
254
- height: 100px;
255
- width: 100%;
256
- object-fit: cover;
257
- border-radius: 10px 10px 0 0;
258
- }
259
-
260
- .card-body {
261
- padding: 10px;
262
- }
263
-
264
- /* Responsive grid for 3 columns */
265
- @media (min-width: 768px) {
266
- .menu-card {
267
- max-width: 100%;
268
- }
269
- .col-md-4 {
270
- flex: 0 0 30%; /* Reduced the width of each card */
271
- max-width: 30%;
272
- }
273
- }
274
-
275
- /* Adjusting the appearance of the category and section headers */
276
- h3 {
277
- margin-top: 20px;
278
- font-size: 1.1rem; /* Slightly smaller font size */
279
- font-weight: bold;
280
- }
281
-
282
- </style> -->
283
- <style>/* Menu item images and card styling */
284
- .menu-card {
285
- max-width: 100%;
286
- border-radius: 10px; /* Border radius for rounded corners */
287
- overflow: hidden;
288
- background-color: #fff;
289
- margin: auto;
290
- padding: 10px; /* Padding around the card */
291
- display: flex;
292
- flex-direction: column;
293
- justify-content: space-between;
294
- }
295
-
296
- .menu-image {
297
- height: 200px; /* Increased the height of the image */
298
- width: 100%; /* Ensures the image takes up the full width */
299
- object-fit: cover; /* Changed from 'contain' to 'cover' for full coverage */
300
- border-radius: 10px 10px 0 0; /* Slightly smaller radius for the top corners */
301
- }
302
-
303
- .card-body {
304
- padding: 10px; /* Padding for the content area inside the card */
305
- }
306
-
307
- /* Responsive grid for 3 columns */
308
- @media (min-width: 768px) {
309
- .menu-card {
310
- max-width: 100%;
311
- }
312
- .col-md-4 {
313
- flex: 0 0 30%; /* Reduced the width of each card */
314
- max-width: 30%;
315
- }
316
- }
317
-
318
- /* Adjusting the appearance of the category and section headers */
319
- h3 {
320
- margin-top: 20px;
321
- font-size: 1.1rem; /* Slightly smaller font size */
322
- font-weight: bold;
323
- }
324
- </style>
325
  </head>
326
-
327
- <div class="container mt-4">
328
- <h1 class="text-center">Menu</h1>
329
-
330
- <!-- Category Filter -->
331
- <form method="get" action="/menu" class="text-center mb-4">
332
- <label for="category" class="form-label fw-bold">Filter by Category:</label>
333
- <select id="category" name="category" class="form-select" onchange="this.form.submit()">
334
- {% for category in categories %}
335
- <option value="{{ category }}" {% if selected_category == category %}selected{% endif %}>
336
- {{ category }}
337
- </option>
338
- {% endfor %}
339
- <option value="Customized Dish" {% if selected_category == "Customized Dish" %}selected{% endif %}>
340
- Customized Dish
341
- </option>
342
- </select>
343
- </form>
344
-
345
- {% if selected_category == "Customized Dish" %}
346
- <!-- Customized Dish Form -->
347
- <div id="custom-dish-form" class="mt-4">
348
- <h3>Create Your Custom Dish</h3>
349
- <form method="POST" action="/generate_custom_dish">
350
- <div class="mb-3">
351
- <label for="custom-dish-name" class="form-label">Dish Name</label>
352
- <input type="text" class="form-control" id="custom-dish-name" name="name" required>
353
- </div>
354
- <div class="mb-3">
355
- <label for="custom-dish-description" class="form-label">Dish Description</label>
356
- <textarea class="form-control" id="custom-dish-description" name="description" required></textarea>
357
- </div>
358
- <button type="submit" class="btn btn-primary">Submit</button>
359
- </form>
360
- </div>
361
- {% else %}
362
- <!-- Menu Items in 3 Columns -->
363
- <div class="container mt-4">
364
- <!-- <h1 class="text-center">Menu</h1> -->
365
- <div class="row">
366
- {% for section, items in ordered_menu.items() %}
367
- <h3 class="col-12">{{ section }}</h3>
368
- <div class="row">
369
- {% for item in items %}
370
- <div class="col-md-4 mb-4">
371
- <div class="card menu-card">
372
- <img src="{{ item.Image1__c }}" class="card-img-top menu-image" alt="{{ item.Name }}" onerror="this.src='/static/placeholder.jpg';">
373
- <div class="card-body">
374
- <h5 class="card-title">{{ item.Name }}</h5>
375
- <p class="card-text">${{ item.Price__c }}</p>
376
- <button class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#itemModal"
377
- onclick="showItemDetails('{{ item.Name }}', '{{ item.Price__c }}', '{{ item.Image2__c }}', '{{ item.Description__c }}', '{{ item.Section__c }}','{{ selected_category }}')">
378
- Add +
379
- </button>
380
- </div>
381
- </div>
382
- </div>
383
- {% endfor %}
384
- </div>
385
- {% endfor %}
386
- </div>
387
- </div>
388
- {% endif %}
389
- </div>
390
-
391
- <!-- <body>
392
 
393
  <div class="fixed-top-bar">
394
  <!-- Removed Reward Points and Referral Code -->
@@ -418,19 +204,7 @@ h3 {
418
  <a href="{{ url_for('logout') }}" class="dropdown-item">Logout</a>
419
  </div>
420
  </div>
421
- <!-- <div class="avatar-dropdown-container">
422
- <div class="avatar-icon" onclick="document.getElementById('imageUpload').click()">
423
- <img id="avatarImage" src="path/to/default-avatar.png" alt="User Avatar" class="avatar-img">
424
- </div>
425
- <input type="file" id="imageUpload" accept="image/*" style="display: none" onchange="previewImage(event)">
426
-
427
- <div class="dropdown-menu">
428
- <a href="{{ url_for('customer_details') }}" class="dropdown-item">View Profile</a>
429
- <a href="{{ url_for('order_history') }}" class="dropdown-item">Order History</a>
430
- <a href="{{ url_for('logout') }}" class="dropdown-item">Logout</a>
431
- </div>
432
- </div> -->
433
- </div>
434
 
435
  <div class="container mt-4">
436
  <h1 class="text-center">Menu</h1>
@@ -561,12 +335,10 @@ h3 {
561
  document.getElementById('modal-description').innerText = description || 'No description available.';
562
  document.getElementById('addons-list').innerHTML = 'Loading customization options...';
563
  document.getElementById('modal-instructions').value = '';
564
-
565
  // Set section and category for reference
566
  const modalSectionEl = document.getElementById('modal-section');
567
  modalSectionEl.setAttribute('data-section', section);
568
  modalSectionEl.setAttribute('data-category', selectedCategory);
569
-
570
  // Fetch customization options based on the section
571
  fetch(`/api/addons?item_name=${encodeURIComponent(name)}&item_section=${encodeURIComponent(section)}`)
572
  .then(response => response.json())
@@ -578,25 +350,20 @@ h3 {
578
  addonsList.innerHTML = '<p>No customization options available.</p>';
579
  return;
580
  }
581
-
582
  // Display customization options inside styled divs
583
  data.addons.forEach(addon => {
584
  const sectionDiv = document.createElement('div');
585
  sectionDiv.classList.add('addon-section'); // Add styling class
586
-
587
  // Add section title
588
  const title = document.createElement('h6');
589
  title.innerText = addon.name;
590
  sectionDiv.appendChild(title);
591
-
592
  // Create options list
593
  const optionsContainer = document.createElement('div');
594
-
595
  addon.options.forEach((option, index) => {
596
  const optionId = `addon-${addon.name.replace(/\s+/g, '')}-${index}`;
597
  const listItem = document.createElement('div');
598
  listItem.classList.add('form-check');
599
-
600
  listItem.innerHTML = `
601
  <input type="checkbox" class="form-check-input addon-option" id="${optionId}" value="${option}"
602
  data-name="${option}" data-price="${addon.extra_charge ? addon.extra_charge_amount : 0}">
@@ -606,7 +373,6 @@ h3 {
606
  `;
607
  optionsContainer.appendChild(listItem);
608
  });
609
-
610
  sectionDiv.appendChild(optionsContainer);
611
  addonsList.appendChild(sectionDiv);
612
  });
@@ -620,14 +386,11 @@ h3 {
620
  let input = document.getElementById('searchBar').value.toLowerCase();
621
  let sections = document.querySelectorAll('h3'); // Select section headers
622
  let items = document.querySelectorAll('.menu-card'); // Select all items
623
-
624
  let matchedSections = new Set(); // Store matched sections
625
-
626
  // Hide all items initially
627
  items.forEach(item => {
628
  let itemName = item.querySelector('.card-title').innerText.toLowerCase();
629
  let itemSection = item.closest('.row').previousElementSibling.innerText.toLowerCase(); // Get section name
630
-
631
  if (itemName.includes(input) || (itemSection && itemSection.includes(input))) {
632
  item.style.display = 'block'; // Show item if it matches search
633
  matchedSections.add(item.closest('.row')); // Add section to matched list
@@ -635,7 +398,6 @@ h3 {
635
  item.style.display = 'none'; // Hide item if not matched
636
  }
637
  });
638
-
639
  // Show or hide sections based on matched items
640
  sections.forEach(section => {
641
  let sectionRow = section.nextElementSibling; // The row containing items
@@ -648,8 +410,6 @@ h3 {
648
  }
649
  });
650
  }
651
-
652
-
653
  function addToCartFromModal() {
654
  const itemName = document.getElementById('modal-name').innerText;
655
  const itemPrice = parseFloat(document.getElementById('modal-price').innerText.replace('$', ''));
@@ -657,7 +417,6 @@ h3 {
657
  const modalSectionEl = document.getElementById('modal-section');
658
  const section = modalSectionEl.getAttribute('data-section');
659
  const selectedCategory = modalSectionEl.getAttribute('data-category');
660
-
661
  // Collect selected add-ons
662
  const selectedAddOns = Array.from(
663
  document.querySelectorAll('#addons-list input[type="checkbox"]:checked')
@@ -665,14 +424,11 @@ h3 {
665
  name: addon.getAttribute('data-name'),
666
  price: parseFloat(addon.getAttribute('data-price'))
667
  }));
668
-
669
  const instructions = document.getElementById('modal-instructions').value;
670
-
671
  if (!itemName || !itemPrice) {
672
  alert('Failed to add item to cart. Please try again.');
673
  return;
674
  }
675
-
676
  const cartPayload = {
677
  itemName: itemName,
678
  itemPrice: itemPrice,
@@ -682,7 +438,6 @@ h3 {
682
  addons: selectedAddOns,
683
  instructions: instructions
684
  };
685
-
686
  fetch('/cart/add', {
687
  method: 'POST',
688
  headers: {
@@ -706,7 +461,6 @@ h3 {
706
  alert('An error occurred while adding the item to the cart.');
707
  });
708
  }
709
-
710
  // Function to round reward points to a single digit
711
  function roundRewardPoints() {
712
  let rewardPointsElement = document.getElementById('reward-points');
@@ -716,38 +470,12 @@ h3 {
716
  rewardPointsElement.innerText = rewardPoints.toFixed(1); // Rounds to 1 decimal place
717
  }
718
  }
719
-
720
  // Run the function when the page loads
721
  window.onload = roundRewardPoints;
722
-
723
- // avathar script
724
-
725
- // Default avatar image
726
- const defaultAvatar = "path/to/default-avatar.png"; // Replace with actual path
727
- const avatarImage = document.getElementById("avatarImage");
728
- const storedImage = localStorage.getItem("userAvatar");
729
-
730
- // If user has previously uploaded an image, load it
731
- if (storedImage) {
732
- avatarImage.src = storedImage;
733
- }
734
-
735
- // Function to preview and save uploaded image
736
- function previewImage(event) {
737
- const file = event.target.files[0];
738
- if (file) {
739
- const reader = new FileReader();
740
- reader.onload = function(e) {
741
- avatarImage.src = e.target.result; // Set new image
742
- localStorage.setItem("userAvatar", e.target.result); // Store in localStorage
743
- };
744
- reader.readAsDataURL(file);
745
- }
746
- }
747
 
748
  </script>
749
 
750
  <!-- Bootstrap JS -->
751
  <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>
752
- </body> -->
753
  </html>
 
6
  <title>Menu</title>
7
  <!-- Bootstrap CSS -->
8
  <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet">
9
+ <style>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
  body {
11
  font-family: Arial, sans-serif;
12
  background-color: #f8f9fa;
 
54
  border-color: #1e7e34;
55
  box-shadow: none;
56
  }
 
57
  .view-cart-container {
58
  position: fixed;
59
  bottom: 20px;
 
77
  background-color: #4a5d68;
78
  text-decoration: none;
79
  }
 
80
  .avatar-dropdown-container {
81
  position: relative;
82
  }
 
83
  .avatar-icon {
84
  width: 40px;
85
  height: 40px;
 
93
  font-size: 20px;
94
  font-weight: bold;
95
  }
 
96
  .dropdown-menu {
97
  position: absolute;
98
  right: 0;
 
103
  box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.1);
104
  display: none;
105
  }
 
106
  .avatar-dropdown-container:hover .dropdown-menu {
107
  display: block;
108
  }
 
109
  .dropdown-menu .dropdown-item {
110
  padding: 10px 15px;
111
  text-decoration: none;
 
113
  border-bottom: 1px solid #ddd;
114
  display: block; /* Make each item stack vertically */
115
  }
 
116
  .dropdown-menu .dropdown-item:last-child {
117
  border-bottom: none; /* Remove the bottom border from the last item */
118
  }
 
119
  .dropdown-menu .dropdown-item:hover {
120
  background-color: #f1f1f1;
121
  }
 
132
  border-radius: 25px;
133
  box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.2);
134
  }
 
135
  /* Ensure the category filter dropdown does not overlap */
136
  form.text-center.mb-4 {
137
  margin-top: 120px !important; /* Increase spacing below search bar */
138
  }
 
139
  /* Ensure the container has enough margin so nothing is overlapped */
140
  .container {
141
  margin-top: 180px; /* Adjust spacing based on navbar and search bar */
142
  }
 
143
  .fixed-top-bar {
144
  position: fixed;
145
  top: 0;
 
161
  padding: 12px;
162
  margin-bottom: 15px; /* Spacing between sections */
163
  }
 
164
  /* Customization section title */
165
  .addon-section h6 {
166
  margin-bottom: 10px;
 
168
  font-weight: bold;
169
  color: #333;
170
  }
 
171
  /* Style for add-on checkboxes */
172
  .addon-section .form-check {
173
  margin-left: 10px;
174
  }
175
+ </style>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
176
  </head>
177
+ <body>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
178
 
179
  <div class="fixed-top-bar">
180
  <!-- Removed Reward Points and Referral Code -->
 
204
  <a href="{{ url_for('logout') }}" class="dropdown-item">Logout</a>
205
  </div>
206
  </div>
207
+ </div>
 
 
 
 
 
 
 
 
 
 
 
 
208
 
209
  <div class="container mt-4">
210
  <h1 class="text-center">Menu</h1>
 
335
  document.getElementById('modal-description').innerText = description || 'No description available.';
336
  document.getElementById('addons-list').innerHTML = 'Loading customization options...';
337
  document.getElementById('modal-instructions').value = '';
 
338
  // Set section and category for reference
339
  const modalSectionEl = document.getElementById('modal-section');
340
  modalSectionEl.setAttribute('data-section', section);
341
  modalSectionEl.setAttribute('data-category', selectedCategory);
 
342
  // Fetch customization options based on the section
343
  fetch(`/api/addons?item_name=${encodeURIComponent(name)}&item_section=${encodeURIComponent(section)}`)
344
  .then(response => response.json())
 
350
  addonsList.innerHTML = '<p>No customization options available.</p>';
351
  return;
352
  }
 
353
  // Display customization options inside styled divs
354
  data.addons.forEach(addon => {
355
  const sectionDiv = document.createElement('div');
356
  sectionDiv.classList.add('addon-section'); // Add styling class
 
357
  // Add section title
358
  const title = document.createElement('h6');
359
  title.innerText = addon.name;
360
  sectionDiv.appendChild(title);
 
361
  // Create options list
362
  const optionsContainer = document.createElement('div');
 
363
  addon.options.forEach((option, index) => {
364
  const optionId = `addon-${addon.name.replace(/\s+/g, '')}-${index}`;
365
  const listItem = document.createElement('div');
366
  listItem.classList.add('form-check');
 
367
  listItem.innerHTML = `
368
  <input type="checkbox" class="form-check-input addon-option" id="${optionId}" value="${option}"
369
  data-name="${option}" data-price="${addon.extra_charge ? addon.extra_charge_amount : 0}">
 
373
  `;
374
  optionsContainer.appendChild(listItem);
375
  });
 
376
  sectionDiv.appendChild(optionsContainer);
377
  addonsList.appendChild(sectionDiv);
378
  });
 
386
  let input = document.getElementById('searchBar').value.toLowerCase();
387
  let sections = document.querySelectorAll('h3'); // Select section headers
388
  let items = document.querySelectorAll('.menu-card'); // Select all items
 
389
  let matchedSections = new Set(); // Store matched sections
 
390
  // Hide all items initially
391
  items.forEach(item => {
392
  let itemName = item.querySelector('.card-title').innerText.toLowerCase();
393
  let itemSection = item.closest('.row').previousElementSibling.innerText.toLowerCase(); // Get section name
 
394
  if (itemName.includes(input) || (itemSection && itemSection.includes(input))) {
395
  item.style.display = 'block'; // Show item if it matches search
396
  matchedSections.add(item.closest('.row')); // Add section to matched list
 
398
  item.style.display = 'none'; // Hide item if not matched
399
  }
400
  });
 
401
  // Show or hide sections based on matched items
402
  sections.forEach(section => {
403
  let sectionRow = section.nextElementSibling; // The row containing items
 
410
  }
411
  });
412
  }
 
 
413
  function addToCartFromModal() {
414
  const itemName = document.getElementById('modal-name').innerText;
415
  const itemPrice = parseFloat(document.getElementById('modal-price').innerText.replace('$', ''));
 
417
  const modalSectionEl = document.getElementById('modal-section');
418
  const section = modalSectionEl.getAttribute('data-section');
419
  const selectedCategory = modalSectionEl.getAttribute('data-category');
 
420
  // Collect selected add-ons
421
  const selectedAddOns = Array.from(
422
  document.querySelectorAll('#addons-list input[type="checkbox"]:checked')
 
424
  name: addon.getAttribute('data-name'),
425
  price: parseFloat(addon.getAttribute('data-price'))
426
  }));
 
427
  const instructions = document.getElementById('modal-instructions').value;
 
428
  if (!itemName || !itemPrice) {
429
  alert('Failed to add item to cart. Please try again.');
430
  return;
431
  }
 
432
  const cartPayload = {
433
  itemName: itemName,
434
  itemPrice: itemPrice,
 
438
  addons: selectedAddOns,
439
  instructions: instructions
440
  };
 
441
  fetch('/cart/add', {
442
  method: 'POST',
443
  headers: {
 
461
  alert('An error occurred while adding the item to the cart.');
462
  });
463
  }
 
464
  // Function to round reward points to a single digit
465
  function roundRewardPoints() {
466
  let rewardPointsElement = document.getElementById('reward-points');
 
470
  rewardPointsElement.innerText = rewardPoints.toFixed(1); // Rounds to 1 decimal place
471
  }
472
  }
 
473
  // Run the function when the page loads
474
  window.onload = roundRewardPoints;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
475
 
476
  </script>
477
 
478
  <!-- Bootstrap JS -->
479
  <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>
480
+ </body>
481
  </html>