Finished adding the simplest form of Menus.

This commit is contained in:
Brian McGonagill 2022-08-27 16:59:01 -05:00
parent 3290b3086a
commit 075dd57996
9 changed files with 107 additions and 12 deletions

View file

@ -1,5 +1,6 @@
import { MenuItems } from '../../imports/api/menuItems.js';
import { Menus } from '../../imports/api/menu.js';
import moment from 'moment';
Template.menuItemsForm.onCreated(function() {
this.subscribe("myMenus");
@ -43,5 +44,23 @@ Template.menuItemsForm.events({
}
});
}
},
'click .shiftOneDay' (event) {
event.preventDefault();
let menuInfo = MenuItems.find({}).fetch();
// now menuInfo is an array
let menuInfoLen = menuInfo.length;
for (i = 0; i < menuInfoLen; i++) {
let menuItemId = menuInfo[i]._id;
let momentAddDay = moment(menuInfo[i].serveDate).add(1, 'day').format("MMM D, YYYY");
// console.log(momentAddDay);
Meteor.call('shiftDate', menuItemId, momentAddDay, function(err,result) {
if (err) {
// console.log(" ERROR shifting meal days: " + err);
} else {
// console.log(" SUCCESS shifting meal date.");
}
});
}
}
});