lokesh341 commited on
Commit
dff3f25
·
verified ·
1 Parent(s): 65a5760

Update templates/menu.html

Browse files
Files changed (1) hide show
  1. templates/menu.html +6 -12
templates/menu.html CHANGED
@@ -272,28 +272,24 @@
272
  return;
273
  }
274
 
275
- // Reorder the addons array to move "Spice Level" to the top
276
  const reorderedAddons = [];
277
  const spiceLevelIndex = data.addons.findIndex(addon => addon.name === "Spice Level");
278
  if (spiceLevelIndex !== -1) {
279
- // Remove "Spice Level" from its current position and add it to the start
280
- const spiceLevel = data.addons.splice(spiceLevelIndex, 1)[0];
281
- reorderedAddons.push(spiceLevel);
282
  }
283
- // Add the remaining addons
284
- reorderedAddons.push(...data.addons);
285
 
286
  // Display customization options inside styled divs
287
  reorderedAddons.forEach(addon => {
288
  const sectionDiv = document.createElement('div');
289
- sectionDiv.classList.add('addon-section'); // Add styling class
290
 
291
- // Add section title
292
  const title = document.createElement('h6');
293
  title.innerText = addon.name;
294
  sectionDiv.appendChild(title);
295
 
296
- // Create options list
297
  const optionsContainer = document.createElement('div');
298
  addon.options.forEach((option, index) => {
299
  const optionId = `addon-${addon.name.replace(/\s+/g, '')}-${index}`;
@@ -316,9 +312,7 @@
316
  console.error('Error fetching add-ons:', err);
317
  document.getElementById('addons-list').innerHTML = '<p>Error loading customization options.</p>';
318
  });
319
- = '<p>Error loading customization options.</p>';
320
- });
321
- }
322
  </script>
323
 
324
  </body>
 
272
  return;
273
  }
274
 
275
+ // Reorder addons: Move "Spice Level" to the top
276
  const reorderedAddons = [];
277
  const spiceLevelIndex = data.addons.findIndex(addon => addon.name === "Spice Level");
278
  if (spiceLevelIndex !== -1) {
279
+ const spiceLevel = data.addons.splice(spiceLevelIndex, 1)[0]; // Remove "Spice Level" from its current position
280
+ reorderedAddons.push(spiceLevel); // Add it to the top
 
281
  }
282
+ reorderedAddons.push(...data.addons); // Add the remaining addons
 
283
 
284
  // Display customization options inside styled divs
285
  reorderedAddons.forEach(addon => {
286
  const sectionDiv = document.createElement('div');
287
+ sectionDiv.classList.add('addon-section');
288
 
 
289
  const title = document.createElement('h6');
290
  title.innerText = addon.name;
291
  sectionDiv.appendChild(title);
292
 
 
293
  const optionsContainer = document.createElement('div');
294
  addon.options.forEach((option, index) => {
295
  const optionId = `addon-${addon.name.replace(/\s+/g, '')}-${index}`;
 
312
  console.error('Error fetching add-ons:', err);
313
  document.getElementById('addons-list').innerHTML = '<p>Error loading customization options.</p>';
314
  });
315
+ }
 
 
316
  </script>
317
 
318
  </body>