Yaswanth56 commited on
Commit
4dc506d
·
verified ·
1 Parent(s): 91e44c8

Update static/script.js

Browse files
Files changed (1) hide show
  1. static/script.js +13 -3
static/script.js CHANGED
@@ -149,7 +149,7 @@ function displayIngredientsList(ingredients) {
149
  img.src = ingredient.image_url || 'https://via.placeholder.com/80';
150
  img.alt = ingredient.name;
151
  console.log(`Setting image src for ${ingredient.name} to: ${img.src}`); // Debug log
152
- img.style.width = '80px'; // Ensure image has a defined size
153
  img.style.height = '80px';
154
  const name = document.createElement('div');
155
  name.textContent = ingredient.name;
@@ -194,13 +194,21 @@ function displayMenuItems(menuItems) {
194
  img.src = item.image_url || 'https://via.placeholder.com/80';
195
  img.alt = item.name;
196
  console.log(`Setting image src for ${item.name} to: ${img.src}`); // Debug log
197
- img.style.width = '80px'; // Ensure image has a defined size
198
  img.style.height = '80px';
199
  const name = document.createElement('div');
200
  name.textContent = item.name;
201
  name.style.textAlign = 'center';
202
  name.style.marginTop = '5px';
203
  name.style.fontSize = '12px';
 
 
 
 
 
 
 
 
204
  const button = document.createElement('button');
205
  button.textContent = 'Add to Cart';
206
  button.onclick = () => {
@@ -214,6 +222,8 @@ function displayMenuItems(menuItems) {
214
  };
215
  menuItem.appendChild(img);
216
  menuItem.appendChild(name);
 
 
217
  menuItem.appendChild(button);
218
  menuItemsList.appendChild(menuItem);
219
  });
@@ -344,7 +354,7 @@ function displayOptions(options) {
344
  });
345
  chatMessages.appendChild(document.createElement('br'));
346
  const backButton = document.createElement('button');
347
- backButton.textContent = 'Go Back';
348
  backButton.className = 'option-button';
349
  backButton.onclick = () => {
350
  conversation.pop();
 
149
  img.src = ingredient.image_url || 'https://via.placeholder.com/80';
150
  img.alt = ingredient.name;
151
  console.log(`Setting image src for ${ingredient.name} to: ${img.src}`); // Debug log
152
+ img.style.width = '80px';
153
  img.style.height = '80px';
154
  const name = document.createElement('div');
155
  name.textContent = ingredient.name;
 
194
  img.src = item.image_url || 'https://via.placeholder.com/80';
195
  img.alt = item.name;
196
  console.log(`Setting image src for ${item.name} to: ${img.src}`); // Debug log
197
+ img.style.width = '80px';
198
  img.style.height = '80px';
199
  const name = document.createElement('div');
200
  name.textContent = item.name;
201
  name.style.textAlign = 'center';
202
  name.style.marginTop = '5px';
203
  name.style.fontSize = '12px';
204
+ const price = document.createElement('div');
205
+ price.textContent = `Price: $${item.price || 0.0}`;
206
+ price.style.textAlign = 'center';
207
+ price.style.fontSize = '12px';
208
+ const ingredients = document.createElement('div');
209
+ ingredients.textContent = `Ingredients: ${item.ingredients || 'N/A'}`;
210
+ ingredients.style.textAlign = 'center';
211
+ ingredients.style.fontSize = '12px';
212
  const button = document.createElement('button');
213
  button.textContent = 'Add to Cart';
214
  button.onclick = () => {
 
222
  };
223
  menuItem.appendChild(img);
224
  menuItem.appendChild(name);
225
+ menuItem.appendChild(price);
226
+ menuItem.appendChild(ingredients);
227
  menuItem.appendChild(button);
228
  menuItemsList.appendChild(menuItem);
229
  });
 
354
  });
355
  chatMessages.appendChild(document.createElement('br'));
356
  const backButton = document.createElement('button');
357
+ backButton.textText = 'Go Back';
358
  backButton.className = 'option-button';
359
  backButton.onclick = () => {
360
  conversation.pop();