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
|
|
@ -31,6 +31,22 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col s12 m6 l4">
|
||||
<div class="card blue darken-3" id="menuInfoCard">
|
||||
<div class="card-content white-text">
|
||||
<span class="card-title"><h4>{{todayDate}}</h4></span>
|
||||
{{#each todayMenuItem}}
|
||||
<div class="row">
|
||||
<div class="col s8"><i class="medium material-icons">local_dining</i></div>
|
||||
<div class="col s4"><h2>{{itemName}}</h2></div>
|
||||
</div>
|
||||
{{/each}}
|
||||
</div>
|
||||
<div class="card-action">
|
||||
<a href="#" class="cardLink" id="myMenuLink">My Menus</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{#if isInRole 'systemadmin'}}
|
||||
<div class="col s12 m6 l4">
|
||||
<div class="card blue-grey darken-1" id="prodInfoCard">
|
||||
|
|
|
|||
|
|
@ -3,6 +3,9 @@ import { Lists } from "../../imports/api/lists";
|
|||
import { Locations } from "../../imports/api/location";
|
||||
import { Products } from "../../imports/api/products";
|
||||
import { Stores } from "../../imports/api/stores";
|
||||
import { Menus } from '../../imports/api/menu.js';
|
||||
import { MenuItems } from '../../imports/api/menuItems.js';
|
||||
import moment from 'moment';
|
||||
|
||||
|
||||
Template.dashboard.onCreated(function() {
|
||||
|
|
@ -12,6 +15,8 @@ Template.dashboard.onCreated(function() {
|
|||
this.subscribe("storeInfo");
|
||||
this.subscribe("myProducts");
|
||||
this.subscribe("myLocations");
|
||||
this.subscribe("myMenus");
|
||||
this.subscribe("todayMenuItems");
|
||||
});
|
||||
|
||||
Template.dashboard.onRendered(function() {
|
||||
|
|
@ -36,6 +41,14 @@ Template.dashboard.helpers({
|
|||
},
|
||||
locCount: function() {
|
||||
return Locations.find().count();
|
||||
},
|
||||
todayMenuItem: function() {
|
||||
return MenuItems.find({});
|
||||
},
|
||||
todayDate: function() {
|
||||
let now = new Date();
|
||||
let todayDate = moment(now).format("MMM D, YYYY");
|
||||
return todayDate;
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -62,6 +75,9 @@ Template.dashboard.events({
|
|||
case "locationMgmtLink":
|
||||
FlowRouter.go('/manageLocation');
|
||||
break;
|
||||
case "myMenuLink":
|
||||
FlowRouter.go('/mymenus');
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
@ -89,6 +105,8 @@ Template.dashboard.events({
|
|||
case "prodInfoCard":
|
||||
FlowRouter.go("/manageProduct");
|
||||
break;
|
||||
case "menuInfoCard":
|
||||
FlowRouter.go('/mymenus');
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -83,5 +83,19 @@ Meteor.methods({
|
|||
}
|
||||
|
||||
return MenuItems.remove({ _id: itemId });
|
||||
},
|
||||
'shiftDate' (itemId, momentAddDay) {
|
||||
check(itemId, String);
|
||||
check(momentAddDay, String);
|
||||
|
||||
if (!this.userId) {
|
||||
throw new Meteor.Error('You are not allowed to shift menu item dates. Make sure you are logged in with valid user credentials.');
|
||||
}
|
||||
|
||||
return MenuItems.update({ _id: itemId }, {
|
||||
$set: {
|
||||
serveDate: momentAddDay,
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
8
node_modules/meteor-node-stubs/CHANGELOG.md
generated
vendored
8
node_modules/meteor-node-stubs/CHANGELOG.md
generated
vendored
|
|
@ -1,3 +1,11 @@
|
|||
v1.2.1 - 2022-03-17
|
||||
|
||||
* Fix the missing dependencies.
|
||||
|
||||
v1.2.0 - 2022-03-11
|
||||
|
||||
* Adds support for [node: imports](https://nodejs.org/api/esm.html#node-imports).
|
||||
|
||||
v1.1.0 - 2021-07-19
|
||||
|
||||
* Updated dependencies to their latest versions
|
||||
|
|
|
|||
25
package-lock.json
generated
25
package-lock.json
generated
|
|
@ -17,24 +17,24 @@
|
|||
"integrity": "sha512-JVzAR/AjBvVt2BmYhxRCSYysDsPcssdmTFnzyLEts9qNwmjmu4JTAMYubEfwVOSwpQ1I1sKKFcxhZCI2buerfw=="
|
||||
},
|
||||
"meteor-node-stubs": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/meteor-node-stubs/-/meteor-node-stubs-1.1.0.tgz",
|
||||
"integrity": "sha512-YvMQb4zcfWA82wFdRVTyxq28GO+Us7GSdtP+bTtC/mV35yipKnWo4W4665O57AmLVFnz4zR+WIZW11b4sfCtJw==",
|
||||
"version": "1.2.5",
|
||||
"resolved": "https://registry.npmjs.org/meteor-node-stubs/-/meteor-node-stubs-1.2.5.tgz",
|
||||
"integrity": "sha512-FLlOFZx3KnZ5s3yPCK+x58DyX9ewN+oQ12LcpwBXMLtzJ/YyprMQVivd6KIrahZbKJrNenPNUGuDS37WUFg+Mw==",
|
||||
"requires": {
|
||||
"assert": "^2.0.0",
|
||||
"browserify-zlib": "^0.2.0",
|
||||
"buffer": "^6.0.3",
|
||||
"buffer": "^5.7.1",
|
||||
"console-browserify": "^1.2.0",
|
||||
"constants-browserify": "^1.0.0",
|
||||
"crypto-browserify": "^3.12.0",
|
||||
"domain-browser": "^4.19.0",
|
||||
"domain-browser": "^4.22.0",
|
||||
"elliptic": "^6.5.4",
|
||||
"events": "^3.3.0",
|
||||
"https-browserify": "^1.0.0",
|
||||
"os-browserify": "^0.3.0",
|
||||
"path-browserify": "^1.0.0",
|
||||
"process": "^0.11.10",
|
||||
"punycode": "^2.1.1",
|
||||
"punycode": "^1.4.1",
|
||||
"querystring-es3": "^0.2.1",
|
||||
"readable-stream": "^3.6.0",
|
||||
"stream-browserify": "^3.0.0",
|
||||
|
|
@ -151,11 +151,11 @@
|
|||
}
|
||||
},
|
||||
"buffer": {
|
||||
"version": "6.0.3",
|
||||
"version": "5.7.1",
|
||||
"bundled": true,
|
||||
"requires": {
|
||||
"base64-js": "^1.3.1",
|
||||
"ieee754": "^1.2.1"
|
||||
"ieee754": "^1.1.13"
|
||||
}
|
||||
},
|
||||
"buffer-xor": {
|
||||
|
|
@ -275,7 +275,7 @@
|
|||
}
|
||||
},
|
||||
"domain-browser": {
|
||||
"version": "4.19.0",
|
||||
"version": "4.22.0",
|
||||
"bundled": true
|
||||
},
|
||||
"elliptic": {
|
||||
|
|
@ -604,7 +604,7 @@
|
|||
}
|
||||
},
|
||||
"punycode": {
|
||||
"version": "2.1.1",
|
||||
"version": "1.4.1",
|
||||
"bundled": true
|
||||
},
|
||||
"querystring": {
|
||||
|
|
@ -793,6 +793,11 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"moment": {
|
||||
"version": "2.29.4",
|
||||
"resolved": "https://registry.npmjs.org/moment/-/moment-2.29.4.tgz",
|
||||
"integrity": "sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w=="
|
||||
},
|
||||
"regenerator-runtime": {
|
||||
"version": "0.13.9",
|
||||
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.9.tgz",
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
"dependencies": {
|
||||
"@babel/runtime": "^7.15.3",
|
||||
"jquery": "^3.6.0",
|
||||
"meteor-node-stubs": "^1.1.0"
|
||||
"meteor-node-stubs": "^1.2.5",
|
||||
"moment": "^2.29.4"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import { Lists } from '../imports/api/lists.js';
|
|||
import { ListItems } from '../imports/api/listItems.js';
|
||||
import { Menus } from '../imports/api/menu.js';
|
||||
import { MenuItems } from '../imports/api/menuItems.js';
|
||||
import moment from 'moment';
|
||||
|
||||
Meteor.publish("SystemConfig", function() {
|
||||
try {
|
||||
|
|
@ -85,3 +86,13 @@ Meteor.publish("myMenuItems", function(menuId) {
|
|||
console.log(" ERROR pulling list items for this list: " + error);
|
||||
}
|
||||
});
|
||||
|
||||
Meteor.publish("todayMenuItems", function() {
|
||||
try {
|
||||
let todayDate = new Date();
|
||||
let todaysDate = moment(todayDate).format("MMM D, YYYY");
|
||||
return MenuItems.find({ serveDate: todaysDate });
|
||||
} catch (error) {
|
||||
console.log(" ERROR pulling today's menu items: " + error);
|
||||
}
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue