mirror of
https://gitlab.com/bmcgonag/get_my.git
synced 2026-03-27 00:08:49 +00:00
- Added a permission to show or hide update version information on that dashboard as a card that will only show when new update info is available and not yet dismissed.
- Updated Lists so list items added will have their fist letter auto-capitalized
- Updated Lists so list items are searched against the products before being added to the list, so we have store info more commonly in lists
- Updated Products so new products will have their first letter capitalized automatically
- Updated the dashboard to show the Update Available card if this is enbaled in permissions.
- The dashboard card only shows for System Admin roles.
- The dashboard card is enabled by default
- The dashboard card is pulled from the GitLab releases RSS feed.
- The RSS Feed is only checked every 30 minutes using node-cron
- Updated System Configuration to have a toggle for the update available card
- Added a bell icon to the top and slide out navigation, shown when a new update is available, if update available is enabled in system configuration.
151 lines
4.4 KiB
JavaScript
151 lines
4.4 KiB
JavaScript
import { Lists } from "../../imports/api/lists";
|
|
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';
|
|
import { TaskItems } from "../../imports/api/tasks";
|
|
import { UpdateInfo } from '../../imports/api/updateInfo.js';
|
|
import { SysConfig } from '../../imports/api/systemConfig.js';
|
|
|
|
Template.dashboard.onCreated(function() {
|
|
this.subscribe("userList");
|
|
this.subscribe("myLists");
|
|
this.subscribe("myCategories");
|
|
this.subscribe("storeInfo");
|
|
this.subscribe("myProducts");
|
|
this.subscribe("myLocations");
|
|
// this.subscribe("myMenus");
|
|
this.subscribe("todayMenuItems");
|
|
this.subscribe("myTasks");
|
|
this.subscribe("UpdateVersion");
|
|
this.subscribe("SystemConfig");
|
|
});
|
|
|
|
Template.dashboard.onRendered(function() {
|
|
|
|
});
|
|
|
|
Template.dashboard.helpers({
|
|
userCount: function() {
|
|
return Meteor.users.find().count();
|
|
},
|
|
listCount: function() {
|
|
return Lists.find().count();
|
|
},
|
|
storeCount: function() {
|
|
return Stores.find().count();
|
|
},
|
|
productCount: function() {
|
|
return Products.find().count();
|
|
},
|
|
catCount: function() {
|
|
return Categories.find().count();
|
|
},
|
|
locCount: function() {
|
|
return Locations.find().count();
|
|
},
|
|
mytaskitems: function() {
|
|
let today = moment(new Date()).format("MMM DD, YYYY");
|
|
return TaskItems.find({ isComplete: false, taskDate: today });
|
|
},
|
|
todayMenuItem: function() {
|
|
let myMenus = Menus.find({}).fetch();
|
|
console.dir(myMenus);
|
|
return myMenus;
|
|
},
|
|
todayDate: function() {
|
|
let now = new Date();
|
|
let todayDate = moment(now).format("MMM DD, YYYY");
|
|
return todayDate;
|
|
},
|
|
updates: function() {
|
|
return UpdateInfo.find({});
|
|
},
|
|
updatesExist: function() {
|
|
let updateExists = UpdateInfo.find({ viewed: false }).fetch();
|
|
if (updateExists.length > 0) {
|
|
return true;
|
|
} else {
|
|
return false;
|
|
}
|
|
},
|
|
currConfig: function() {
|
|
return SysConfig.findOne({});
|
|
},
|
|
descriptionSinHTML: function() {
|
|
let desc = this.description;
|
|
let sinH = $(desc).text();
|
|
return sinH;
|
|
},
|
|
niceDate: function() {
|
|
let rDateNorm = this.date;
|
|
let rDate = moment(rDateNorm).format('LL');
|
|
return rDate;
|
|
}
|
|
});
|
|
|
|
Template.dashboard.events({
|
|
"click .cardLink" (event) {
|
|
let link = event.currentTarget.id;
|
|
switch(link) {
|
|
case "userMgmtLink":
|
|
FlowRouter.go('/userMgmt');
|
|
break;
|
|
case "listMgmtLink":
|
|
FlowRouter.go('/manageLists');
|
|
break;
|
|
case "storeMgmtLink":
|
|
FlowRouter.go('/manageStore');
|
|
break;
|
|
case "prodMgmtLink":
|
|
FlowRouter.go('/manageProduct');
|
|
break;
|
|
case "myMenuLink":
|
|
FlowRouter.go('/mymenus');
|
|
break;
|
|
case "taskMgmtLink":
|
|
FlowRouter.go('/taskHome');
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
},
|
|
'click .card' (event) {
|
|
let cardId = event.currentTarget.id;
|
|
|
|
switch(cardId) {
|
|
case "userInfoCard":
|
|
FlowRouter.go('/userMgmt');
|
|
break;
|
|
case "listInfoCard":
|
|
FlowRouter.go("/mylists");
|
|
break;
|
|
case "storeInfoCard":
|
|
FlowRouter.go('/manageStore');
|
|
break;
|
|
case "prodInfoCard":
|
|
FlowRouter.go("/manageProduct");
|
|
break;
|
|
case "menuInfoCard":
|
|
FlowRouter.go('/mymenus');
|
|
break;
|
|
case "taskInfoCard":
|
|
FlowRouter.go('/myTasks');
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
},
|
|
'click .readLink' (event) {
|
|
let eventId = event.currentTarget.id;
|
|
|
|
Meteor.call('markUpdate.read', eventId, function(err, result) {
|
|
if (err) {
|
|
console.log(" ERROR marking update as 'read': " + err);
|
|
} else {
|
|
console.log("marked read successfully!");
|
|
}
|
|
});
|
|
}
|
|
});
|