lokesh341 commited on
Commit
010f6a5
·
verified ·
1 Parent(s): 51e7204

Update static/script.js

Browse files
Files changed (1) hide show
  1. static/script.js +14 -2
static/script.js CHANGED
@@ -71,10 +71,22 @@ function updateSelectionBox() {
71
  label.textContent = 'Selected Items:';
72
  selectionBox.appendChild(label);
73
 
 
74
  selectedItems.forEach(item => {
 
 
 
 
 
 
 
 
 
75
  const itemSpan = document.createElement('span');
76
  itemSpan.textContent = item.name;
77
- selectionBox.appendChild(itemSpan);
 
 
78
  });
79
 
80
  const textInput = document.createElement('input');
@@ -87,7 +99,7 @@ function updateSelectionBox() {
87
  name: textInput.value.trim(),
88
  description: 'Manually added',
89
  ingredients: 'Not specified',
90
- image_url: '',
91
  category: 'Both'
92
  };
93
  selectedItems.push(manualItem);
 
71
  label.textContent = 'Selected Items:';
72
  selectionBox.appendChild(label);
73
 
74
+ // Display selected items with images
75
  selectedItems.forEach(item => {
76
+ const itemContainer = document.createElement('div');
77
+ itemContainer.className = 'selected-item';
78
+
79
+ const img = document.createElement('img');
80
+ img.src = item.image_url || 'https://via.placeholder.com/30';
81
+ img.alt = item.name;
82
+ img.className = 'selected-item-image';
83
+ itemContainer.appendChild(img);
84
+
85
  const itemSpan = document.createElement('span');
86
  itemSpan.textContent = item.name;
87
+ itemContainer.appendChild(itemSpan);
88
+
89
+ selectionBox.appendChild(itemContainer);
90
  });
91
 
92
  const textInput = document.createElement('input');
 
99
  name: textInput.value.trim(),
100
  description: 'Manually added',
101
  ingredients: 'Not specified',
102
+ image_url: '', // Default to empty; will use placeholder
103
  category: 'Both'
104
  };
105
  selectedItems.push(manualItem);