mirror of
https://gitlab.com/bmcgonag/get_my.git
synced 2026-03-27 00:08:49 +00:00
Just updated menu items to be added correctly in new version
This commit is contained in:
parent
d25ef56591
commit
b5d490c052
1 changed files with 14 additions and 4 deletions
|
|
@ -69,6 +69,10 @@ Template.menuItemsForm.events({
|
||||||
let dateSrv = $("#dateServed").val();
|
let dateSrv = $("#dateServed").val();
|
||||||
let menuId = Session.get("menuId");
|
let menuId = Session.get("menuId");
|
||||||
|
|
||||||
|
if (menuId == null || menuId == "") {
|
||||||
|
console.log(" ---- NO MENU ID! ----");
|
||||||
|
}
|
||||||
|
|
||||||
const mie = async() => {
|
const mie = async() => {
|
||||||
let menuItemExists = await MenuItems.findOneAsync({ itemName: menuItem });
|
let menuItemExists = await MenuItems.findOneAsync({ itemName: menuItem });
|
||||||
if (!menuItemExists) {
|
if (!menuItemExists) {
|
||||||
|
|
@ -76,6 +80,7 @@ Template.menuItemsForm.events({
|
||||||
notExists();
|
notExists();
|
||||||
} else {
|
} else {
|
||||||
// call to add it to the menu only
|
// call to add it to the menu only
|
||||||
|
console.dir(menuItemExists);
|
||||||
itExists(menuItemExists);
|
itExists(menuItemExists);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -91,18 +96,19 @@ Template.menuItemsForm.events({
|
||||||
if (!result) {
|
if (!result) {
|
||||||
// console.log(" ERROR adding menu item: " + err);
|
// console.log(" ERROR adding menu item: " + err);
|
||||||
} else {
|
} else {
|
||||||
// console.log(" SUCCESS adding menu item.");
|
// console.log(" SUCCESS adding menu item. Result is: " + result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let addedItem = addMenuItem();
|
let addedItem = await addMenuItem();
|
||||||
|
|
||||||
if (!addedItem) {
|
if (!addedItem) {
|
||||||
// console.log("Item was not added.");
|
// console.log("Item was not added.");
|
||||||
} else {
|
} else {
|
||||||
// now add this item to the menu
|
// now add this item to the menu
|
||||||
|
// console.log("Added Item = " + addedItem);
|
||||||
const addToMenu = async() => {
|
const addToMenu = async() => {
|
||||||
let result2 = await Meteor.callAsync('addto.Menu', menuId, menuItem, addedItem, dateSrv);
|
let result2 = await Meteor.callAsync('addto.Menu', menuId, menuItem, addedItem, dateSrv, false);
|
||||||
if (!result2) {
|
if (!result2) {
|
||||||
// console.log(" ERROR adding menuitem to menu: " + error);
|
// console.log(" ERROR adding menuitem to menu: " + error);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -160,7 +166,11 @@ Template.menuItemsForm.events({
|
||||||
if (event.which != 13) {
|
if (event.which != 13) {
|
||||||
let findMenuItem = $("#menuItemInp").val();
|
let findMenuItem = $("#menuItemInp").val();
|
||||||
let menuItemInfo = MenuItems.find({ itemName: {$regex: findMenuItem + '.*', $options: 'i' }}).fetch();
|
let menuItemInfo = MenuItems.find({ itemName: {$regex: findMenuItem + '.*', $options: 'i' }}).fetch();
|
||||||
if (typeof menuItemInfo != 'undefined' && menuItemInfo != '' && menuItemInfo != null) {
|
if (!menuItemInfo) {
|
||||||
|
console.log("Nothing found in menu items:");
|
||||||
|
console.dir(menuItemInfo);
|
||||||
|
} else {
|
||||||
|
console.dir(menuItemInfo)
|
||||||
getMenuItemList(menuItemInfo);
|
getMenuItemList(menuItemInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue