lokesh341 commited on
Commit
06f605c
·
verified ·
1 Parent(s): 437b681

Update templates/menu.html

Browse files
Files changed (1) hide show
  1. templates/menu.html +122 -57
templates/menu.html CHANGED
@@ -350,41 +350,64 @@
350
  height: 40px;
351
  width: 40px;
352
  }
353
- /* New Styles for Ingredients, Nutritional Info, and Allergens */
354
- .modal-ingredients, .modal-nutritional-info, .modal-allergens {
355
- margin-top: 15px;
 
 
 
 
 
 
 
356
  }
357
- .modal-ingredients h6, .modal-nutritional-info h6, .modal-allergens h6 {
 
358
  font-size: 1.1rem;
359
  font-weight: bold;
360
  color: #343a40;
361
- margin-bottom: 10px;
362
  }
363
- .modal-ingredients ul {
364
- list-style: none;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
365
  padding: 0;
366
- display: flex;
367
- flex-wrap: wrap;
368
- gap: 5px;
369
  }
370
- .modal-ingredients li {
 
 
 
 
 
 
 
371
  font-size: 0.9rem;
372
- color: #6c757d;
373
  }
374
- .modal-nutritional-info .nutritional-grid {
375
  display: flex;
376
- justify-content: space-between;
377
- background-color: #f8f9fa;
378
- padding: 10px;
379
- border-radius: 5px;
380
- }
381
- .modal-nutritional-info .nutritional-item {
382
- font-size: 0.9rem;
383
- color: #343a40;
384
  }
385
- .modal-allergens p {
 
386
  font-size: 0.9rem;
387
- color: #dc3545; /* Red for allergens to highlight them */
388
  }
389
  @media (max-width: 576px) {
390
  .modal-dialog {
@@ -398,10 +421,6 @@
398
  width: 40px;
399
  height: 35px;
400
  }
401
- .modal-nutritional-info .nutritional-grid {
402
- flex-direction: column;
403
- gap: 5px;
404
- }
405
  }
406
  </style>
407
  </head>
@@ -483,7 +502,7 @@
483
  <div class="d-flex flex-column align-item-center justify-content-center">
484
  <div>
485
  <button class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#itemModal"
486
- onclick="showItemDetails('{{ item.Name }}', '{{ item.Price__c }}', '{{ item.Image2__c }}', '{{ item.Description__c }}', '{{ item.Section__c }}', '{{ selected_category }}', {{ item.Ingredients__c | tojson }}, {{ item.NutritionalInfo__c | tojson }}, {{ item.Allergens__c | tojson }})">
487
  ADD
488
  </button>
489
  </div>
@@ -520,29 +539,39 @@
520
  <img id="modal-img" class="img-fluid rounded mb-3 d-block mx-auto" alt="Item Image" style="max-height: 200px; object-fit: cover;">
521
  <h5 id="modal-name" class="fw-bold text-center"></h5>
522
  <p id="modal-price" class="text-muted text-center"></p>
523
- <p id="modal-description" class="text-secondary"></p>
524
 
525
  <!-- Ingredients Section -->
526
- <div class="modal-ingredients">
527
- <h6>Ingredients</h6>
528
- <ul id="modal-ingredients-list"></ul>
 
 
 
 
 
529
  </div>
530
 
531
  <!-- Nutritional Info Section -->
532
- <div class="modal-nutritional-info">
533
- <h6>Nutritional Info</h6>
534
- <div class="nutritional-grid" id="modal-nutritional-info-grid">
535
- <div class="nutritional-item" id="modal-calories"></div>
536
- <div class="nutritional-item" id="modal-protein"></div>
537
- <div class="nutritional-item" id="modal-carbs"></div>
538
- <div class="nutritional-item" id="modal-fats"></div>
539
  </div>
540
  </div>
541
 
542
  <!-- Allergens Section -->
543
- <div class="modal-allergens">
544
- <h6>Allergens</h6>
545
- <p id="modal-allergens-list"></p>
 
 
 
 
 
546
  </div>
547
 
548
  <div id="first-row">
@@ -633,6 +662,21 @@
633
  };
634
  }
635
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
636
  function showItemDetails(name, price, image, description, section, selectedCategory, ingredients, nutritionalInfo, allergens) {
637
  document.getElementById('modal-name').innerText = name;
638
  document.getElementById('modal-price').innerText = `Starting from $${price}`;
@@ -641,7 +685,13 @@
641
  document.getElementById('addons-list').innerHTML = 'Loading customization options...';
642
  document.getElementById('modal-instructions').value = '';
643
 
644
- // Display Ingredients
 
 
 
 
 
 
645
  const ingredientsList = document.getElementById('modal-ingredients-list');
646
  ingredientsList.innerHTML = '';
647
  if (ingredients && ingredients.length > 0) {
@@ -651,28 +701,43 @@
651
  ingredientsList.appendChild(li);
652
  });
