mirror of
https://gitlab.com/bmcgonag/get_my.git
synced 2026-03-27 00:08:49 +00:00
Finished adding the simplest form of Menus.
This commit is contained in:
parent
3290b3086a
commit
075dd57996
9 changed files with 107 additions and 12 deletions
|
|
@ -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.");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
@ -12,7 +12,10 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col s12">
|
||||
<div class="col s6">
|
||||
<a class="waves-effect waves-light btn shiftOneDay blue">Shift All By 1 Day</a>
|
||||
</div>
|
||||
<div class="col s6">
|
||||
<a class="waves-effect waves-light btn saveMenuItem green right">Add</a>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue