nagasurendra commited on
Commit
5dba7bb
·
verified ·
1 Parent(s): a63ba39

Update static/script.js

Browse files
Files changed (1) hide show
  1. static/script.js +13 -15
static/script.js CHANGED
@@ -208,25 +208,23 @@ function displayCustomizationIngredients(ingredients) {
208
  ingredientsDiv.textContent = selectedIngredientsText;
209
  selectedArea.appendChild(ingredientsDiv);
210
 
211
- // Display the submit button and the custom instructions box
212
- if (selectedIngredients.length > 0) {
213
- let submitButton = document.querySelector('.submit-customization-button');
214
- if (!submitButton) {
215
- submitButton = document.createElement('button');
216
- submitButton.className = 'submit-customization-button';
217
- submitButton.textContent = 'Submit Ingredients';
218
- submitButton.onclick = submitCustomizationIngredients;
219
- chatMessages.appendChild(submitButton);
220
-
221
- // Adding a text area for custom instructions
222
- const textarea = document.createElement('textarea');
223
- textarea.placeholder = 'Enter any special instructions...';
224
- selectedArea.appendChild(textarea);
225
- }
226
  }
227
  }
228
 
229
 
 
230
  function submitCustomizationIngredients() {
231
  // Handle the submission of ingredients and instructions here
232
  console.log("Ingredients submitted:", selectedIngredients);
 
208
  ingredientsDiv.textContent = selectedIngredientsText;
209
  selectedArea.appendChild(ingredientsDiv);
210
 
211
+ // Ensure the submit button and custom instructions box appear even when multiple ingredients are selected
212
+ if (!document.querySelector('.submit-customization-button')) {
213
+ let submitButton = document.createElement('button');
214
+ submitButton.className = 'submit-customization-button';
215
+ submitButton.textContent = 'Submit Ingredients';
216
+ submitButton.onclick = submitCustomizationIngredients;
217
+ chatMessages.appendChild(submitButton);
218
+
219
+ // Adding a text area for custom instructions
220
+ const textarea = document.createElement('textarea');
221
+ textarea.placeholder = 'Enter any special instructions...';
222
+ selectedArea.appendChild(textarea);
 
 
 
223
  }
224
  }
225
 
226
 
227
+
228
  function submitCustomizationIngredients() {
229
  // Handle the submission of ingredients and instructions here
230
  console.log("Ingredients submitted:", selectedIngredients);