653
  } else {
654
- ingredientsList.innerHTML = '<li>No ingredients listed.</li>';
655
  }
656
 
657
- // Display Nutritional Info
658
- document.getElementById('modal-calories').innerText = `Calories: ${nutritionalInfo?.Calories || 'N/A'}`;
659
- document.getElementById('modal-protein').innerText = `Protein: ${nutritionalInfo?.Protein || 'N/A'}`;
660
- document.getElementById('modal-carbs').innerText = `Carbs: ${nutritionalInfo?.Carbs || 'N/A'}`;
661
- document.getElementById('modal-fats').innerText = `Fats: ${nutritionalInfo?.Fats || 'N/A'}`;
 
 
 
 
 
 
 
662
 
663
- // Display Allergens
664
  const allergensList = document.getElementById('modal-allergens-list');
 
665
  if (allergens && allergens.length > 0) {
666
- allergensList.innerText = allergens.join(', ');
 
 
 
 
667
  } else {
668
- allergensList.innerText = 'None';
669
  }
670
 
671
- const modalSectionEl = document.getElementById('modal-section');
672
- modalSectionEl.setAttribute('data-section', section);
673
- modalSectionEl.setAttribute('data-category', selectedCategory);
674
-
675
- document.getElementById('quantityInput').value = 1;
 
 
 
676
 
677
  const prepStyleOptions = document.getElementById('prep-style-options');
678
  const typeOptions = document.getElementById('type-options');
 
350
  height: 40px;
351
  width: 40px;
352
  }
353
+ /* Styles for Toggleable Sections in Modal */
354
+ .toggle-section {
355
+ margin-bottom: 10px;
356
+ }
357
+ .toggle-header {
358
+ display: flex;
359
+ justify-content: space-between;
360
+ align-items: center;
361
+ cursor: pointer;
362
+ padding: 5px 0;
363
  }
364
+ .toggle-header h6 {
365
+ margin: 0;
366
  font-size: 1.1rem;
367
  font-weight: bold;
368
  color: #343a40;
 
369
  }
370
+ .toggle-content {
371
+ display: none;
372
+ padding: 10px;
373
+ background-color: #f8f9fa;
374
+ border-radius: 5px;
375
+ }
376
+ .toggle-content.show {
377
+ display: block;
378
+ }
379
+ .toggle-arrow {
380
+ transition: transform 0.3s ease;
381
+ }
382
+ .toggle-arrow.down {
383
+ transform: rotate(0deg);
384
+ }
385
+ .toggle-arrow.up {
386
+ transform: rotate(180deg);
387
+ }
388
+ .ingredients-list,
389
+ .allergens-list {
390
+ list-style-type: none;
391
  padding: 0;
 
 
 
392
  }
393
+ .ingredients-list li,
394
+ .allergens-list li {
395
+ display: inline-block;
396
+ margin-right: 10px;
397
+ margin-bottom: 5px;
398
+ background-color: #e9ecef;
399
+ padding: 2px 8px;
400
+ border-radius: 12px;
401
  font-size: 0.9rem;
 
402
  }
403
+ .nutritional-info {
404
  display: flex;
405
+ flex-wrap: wrap;
406
+ gap: 15px;
 
 
 
 
 
 
407
  }
408
+ .nutritional-info p {
409
+ margin: 0;
410
  font-size: 0.9rem;
 
411
  }
412
  @media (max-width: 576px) {
413
  .modal-dialog {
 
421
  width: 40px;
422
  height: 35px;
423
  }
 
 
 
 
424
  }
425
  </style>
426
  </head>
 
502
  <div class="d-flex flex-column align-item-center justify-content-center">
503
  <div>
504
  <button class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#itemModal"
505
+ onclick="showItemDetails('{{ item.Name }}', '{{ item.Price__c }}', '{{ item.Image2__c }}', '{{ item.Description__c }}', '{{ item.Section__c }}', '{{ selected_category }}', {{ item.Ingredients__c|tojson }}, {{ item.NutritionalInfo__c|tojson }}, {{ item.Allergens__c|tojson }})">
506
  ADD
507
  </button>
508
  </div>
 
539
  <img id="modal-img" class="img-fluid rounded mb-3 d-block mx-auto" alt="Item Image" style="max-height: 200px; object-fit: cover;">
540
  <h5 id="modal-name" class="fw-bold text-center"></h5>
541
  <p id="modal-price" class="text-muted text-center"></p>
542
+ <p id="modal-description" class="text-secondary text-center"></p>
543
 
544
  <!-- Ingredients Section -->
545
+ <div class="toggle-section">
546
+ <div class="toggle-header" onclick="toggleSection('ingredients')">
547
+ <h6>Ingredients</h6>
548
+ <i class="bi bi-chevron-down toggle-arrow" id="ingredients-arrow"></i>
549
+ </div>
550
+ <div class="toggle-content" id="modal-ingredients">
551
+ <ul class="ingredients-list" id="modal-ingredients-list"></ul>
552
+ </div>
553
  </div>
554
 
555
  <!-- Nutritional Info Section -->
556
+ <div class="toggle-section">
557
+ <div class="toggle-header" onclick="toggleSection('nutritional')">
558
+ <h6>Nutritional Info</h6>
559
+ <i class="bi bi-chevron-down toggle-arrow" id="nutritional-arrow"></i>
560
+ </div>
561
+ <div class="toggle-content" id="modal-nutritional">
562
+ <div class="nutritional-info" id="modal-nutritional-info"></div>
563
  </div>
564
  </div>
565
 
566
  <!-- Allergens Section -->
567
+ <div class="toggle-section">
568
+ <div class="toggle-header" onclick="toggleSection('allergens')">
569
+ <h6>Allergens</h6>
570
+ <i class="bi bi-chevron-down toggle-arrow" id="allergens-arrow"></i>
571
+ </div>
572
+ <div class="toggle-content" id="modal-allergens">
573
+ <ul class="allergens-list" id="modal-allergens-list"></ul>
574
+ </div>
575
  </div>
576
 
577
  <div id="first-row">
 
662
  };
663
  }
664
 
665
+ // Toggle Section Visibility
666
+ function toggleSection(section) {
667
+ const content = document.getElementById(`modal-${section}`);
668
+ const arrow = document.getElementById(`${section}-arrow`);
669
+ if (content.classList.contains('show')) {
670
+ content.classList.remove('show');
671
+ arrow.classList.remove('up');
672
+ arrow.classList.add('down');
673
+ } else {
674
+ content.classList.add('show');
675
+ arrow.classList.remove('down');
676
+ arrow.classList.add('up');
677
+ }
678
+ }
679
+
680
  function showItemDetails(name, price, image, description, section, selectedCategory, ingredients, nutritionalInfo, allergens) {
681
  document.getElementById('modal-name').innerText = name;
682
  document.getElementById('modal-price').innerText = `Starting from $${price}`;
 
685
  document.getElementById('addons-list').innerHTML = 'Loading customization options...';
686
  document.getElementById('modal-instructions').value = '';
687
 
688
+ const modalSectionEl = document.getElementById('modal-section');
689
+ modalSectionEl.setAttribute('data-section', section);
690
+ modalSectionEl.setAttribute('data-category', selectedCategory);
691
+
692
+ document.getElementById('quantityInput').value = 1;
693
+
694
+ // Populate Ingredients
695
  const ingredientsList = document.getElementById('modal-ingredients-list');
696
  ingredientsList.innerHTML = '';
697
  if (ingredients && ingredients.length > 0) {
 
701
  ingredientsList.appendChild(li);
702
  });
703
  } else {
704
+ ingredientsList.innerHTML = '<li>No ingredients available.</li>';
705
  }
706
 
707
+ // Populate Nutritional Info
708
+ const nutritionalInfoDiv = document.getElementById('modal-nutritional-info');
709
+ nutritionalInfoDiv.innerHTML = '';
710
+ if (nutritionalInfo) {
711
+ for (const [key, value] of Object.entries(nutritionalInfo)) {
712
+ const p = document.createElement('p');
713
+ p.innerText = `${key}: ${value}`;
714
+ nutritionalInfoDiv.appendChild(p);
715
+ }
716
+ } else {
717
+ nutritionalInfoDiv.innerHTML = '<p>No nutritional info available.</p>';
718
+ }
719
 
720
+ // Populate Allergens
721
  const allergensList = document.getElementById('modal-allergens-list');
722
+ allergensList.innerHTML = '';
723
  if (allergens && allergens.length > 0) {
724
+ allergens.forEach(allergen => {
725
+ const li = document.createElement('li');
726
+ li.innerText = allergen;
727
+ allergensList.appendChild(li);
728
+ });
729
  } else {
730
+ allergensList.innerHTML = '<li>No allergens.</li>';
731
  }
732
 
733
+ // Reset toggle sections to hidden
734
+ ['ingredients', 'nutritional', 'allergens'].forEach(section => {
735
+ const content = document.getElementById(`modal-${section}`);
736
+ const arrow = document.getElementById(`${section}-arrow`);
737
+ content.classList.remove('show');
738
+ arrow.classList.remove('up');
739
+ arrow.classList.add('down');
740
+ });
741
 
742
  const prepStyleOptions = document.getElementById('prep-style-options');
743
  const typeOptions = document.getElementById('type-options');