mirror of
https://gitlab.com/bmcgonag/get_my.git
synced 2026-03-26 15:58:50 +00:00
Updated menus to work better with list item linking
Lots of changes made (almost a refactor <--- four letter word to me... - Menu Items collection is now the "permanent" storage location for menu item for any day. So, if i set Green Chile Chicken Enchiladas, Beans, and Rice as an item for a day, it will be stored as a Menu Item for later use. - Linking menu items to items that can be added to a shopping list - This has been updated to be more reusable. So as you re-choose a menu item that's already got list items linked, it just shows up for you to use to build a shopping list as needed. - Deleting menu items from a menu - changed to delete them only from the menu, and not from the database. - Dashboard updated to pull today's menu item from the menu, and not the menu item list.
This commit is contained in:
parent
3f6618d906
commit
88fa7c1d22
13 changed files with 216 additions and 149 deletions
|
|
@ -41,9 +41,13 @@
|
|||
<div class="card-content white-text">
|
||||
<span class="card-title"><h4>{{todayDate}}</h4></span>
|
||||
{{#each todayMenuItem}}
|
||||
<div class="row">
|
||||
<div class="col s12"><h4><i class="medium material-icons">local_dining</i> <span class="right">{{itemName}}</span></h4></div>
|
||||
</div>
|
||||
{{#each menuItems}}
|
||||
{{#if $eq todayDate serveDate}}
|
||||
<div class="row">
|
||||
<div class="col s12"><h4><i class="medium material-icons">local_dining</i> <span class="right">{{menuItemName}}</span></h4></div>
|
||||
</div>
|
||||
{{/if}}
|
||||
{{/each}}
|
||||
{{else}}
|
||||
<div class="row">
|
||||
<div class="col s12"><h4><i class="medium material-icons">local_dining</i><span clas="right">No Menu Today</span></h4></div>
|
||||
|
|
@ -71,4 +75,4 @@
|
|||
</div>
|
||||
{{/if}}
|
||||
</div>
|
||||
</template>
|
||||
</template>
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ Template.dashboard.onCreated(function() {
|
|||
this.subscribe("storeInfo");
|
||||
this.subscribe("myProducts");
|
||||
this.subscribe("myLocations");
|
||||
this.subscribe("myMenus");
|
||||
// this.subscribe("myMenus");
|
||||
this.subscribe("todayMenuItems");
|
||||
this.subscribe("myTasks");
|
||||
});
|
||||
|
|
@ -47,7 +47,9 @@ Template.dashboard.helpers({
|
|||
return TaskItems.find({ isComplete: false, taskDate: today });
|
||||
},
|
||||
todayMenuItem: function() {
|
||||
return MenuItems.find({});
|
||||
let myMenus = Menus.find({}).fetch();
|
||||
console.dir(myMenus);
|
||||
return myMenus;
|
||||
},
|
||||
todayDate: function() {
|
||||
let now = new Date();
|
||||
|
|
@ -110,4 +112,4 @@ Template.dashboard.events({
|
|||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -16,16 +16,18 @@
|
|||
<h4>Products to Add</h4>
|
||||
</li>
|
||||
{{#each productToChoose}}
|
||||
<li class="collection-item" id="{{prodId}}">
|
||||
<div>
|
||||
<p>
|
||||
<label>
|
||||
<input type="checkbox" class="productListing" id="{{prodId}}" />
|
||||
<span class="my-text">{{prodName}}</span>
|
||||
</label>
|
||||
</p>
|
||||
</div>
|
||||
</li>
|
||||
{{#each products}}
|
||||
<li class="collection-item">
|
||||
<div>
|
||||
<p>
|
||||
<label>
|
||||
<input type="checkbox" class="productListing" id="{{prodId}}" />
|
||||
<span class="my-text">{{prodName}}</span>
|
||||
</label>
|
||||
</p>
|
||||
</div>
|
||||
</li>
|
||||
{{/each}}
|
||||
{{/each}}
|
||||
</ul>
|
||||
</div>
|
||||
|
|
@ -44,4 +46,4 @@
|
|||
</div>
|
||||
</div>
|
||||
{{> snackbar}}
|
||||
</template>
|
||||
</template>
|
||||
|
|
|
|||
|
|
@ -17,6 +17,9 @@ Template.menuItemsForm.onRendered(function() {
|
|||
Session.set("menuItemErr", false);
|
||||
Session.set("menuListItems", {});
|
||||
|
||||
var elemt = document.querySelectorAll('.tooltipped');
|
||||
var instancet = M.Tooltip.init(elemt, {});
|
||||
|
||||
this.autorun(() => {
|
||||
var elema = document.querySelectorAll('.autocomplete');
|
||||
var instancea = M.Autocomplete.init(elema, {
|
||||
|
|
@ -52,18 +55,50 @@ Template.menuItemsForm.events({
|
|||
let dateSrv = $("#dateServed").val();
|
||||
let menuId = Session.get("menuId");
|
||||
|
||||
if (menuItem == null || menuItem == "") {
|
||||
Session.set("menuItemErr", true);
|
||||
|
||||
let menuItemExists = MenuItems.findOne({ itemName: menuItem });
|
||||
|
||||
if (typeof menuItemExists != 'undefined' && menuItemExists != null && menuItemExists != "") {
|
||||
// use the existing item on the menu
|
||||
let menuItemId = menuItemExists._id;
|
||||
let isLinked = menuItemExists.isLinked;
|
||||
if (menuItem == null || menuItem == "") {
|
||||
Session.set("menuItemErr", true);
|
||||
} else {
|
||||
Meteor.call('addto.Menu', menuId, menuItem, menuItemId, dateSrv, isLinked, function(error, nresult) {
|
||||
if (error) {
|
||||
console.log(" ERROR adding menuitem to menu: " + error);
|
||||
} else {
|
||||
// console.log("Added item to menu - no problem.");
|
||||
$("#menuItemInp").val("");
|
||||
$("#dateServed").val("");
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
Meteor.call('add.menuItem', menuItem, dateSrv, menuId, function(err, result) {
|
||||
if (err) {
|
||||
console.log(" ERROR adding menu item: " + err);
|
||||
} else {
|
||||
console.log(" SUCCESS adding menu item.");
|
||||
$("#menuItemInp").val("");
|
||||
$("#dateServed").val("");
|
||||
}
|
||||
});
|
||||
// add the item as new and add to the menu
|
||||
if (menuItem == null || menuItem == "") {
|
||||
Session.set("menuItemErr", true);
|
||||
} else {
|
||||
Meteor.call('add.menuItem', menuItem, function(err, result) {
|
||||
if (err) {
|
||||
console.log(" ERROR adding menu item: " + err);
|
||||
} else {
|
||||
// console.log(" SUCCESS adding menu item.");
|
||||
$("#menuItemInp").val("");
|
||||
$("#dateServed").val("");
|
||||
|
||||
// now add this item to the menu
|
||||
Meteor.call('addto.Menu', menuId, menuItem, result, dateSrv, function(error, nresult) {
|
||||
if (error) {
|
||||
console.log(" ERROR adding menuitem to menu: " + error);
|
||||
} else {
|
||||
// console.log("Added item to menu - no problem.");
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
'click .shiftOneDay' (event) {
|
||||
|
|
@ -77,7 +112,7 @@ Template.menuItemsForm.events({
|
|||
// console.log(momentAddDay);
|
||||
Meteor.call('shiftDate', menuItemId, momentAddDay, function(err,result) {
|
||||
if (err) {
|
||||
// console.log(" ERROR shifting meal days: " + err);
|
||||
console.log(" ERROR shifting meal days: " + err);
|
||||
} else {
|
||||
// console.log(" SUCCESS shifting meal date.");
|
||||
}
|
||||
|
|
@ -99,4 +134,4 @@ getMenuItemList = function(menuItemInfo) {
|
|||
let menuItemObjArray = [];
|
||||
menuItemObjArray = menuItemInfo.map(info => ({ id: info._id, text: info.itemName }));
|
||||
Session.set("menuListItems", menuItemObjArray);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,27 +11,25 @@
|
|||
</tr>
|
||||
</thead>
|
||||
{{#each thisMenuItems}}
|
||||
<tr>
|
||||
<td>
|
||||
<span>
|
||||
{{#if $eq itemMade true}}
|
||||
<strike>{{itemName}}</strike>
|
||||
{{else}}
|
||||
{{itemName}}
|
||||
{{/if}}
|
||||
</span>
|
||||
</td>
|
||||
<td>
|
||||
{{serveDate}}
|
||||
</td>
|
||||
<td>
|
||||
{{#if $eq isLinked true}}<a class="waves-effect waves-light blue darken-3 white-text btn addProdsToList modal-trigger" href="#addProdToList">+ Shopping List</a>{{/if}}
|
||||
</td>
|
||||
<td>
|
||||
<i class="material-icons tooltipped modal-trigger deleteMenuItem clickable" href="#modalDelete" data-position="top" data-tooltip-id="deleteMenuTip">delete</i>
|
||||
<i class="material-icons tooltipped modal-trigger linkToProducts clickable" href="#modalLinkProducts" data-position="top" data-tooltip-id="linkMenuTip">link</i>
|
||||
</td>
|
||||
</tr>
|
||||
{{#each menuItems}}
|
||||
<tr>
|
||||
<td>
|
||||
<span>
|
||||
{{menuItemName}}
|
||||
</span>
|
||||
</td>
|
||||
<td>
|
||||
{{serveDate}}
|
||||
</td>
|
||||
<td>
|
||||
{{#if $eq isLinked true}}<a class="waves-effect waves-light blue darken-3 white-text btn addProdsToList modal-trigger" href="#addProdToList">+ Shopping List</a>{{/if}}
|
||||
</td>
|
||||
<td>
|
||||
<i class="material-icons tooltipped modal-trigger deleteMenuItem clickable" href="#modalDelete" data-position="top" data-tooltip-id="deleteMenuTip">delete</i>
|
||||
<i class="material-icons tooltipped modal-trigger linkToProducts clickable" href="#modalLinkProducts" data-position="top" data-tooltip-id="linkMenuTip">link</i>
|
||||
</td>
|
||||
</tr>
|
||||
{{/each}}
|
||||
{{/each}}
|
||||
</table>
|
||||
<div class="tooltip-content" style="display: none;" id="deleteMenuTip">Delete this menu item</div>
|
||||
|
|
@ -41,4 +39,4 @@
|
|||
{{> deleteConfirmationModal}}
|
||||
{{> modalLinkProducts}}
|
||||
{{> addProdToListModal}}
|
||||
</template>
|
||||
</template>
|
||||
|
|
|
|||
|
|
@ -1,11 +1,13 @@
|
|||
import { MenuItems } from '../../imports/api/menuItems.js';
|
||||
import { M } from '../lib/assets/materialize.js';
|
||||
import { UserLast } from '../../imports/api/userLast.js';
|
||||
import { Menus } from '../../imports/api/menu.js';
|
||||
|
||||
Template.menuItemsTbl.onCreated(function() {
|
||||
this.autorun( () => {
|
||||
this.subscribe("myMenuItems", Session.get("menuId"));
|
||||
});
|
||||
this.subscribe("menuItems");
|
||||
this.subscribe("userLastView");
|
||||
});
|
||||
|
||||
|
|
@ -30,7 +32,7 @@ Template.menuItemsTbl.helpers({
|
|||
} else {
|
||||
menuId = UserLast.findOne({ view: "Menu" }).viewId;
|
||||
}
|
||||
let menuInfo = MenuItems.find({ menuId: menuId }, { sort: { serveDateActual: 1 }});
|
||||
let menuInfo = Menus.find({ _id: menuId }, { sort: { serveDateActual: 1 }});
|
||||
if (menuInfo) {
|
||||
return menuInfo
|
||||
}
|
||||
|
|
@ -40,18 +42,22 @@ Template.menuItemsTbl.helpers({
|
|||
Template.menuItemsTbl.events({
|
||||
'click .deleteMenuItem' (event) {
|
||||
event.preventDefault();
|
||||
Session.set("deleteId", this._id);
|
||||
Session.set("method", "delete.menuItem");
|
||||
Session.set("item", this.itemName);
|
||||
let theseIds = Session.get("menuId") + "_" + this.menuItemId;
|
||||
console.log("These Ids: " + theseIds);
|
||||
Session.set("deleteId", theseIds);
|
||||
Session.set("method", "delete.itemFromMenu");
|
||||
Session.set("item", this.menuItemName);
|
||||
Session.set("view", "Menu Items");
|
||||
},
|
||||
'click .linkToProducts' (event) {
|
||||
event.preventDefault();
|
||||
Session.set("menuItemId", this._id);
|
||||
Session.set("menuItemId", this.menuItemId);
|
||||
Session.set("menuItemName", this.menuItemName);
|
||||
console.log("menu item name = " + this.menuItemName);
|
||||
},
|
||||
'click .addProdsToList' (event) {
|
||||
event.preventDefault();
|
||||
// console.log("Menu Iteme Id sent is: " + this._id);
|
||||
Session.set("menuItemId", this._id);
|
||||
Session.set("menuItemId", this.menuItemId);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -2,11 +2,8 @@
|
|||
<h5>{{menuName}}</h5>
|
||||
<form class="menuItemFrm row" style="gap: 1em;" id="menuItemFrm">
|
||||
<div class="col s12 m6 l9 input-field outlined">
|
||||
<input type="text" class="autocomplete" id="menuItemInp" autocomplete="off" />
|
||||
<input type="text" class="autocomplete tooltipped" id="menuItemInp" autocomplete="off" data-position="top" data-tooltip="Start typing, and select previous menu items if desired." />
|
||||
<label for="menuItemInp">Item</label>
|
||||
|
||||
<!-- <input type="text" class="menuItemInp" style="{{#if $eq menuItemErr true}}border: 2px solid red{{/if}}" id="menuItemInp" />
|
||||
<label for="menuItemInp">Add Menu Item</label> -->
|
||||
</div>
|
||||
<div class="col s12 m6 l3 input-field outlined">
|
||||
<input type="text" class="datepicker" id="dateServed" />
|
||||
|
|
@ -23,4 +20,4 @@
|
|||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</template>
|
||||
</template>
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
<select name="" id="prodForMenu" class="prodForMenu" multiple>
|
||||
<option value="" disabled>Choose...</option>
|
||||
{{#each products}}
|
||||
<option value="{{prodName}}">{{prodName}}</option>
|
||||
<option value="{{_id}}|{{prodName}}">{{prodName}}</option>
|
||||
{{/each}}
|
||||
</select>
|
||||
</div>
|
||||
|
|
@ -26,4 +26,4 @@
|
|||
</div>
|
||||
</div>
|
||||
{{> snackbar}}
|
||||
</template>
|
||||
</template>
|
||||
|
|
|
|||
|
|
@ -36,22 +36,39 @@ Template.modalLinkProducts.events({
|
|||
'click #saveLink' (event) {
|
||||
event.preventDefault();
|
||||
let menuItemId = Session.get("menuItemId");
|
||||
let menuItemName = Session.get("menuItemName");
|
||||
let linkSelect = document.getElementById('prodForMenu');
|
||||
let linkObjArray = [];
|
||||
let links = M.FormSelect.getInstance(linkSelect).getSelectedValues();
|
||||
if (typeof links != undefined && links != [] && links != null) {
|
||||
Meteor.call("add.menuProdLinks", menuItemId, links, function(err, result) {
|
||||
// let's split these links into their parts, and make an array of objects
|
||||
for (i=0; i<links.length; i++) {
|
||||
let linkArray = links[i].split('|');
|
||||
let key = linkArray[0];
|
||||
let value = linkArray[1];
|
||||
let linkObj = { prodId: key, prodName: value };
|
||||
linkObjArray.push(linkObj);
|
||||
}
|
||||
|
||||
Meteor.call("add.menuProdLinks", menuItemId, menuItemName, linkObjArray, function(err, result) {
|
||||
if (err) {
|
||||
console.log(" ERROR adding product links to this menu item: " + err);
|
||||
} else {
|
||||
Meteor.call('update.menuItemLinked', menuItemId, true, function(err, result) {
|
||||
if (err) {
|
||||
console.log(" ERROR adding link exists to menu item: " + err);
|
||||
console.log(" ERROR adding link to menu item: " + err);
|
||||
} else {
|
||||
showSnackbar("Products added to Menu Item successfully!", "green");
|
||||
Meteor.call('link.inMenu', menuItemId, true, function(error, nresult) {
|
||||
if (error) {
|
||||
console.log(" ERROR adding link to menu sub-item: " + error);
|
||||
} else {
|
||||
showSnackbar("Products added to Menu Item successfully!", "green");
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -117,4 +117,62 @@ Meteor.methods({
|
|||
Menus.remove({ _id: removeMenuIds[l] });
|
||||
}
|
||||
},
|
||||
});
|
||||
'addto.Menu' (menuId, menuItem, menuItemId, dateSrv, isLinked) {
|
||||
check(menuId, String);
|
||||
check(menuItem, String);
|
||||
check(menuItemId, String);
|
||||
check(dateSrv, String);
|
||||
check(isLinked, Boolean);
|
||||
|
||||
if (!this.userId) {
|
||||
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);
|
||||
|
||||
return Menus.update({ _id: menuId }, {
|
||||
$addToSet: {
|
||||
menuItems:
|
||||
{
|
||||
menuItemId: menuItemId,
|
||||
menuItemName: menuItem,
|
||||
serveDate: dateSrv,
|
||||
serveDateActual: serveDateActual,
|
||||
isLinked: isLinked
|
||||
},
|
||||
}
|
||||
});
|
||||
},
|
||||
'link.inMenu' (menuItemId, isLinked) {
|
||||
check(menuItemId, String);
|
||||
check(isLinked, Boolean);
|
||||
|
||||
if (!this.userId) {
|
||||
throw new Meteor.Error('You are not allowed to link menu items to products. Make sure you are logged in with valid user credentials.');
|
||||
}
|
||||
|
||||
return Menus.update({ 'menuItems.menuItemId': menuItemId }, {
|
||||
$set: {
|
||||
"menuItems.$.isLinked": isLinked
|
||||
}
|
||||
});
|
||||
},
|
||||
'delete.itemFromMenu' (itemIds) {
|
||||
check(itemIds, String);
|
||||
|
||||
if (!this.userId) {
|
||||
throw new Meteor.Error('You are not allowed to delete items from a menu. Make sure you are logged in with valid user credentials.');
|
||||
}
|
||||
|
||||
let ids = itemIds.split('_');
|
||||
console.log("item ids: " + ids[0] + " and " + ids[1]);
|
||||
|
||||
return Menus.update({ _id: ids[0] }, {
|
||||
$pull: {
|
||||
menuItems: {
|
||||
menuItemId: ids[1],
|
||||
},
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -12,10 +12,8 @@ MenuItems.allow({
|
|||
});
|
||||
|
||||
Meteor.methods({
|
||||
'add.menuItem' (itemName, serveDate, menuId) {
|
||||
'add.menuItem' (itemName) {
|
||||
check(itemName, String);
|
||||
check(serveDate, String);
|
||||
check(menuId, String);
|
||||
|
||||
if (!this.userId) {
|
||||
throw new Meteor.Error('You are not allowed to add items. Make sure you are logged in with valid user credentials.');
|
||||
|
|
@ -25,11 +23,7 @@ Meteor.methods({
|
|||
|
||||
return MenuItems.insert({
|
||||
itemName: itemName,
|
||||
serveDate: serveDate,
|
||||
serveDateActual: serveDateActual,
|
||||
menuId: menuId,
|
||||
addedBy: this.userId,
|
||||
itemMade: false,
|
||||
dateAddedtoMenu: new Date(),
|
||||
isLinked: false,
|
||||
});
|
||||
|
|
@ -48,49 +42,6 @@ Meteor.methods({
|
|||
}
|
||||
});
|
||||
},
|
||||
'setMade.menuItem' (itemId) {
|
||||
check(itemId, String);
|
||||
|
||||
if (!this.userId) {
|
||||
throw new Meteor.Error('You are not allowed to set items as made. Make sure you are logged in with valid user credentials.');
|
||||
}
|
||||
|
||||
return MenuItems.update({ _id: itemId }, {
|
||||
$set: {
|
||||
itemMade: true,
|
||||
dateMade: new Date(),
|
||||
}
|
||||
});
|
||||
},
|
||||
'setAllMade.menuItem' (menuId) {
|
||||
check(menuId, String);
|
||||
|
||||
if (!this.userId) {
|
||||
throw new Meteor.Error('You are not allowed to set all items as made. Make sure you are logged in with valid user credentials.');
|
||||
}
|
||||
|
||||
return MenuItems.update({ menuId: menuId }, {
|
||||
$set: {
|
||||
itemMade: true,
|
||||
}
|
||||
}, {
|
||||
multi: true
|
||||
});
|
||||
},
|
||||
'setNotMade.menuItem' (itemId) {
|
||||
check(itemId, String);
|
||||
|
||||
if (!this.userId) {
|
||||
throw new Meteor.Error('You are not allowed to set items as not made. Make sure you are logged in with valid user credentials.');
|
||||
}
|
||||
|
||||
return MenuItems.update({ _id: itemId }, {
|
||||
$set: {
|
||||
itemMade: false,
|
||||
dateUnMade: new Date(),
|
||||
}
|
||||
});
|
||||
},
|
||||
'edit.madeItem' (itemId, itemName, serveDate) {
|
||||
check(itemId, String);
|
||||
check(itemName, String);
|
||||
|
|
@ -130,4 +81,4 @@ Meteor.methods({
|
|||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -13,32 +13,21 @@ MenuProdLinks.allow({
|
|||
});
|
||||
|
||||
Meteor.methods({
|
||||
'add.menuProdLinks' (menuItemId, prodNameArray) {
|
||||
'add.menuProdLinks' (menuItemId, menuItemName, prodNameArray) {
|
||||
check(menuItemId, String);
|
||||
check(prodNameArray, [String]);
|
||||
check(menuItemName, String);
|
||||
check(prodNameArray, [Object]);
|
||||
|
||||
if (!this.userId) {
|
||||
throw new Meteor.Error('You are not allowed to add menu and product links. Make sure you are logged in with valid user credentials.');
|
||||
}
|
||||
};
|
||||
|
||||
let productObj = {};
|
||||
|
||||
let prodNameLength = prodNameArray.length;
|
||||
|
||||
for (i=0; i<prodNameLength; i++) {
|
||||
let product = Products.findOne({ prodName: prodNameArray[i] });
|
||||
if (typeof product != 'undefined' && product != null && product != "") {
|
||||
let prodId = product._id;
|
||||
MenuProdLinks.insert({
|
||||
menuItemId: menuItemId,
|
||||
prodName: prodNameArray[i],
|
||||
prodId: prodId,
|
||||
dateCreated: Date(),
|
||||
createdBy: this.userId
|
||||
});
|
||||
} else {
|
||||
console.log(" ERROR - unable to find a matching product by name: " + prodName[i] + ".");
|
||||
}
|
||||
}
|
||||
MenuProdLinks.insert({
|
||||
menuItemId: menuItemId,
|
||||
menuItemName: menuItemName,
|
||||
products: prodNameArray,
|
||||
dateCreated: Date(),
|
||||
createdBy: this.userId
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -88,9 +88,17 @@ Meteor.publish("myMenus", function() {
|
|||
}
|
||||
});
|
||||
|
||||
Meteor.publish("menuItems", function() {
|
||||
try {
|
||||
return MenuItems.find({});
|
||||
} catch (error) {
|
||||
console.log(" ERROR pulling menuItem data: " + error);
|
||||
}
|
||||
});
|
||||
|
||||
Meteor.publish("myMenuItems", function(menuId) {
|
||||
try {
|
||||
return MenuItems.find({ menuId: menuId });
|
||||
return Menus.find({ menuId: menuId });
|
||||
} catch (error) {
|
||||
console.log(" ERROR pulling menu items for this list: " + error);
|
||||
}
|
||||
|
|
@ -108,7 +116,7 @@ Meteor.publish("todayMenuItems", function() {
|
|||
try {
|
||||
let todayDate = new Date();
|
||||
let todaysDate = moment(todayDate).format("MMM DD, YYYY");
|
||||
return MenuItems.find({ serveDate: todaysDate, itemMade: false });
|
||||
return Menus.find({ 'menuItems.serveDate': todaysDate });
|
||||
} catch (error) {
|
||||
console.log(" ERROR pulling today's menu items: " + error);
|
||||
}
|
||||
|
|
@ -176,4 +184,4 @@ Meteor.publish("menuProdLinkData", function() {
|
|||
} catch (error) {
|
||||
console.log(" ERROR publishing menu product links: " + error);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue