nagasurendra commited on
Commit
4a91b15
·
verified ·
1 Parent(s): 4298625

Update static/script.js

Browse files
Files changed (1) hide show
  1. static/script.js +15 -2
static/script.js CHANGED
@@ -266,6 +266,17 @@ function updateSelectionBox() {
266
  orderNameInput.setAttribute('aria-label', 'Enter order name');
267
  orderNameInput.tabIndex = 0;
268
  selectionBox.appendChild(orderNameInput);
 
 
 
 
 
 
 
 
 
 
 
269
  }
270
 
271
  chatMessages.appendChild(selectionBox);
@@ -549,6 +560,8 @@ function displayOptions(options) {
549
  function promptAndSubmit(quantity) {
550
  const orderNameInput = document.querySelector('.order-name-input');
551
  const customOrderName = orderNameInput ? orderNameInput.value.trim() : '';
 
 
552
  const qty = parseInt(quantity);
553
 
554
  if (isNaN(qty) || qty <= 0) {
@@ -566,10 +579,10 @@ function promptAndSubmit(quantity) {
566
  const item = selectedItems[0];
567
 
568
  if (confirm(`Submit "${item.name}" with quantity ${qty}?`)) {
569
- const instructions = item.instructions || prompt('Any special instructions?', '') || '';
570
  item.quantity = qty;
 
571
 
572
- submitCustomizedItem(item, item.ingredients || [], instructions);
573
  showToast('Submitting customized item...');
574
  } else {
575
  addMessage('bot', 'Cancelled. Add more items?');
 
266
  orderNameInput.setAttribute('aria-label', 'Enter order name');
267
  orderNameInput.tabIndex = 0;
268
  selectionBox.appendChild(orderNameInput);
269
+
270
+ const instructionInput = document.createElement('textarea');
271
+ instructionInput.placeholder = 'Add any special instructions here...';
272
+ instructionInput.className = 'instruction-input';
273
+ instructionInput.setAttribute('aria-label', 'Enter special instructions');
274
+ instructionInput.tabIndex = 0;
275
+ instructionInput.rows = 3;
276
+ instructionInput.style.width = '100%';
277
+ instructionInput.style.marginTop = '8px';
278
+ selectionBox.appendChild(instructionInput);
279
+
280
  }
281
 
282
  chatMessages.appendChild(selectionBox);
 
560
  function promptAndSubmit(quantity) {
561
  const orderNameInput = document.querySelector('.order-name-input');
562
  const customOrderName = orderNameInput ? orderNameInput.value.trim() : '';
563
+ const instructionInput = document.querySelector('.instruction-input');
564
+ const customInstructions = instructionInput ? instructionInput.value.trim() : '';
565
  const qty = parseInt(quantity);
566
 
567
  if (isNaN(qty) || qty <= 0) {
 
579
  const item = selectedItems[0];
580
 
581
  if (confirm(`Submit "${item.name}" with quantity ${qty}?`)) {
 
582
  item.quantity = qty;
583
+ item.instructions = customInstructions;
584
 
585
+ submitCustomizedItem(item, item.ingredients || [], customInstructions);
586
  showToast('Submitting customized item...');
587
  } else {
588
  addMessage('bot', 'Cancelled. Add more items?');