mirror of
https://gitlab.com/bmcgonag/get_my.git
synced 2026-03-27 16:28:50 +00:00
96 lines
No EOL
2.7 KiB
JavaScript
96 lines
No EOL
2.7 KiB
JavaScript
import { Categories } from "../../imports/api/category";
|
|
import { Lists } from "../../imports/api/lists";
|
|
import { Locations } from "../../imports/api/location";
|
|
import { Products } from "../../imports/api/products";
|
|
import { Stores } from "../../imports/api/stores";
|
|
|
|
|
|
Template.dashboard.onCreated(function() {
|
|
this.subscribe("userList");
|
|
this.subscribe("myLists");
|
|
this.subscribe("myCategories");
|
|
this.subscribe("storeInfo");
|
|
this.subscribe("myProducts");
|
|
this.subscribe("myLocations");
|
|
});
|
|
|
|
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();
|
|
}
|
|
});
|
|
|
|
Template.dashboard.events({
|
|
"click .cardLink" (event) {
|
|
event.preventDefault();
|
|
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 "catMgmtLink":
|
|
FlowRouter.go('/manageCategory');
|
|
break;
|
|
case "locationMgmtLink":
|
|
FlowRouter.go('/manageLocation');
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
},
|
|
'click .card' (event) {
|
|
event.preventDefault();
|
|
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 "catInfoCard":
|
|
FlowRouter.go('/manageCategory');
|
|
break;
|
|
case "locInfoCard":
|
|
FlowRouter.go('/manageLocation');
|
|
break;
|
|
case "prodInfoCard":
|
|
FlowRouter.go("/manageProduct");
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
}); |