DSatishchandra commited on
Commit
90e32c7
·
verified ·
1 Parent(s): 4546a8a

Update templates/menu_page.html

Browse files
Files changed (1) hide show
  1. templates/menu_page.html +5 -1
templates/menu_page.html CHANGED
@@ -123,14 +123,15 @@
123
  menuItemsContainer.appendChild(menuItemDiv);
124
  });
125
 
 
126
  if (annyang) {
127
  console.log("annyang is initialized");
128
 
129
- // Voice commands to navigate the process
130
  let commands = {};
131
 
132
  // Command to start the process
133
  commands['go to menu'] = function () {
 
134
  step = 1;
135
  document.getElementById("mic-status").innerText = "Please say 'Appetizer' or 'Main Course' to choose the category.";
136
  };
@@ -138,6 +139,7 @@
138
  // Command to choose a category
139
  menuItems.forEach(item => {
140
  commands[item.category.toLowerCase()] = function () {
 
141
  step = 2;
142
  document.getElementById("mic-status").innerText = `You chose ${item.category}. Please say the item you want to order, like 'Samosa' or 'Veg Biryani'.`;
143
  };
@@ -146,6 +148,7 @@
146
  // Command to select an item
147
  menuItems.forEach(item => {
148
  commands[item.name.toLowerCase()] = function () {
 
149
  selectedItem = item.name;
150
  step = 3;
151
  document.getElementById("mic-status").innerText = `You chose ${selectedItem}. Please say the quantity (e.g., 'One', 'Two').`;
@@ -155,6 +158,7 @@
155
  // Command to set the quantity
156
  annyang.addCommands({
157
  'quantity *number': function (number) {
 
158
  quantity = parseInt(number);
159
  step = 4;
160
  document.getElementById("mic-status").innerText = `You want ${quantity} of ${selectedItem}. Please confirm your order.`;
 
123
  menuItemsContainer.appendChild(menuItemDiv);
124
  });
125
 
126
+ // Ensure annyang is initialized
127
  if (annyang) {
128
  console.log("annyang is initialized");
129
 
 
130
  let commands = {};
131
 
132
  // Command to start the process
133
  commands['go to menu'] = function () {
134
+ console.log("User said: Go to Menu");
135
  step = 1;
136
  document.getElementById("mic-status").innerText = "Please say 'Appetizer' or 'Main Course' to choose the category.";
137
  };
 
139
  // Command to choose a category
140
  menuItems.forEach(item => {
141
  commands[item.category.toLowerCase()] = function () {
142
+ console.log("User chose category:", item.category);
143
  step = 2;
144
  document.getElementById("mic-status").innerText = `You chose ${item.category}. Please say the item you want to order, like 'Samosa' or 'Veg Biryani'.`;
145
  };
 
148
  // Command to select an item
149
  menuItems.forEach(item => {
150
  commands[item.name.toLowerCase()] = function () {
151
+ console.log("User selected item:", item.name);
152
  selectedItem = item.name;
153
  step = 3;
154
  document.getElementById("mic-status").innerText = `You chose ${selectedItem}. Please say the quantity (e.g., 'One', 'Two').`;
 
158
  // Command to set the quantity
159
  annyang.addCommands({
160
  'quantity *number': function (number) {
161
+ console.log("User said quantity:", number); // Debugging
162
  quantity = parseInt(number);
163
  step = 4;
164
  document.getElementById("mic-status").innerText = `You want ${quantity} of ${selectedItem}. Please confirm your order.`;