fixed adding menu items to the menu.

This commit is contained in:
Brian McGonagill 2025-06-21 13:24:24 -05:00
parent 055d574dcc
commit f12c6bb7c8
2 changed files with 7 additions and 5 deletions

View file

@ -102,7 +102,7 @@ Template.menuItemsForm.events({
} else { } else {
// now add this item to the menu // now add this item to the menu
const addToMenu = async() => { const addToMenu = async() => {
let result2 = await Meteor.callAsync('addto.Menu', menuId, menuItem, result, dateSrv); let result2 = await Meteor.callAsync('addto.Menu', menuId, menuItem, addedItem, dateSrv);
if (!result2) { if (!result2) {
console.log(" ERROR adding menuitem to menu: " + error); console.log(" ERROR adding menuitem to menu: " + error);
} else { } else {
@ -123,15 +123,17 @@ Template.menuItemsForm.events({
if (menuItem == null || menuItem == "") { if (menuItem == null || menuItem == "") {
Session.set("menuItemErr", true); Session.set("menuItemErr", true);
} else { } else {
Meteor.call('addto.Menu', menuId, menuItem, menuItemId, dateSrv, isLinked, function(error, nresult) { const addToMenu = async() => {
if (error) { let result = await Meteor.callAsync('addto.Menu', menuId, menuItem, menuItemId, dateSrv, isLinked);
if (!result) {
console.log(" ERROR adding menuitem to menu: " + error); console.log(" ERROR adding menuitem to menu: " + error);
} else { } else {
// console.log("Added item to menu - no problem."); // console.log("Added item to menu - no problem.");
$("#menuItemInp").val(""); $("#menuItemInp").val("");
$("#dateServed").val(""); $("#dateServed").val("");
} }
}); }
addToMenu();
} }
} }
}, },

View file

@ -128,7 +128,7 @@ Meteor.methods({
throw new Meteor.Error('You are not allowed to add items to menus. Make sure you are logged in with valid user credentials.'); throw new Meteor.Error('You are not allowed to add items to menus. Make sure you are logged in with valid user credentials.');
} }
serveDateActual = new Date(dateSrv); let serveDateActual = new Date(dateSrv);
return Menus.updateAsync({ _id: menuId }, { return Menus.updateAsync({ _id: menuId }, {
$addToSet: { $addToSet: {