diff --git a/client/AdminMgmt/CategoryMgMt/catMgmtTbl.html b/client/AdminMgmt/CategoryMgMt/catMgmtTbl.html
index cd65384..1531675 100644
--- a/client/AdminMgmt/CategoryMgMt/catMgmtTbl.html
+++ b/client/AdminMgmt/CategoryMgMt/catMgmtTbl.html
@@ -1,21 +1,15 @@
-
-
-
- | Name |
- Actions |
-
-
-
- {{#each cats}}
-
- | {{categoryName}} |
-
- delete
- edit
- |
-
- {{/each}}
-
-
+
+
+
+ {{#each cats}}
+ -
+ {{categoryName}}
+ delete
+ edit
+
+ {{/each}}
+
+
+
\ No newline at end of file
diff --git a/client/AdminMgmt/ListMgmt/listMgmt.html b/client/AdminMgmt/ListMgmt/listMgmt.html
new file mode 100644
index 0000000..5e9a5d6
--- /dev/null
+++ b/client/AdminMgmt/ListMgmt/listMgmt.html
@@ -0,0 +1,5 @@
+
+ {{> listMgmtForm}}
+
+ {{> listMgmtTbl}}
+
\ No newline at end of file
diff --git a/client/AdminMgmt/ListMgmt/listMgmt.js b/client/AdminMgmt/ListMgmt/listMgmt.js
new file mode 100644
index 0000000..2f42eec
--- /dev/null
+++ b/client/AdminMgmt/ListMgmt/listMgmt.js
@@ -0,0 +1,16 @@
+
+Template.listMgmt.onCreated(function() {
+
+});
+
+Template.listMgmt.onRendered(function() {
+
+});
+
+Template.listMgmt.helpers({
+
+});
+
+Template.listMgmt.events({
+
+});
\ No newline at end of file
diff --git a/client/AdminMgmt/ListMgmt/listMgmtForm.html b/client/AdminMgmt/ListMgmt/listMgmtForm.html
new file mode 100644
index 0000000..d2b2fac
--- /dev/null
+++ b/client/AdminMgmt/ListMgmt/listMgmtForm.html
@@ -0,0 +1,18 @@
+
+ Lists
+
+
\ No newline at end of file
diff --git a/client/AdminMgmt/ListMgmt/listMgmtForm.js b/client/AdminMgmt/ListMgmt/listMgmtForm.js
new file mode 100644
index 0000000..43c26cf
--- /dev/null
+++ b/client/AdminMgmt/ListMgmt/listMgmtForm.js
@@ -0,0 +1,92 @@
+import { Lists } from '../../../imports/api/lists.js';
+
+Template.listMgmtForm.onCreated(function() {
+ this.subscribe("myLists");
+});
+
+Template.listMgmtForm.onRendered(function() {
+ Session.set("listNameMiss", false);
+ Session.set("listNameEditMode", false);
+});
+
+Template.listMgmtForm.helpers({
+ listNameErr: function() {
+ return Session.get("listNameMiss");
+ },
+ editMode: function() {
+ return Session.get("listNameEditMode");
+ }
+});
+
+Template.listMgmtForm.events({
+ 'click .saveListMgmt' (event) {
+ event.preventDefault();
+ let listName = $("#listNameInp").val();
+
+ if (listName == null || listName == "") {
+ Session.set("listNameMiss", true);
+ return;
+ } else {
+ Meteor.call('add.list', listName, function(err, result) {
+ if (err) {
+ console.log(" ERROR adding list name: " + err);
+ } else {
+ console.log(" SUCCESS adding list name.");
+ $("#listNameInp").val("");
+ }
+ });
+ }
+ },
+ 'click .renameListMgmt' (event) {
+ event.preventDefault();
+ let listName = $("#listNameInp").val();
+ let listId = Session.get("listItemId");
+
+ if (listName == null || listName == "") {
+ Session.set("listNameMiss", true);
+ return;
+ } else {
+ Meteor.call('edit.list', listId, listName, function(err, result) {
+ if (err) {
+ console.log(" ERROR editing list name: " + err);
+ } else {
+ console.log(" SUCCESS editing list name.");
+ $("#listNameInp").val("");
+ Session.set("listNameEditMode", false);
+ }
+ });
+ }
+ },
+ 'submit .listAdd' (event) {
+ event.preventDefault();
+ let editMode = Session.get("listNameEditMode");
+ let listName = $("#listNameInp").val();
+ let listId = Session.get("listItemId");
+
+ if (listName == null || listName == "") {
+ Session.set("listNameMiss", true);
+ return;
+ } else {
+ if (editMode == false) {
+ Meteor.call('add.list', listName, function(err, result) {
+ if (err) {
+ console.log(" ERROR adding list name: " + err);
+ } else {
+ console.log(" SUCCESS adding list name.");
+ $("#listNameInp").val("");
+ }
+ });
+ } else {
+ Meteor.call('edit.list', listId, listName, function(err, result) {
+ if (err) {
+ console.log(" ERROR editing list name: " + err);
+ } else {
+ console.log(" SUCCESS editing list name.");
+ $("#listNameInp").val("");
+ Session.set("listNameEditMode", false);
+ }
+ });
+ }
+ }
+ }
+});
\ No newline at end of file
diff --git a/client/AdminMgmt/ListMgmt/listMgmtTbl.html b/client/AdminMgmt/ListMgmt/listMgmtTbl.html
new file mode 100644
index 0000000..fde6b45
--- /dev/null
+++ b/client/AdminMgmt/ListMgmt/listMgmtTbl.html
@@ -0,0 +1,16 @@
+
+
+
+
+ {{#each lists}}
+ -
+ {{listName}}
+ delete
+ edit
+ check
+
+ {{/each}}
+
+
+
+
\ No newline at end of file
diff --git a/client/AdminMgmt/ListMgmt/listMgmtTbl.js b/client/AdminMgmt/ListMgmt/listMgmtTbl.js
new file mode 100644
index 0000000..e3a837c
--- /dev/null
+++ b/client/AdminMgmt/ListMgmt/listMgmtTbl.js
@@ -0,0 +1,47 @@
+import { Lists } from '../../../imports/api/lists.js';
+
+Template.listMgmtTbl.onCreated(function() {
+ this.subscribe("myLists");
+});
+
+Template.listMgmtTbl.onRendered(function() {
+ $('.tooltipped').tooltip();
+});
+
+Template.listMgmtTbl.helpers({
+ lists: function() {
+ return Lists.find({});
+ }
+});
+
+Template.listMgmtTbl.events({
+ 'click .deleteListName' (event) {
+ event.preventDefault();
+ let listId = this._id;
+ Meteor.call('delete.list', listId, function(err, result) {
+ if (err) {
+ console.log(" ERROR deleting list: " + err);
+ } else {
+ console.log(" SUCCESS deleting list.");
+ }
+ });
+ },
+ 'click .editListName' (event) {
+ event.preventDefault();
+ let listName = Lists.findOne({ _id: this._id }).listName;
+ $("#listNameInp").val(listName);
+ Session.set("listNameEditMode", true);
+ Session.set("listItemId", this._id);
+ },
+ 'click .markListComplete' (event) {
+ event.preventDefault();
+ let listId = this._id;
+ Meteor.call('mark.complete', listId, function(err, result) {
+ if (err) {
+ console.log(" ERROR marking complete: " + err);
+ } else {
+ console.log(" SUCCESS marking complete.");
+ }
+ });
+ }
+});
\ No newline at end of file
diff --git a/client/AdminMgmt/MgmtPage/mgmtPage.html b/client/AdminMgmt/MgmtPage/mgmtPage.html
index 0bf42f8..21a1460 100644
--- a/client/AdminMgmt/MgmtPage/mgmtPage.html
+++ b/client/AdminMgmt/MgmtPage/mgmtPage.html
@@ -1,12 +1,12 @@
-
+
+
Add New Store
@@ -56,4 +57,26 @@
Done
+
+
+
+
+
Add New Location
+ {{> locMgmtForm}}
+
+
+
+
+
+
+
+
Add New Category
+ {{> catMgmtForm}}
+
+
+
\ No newline at end of file
diff --git a/client/AdminMgmt/ProductMgmt/prodMgmtForm.js b/client/AdminMgmt/ProductMgmt/prodMgmtForm.js
index bd28377..4eb60e7 100644
--- a/client/AdminMgmt/ProductMgmt/prodMgmtForm.js
+++ b/client/AdminMgmt/ProductMgmt/prodMgmtForm.js
@@ -62,6 +62,10 @@ Template.prodMgmtForm.events({
// console.log(" ERROR: can't add product: " + err);
} else {
// console.log(" SUCCESS adding product.");
+ $("#prodName").val("");
+ $("#prodCategory").val("");
+ $("#prodStore").val("");
+ $("#prodLocation").val("");
}
});
}
@@ -71,7 +75,7 @@ Template.prodMgmtForm.events({
$("#prodName").val("");
$("#prodCategory").val("");
$("#prodStore").val("");
- $("#prodLocation").val("")
+ $("#prodLocation").val("");
},
'change #prodStore' (event) {
event.preventDefault();
@@ -81,7 +85,6 @@ Template.prodMgmtForm.events({
$("#prodStore").val("");
// open a modal to enter store information.
$('#modalStore').modal('open');
-
}
},
'change #prodLocation' (event) {
@@ -98,10 +101,13 @@ Template.prodMgmtForm.events({
event.preventDefault();
let val = $("#prodCategory").val();
- if (val == "addNewCategory") {
+ if (val == "addNewCat") {
$("#prodCategory").val("");
// open a modal to enter store information.
$('#modalCategory').modal('open');
}
},
+ 'click .modal-close' (event) {
+ $('select').formSelect();
+ }
});
\ No newline at end of file
diff --git a/client/AdminMgmt/StoreMgMt/storeMgmt.html b/client/AdminMgmt/StoreMgmt/storeMgmt.html
similarity index 100%
rename from client/AdminMgmt/StoreMgMt/storeMgmt.html
rename to client/AdminMgmt/StoreMgmt/storeMgmt.html
diff --git a/client/AdminMgmt/StoreMgMt/storeMgmt.js b/client/AdminMgmt/StoreMgmt/storeMgmt.js
similarity index 100%
rename from client/AdminMgmt/StoreMgMt/storeMgmt.js
rename to client/AdminMgmt/StoreMgmt/storeMgmt.js
diff --git a/client/AdminMgmt/StoreMgMt/storeMgmtForm.html b/client/AdminMgmt/StoreMgmt/storeMgmtForm.html
similarity index 100%
rename from client/AdminMgmt/StoreMgMt/storeMgmtForm.html
rename to client/AdminMgmt/StoreMgmt/storeMgmtForm.html
diff --git a/client/AdminMgmt/StoreMgMt/storeMgmtForm.js b/client/AdminMgmt/StoreMgmt/storeMgmtForm.js
similarity index 100%
rename from client/AdminMgmt/StoreMgMt/storeMgmtForm.js
rename to client/AdminMgmt/StoreMgmt/storeMgmtForm.js
diff --git a/client/AdminMgmt/StoreMgMt/storeMgmtTbl.html b/client/AdminMgmt/StoreMgmt/storeMgmtTbl.html
similarity index 100%
rename from client/AdminMgmt/StoreMgMt/storeMgmtTbl.html
rename to client/AdminMgmt/StoreMgmt/storeMgmtTbl.html
diff --git a/client/AdminMgmt/StoreMgMt/storeMgmtTbl.js b/client/AdminMgmt/StoreMgmt/storeMgmtTbl.js
similarity index 100%
rename from client/AdminMgmt/StoreMgMt/storeMgmtTbl.js
rename to client/AdminMgmt/StoreMgmt/storeMgmtTbl.js
diff --git a/client/Dashboard/dashboard.html b/client/Dashboard/dashboard.html
index 68d2546..dcd254f 100644
--- a/client/Dashboard/dashboard.html
+++ b/client/Dashboard/dashboard.html
@@ -16,7 +16,70 @@
- {{/if}}
-
+ {{/if}}
+
+
+
+ {{#if isInRole 'systemadmin'}}
+
+ {{/if}}
+
+
+
+
+
+
My Products
+
+
qr_code_scanner
+
{{productCount}}
+
+
+ {{#if isInRole 'systemadmin'}}
+
+ {{/if}}
+
+
+
+
+
+
My Stores
+
+
local_mall
+
{{storeCount}}
+
+
+ {{#if isInRole 'systemadmin'}}
+
+ {{/if}}
+
+
+
+
+
+
My Categories
+
+
category
+
{{catCount}}
+
+
+ {{#if isInRole 'systemadmin'}}
+
+ {{/if}}
+
+
\ No newline at end of file
diff --git a/client/Dashboard/dashboard.js b/client/Dashboard/dashboard.js
index f699886..d0d339e 100644
--- a/client/Dashboard/dashboard.js
+++ b/client/Dashboard/dashboard.js
@@ -1,7 +1,15 @@
+import { Categories } from "../../imports/api/category";
+import { Lists } from "../../imports/api/lists";
+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");
});
Template.dashboard.onRendered(function() {
@@ -11,6 +19,18 @@ 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();
}
});
diff --git a/client/General/headerBar.html b/client/General/headerBar.html
index 3c9a950..a014823 100644
--- a/client/General/headerBar.html
+++ b/client/General/headerBar.html
@@ -19,8 +19,8 @@
{{#if currentUser}}
- - My Lists
- - Manage
+ - My Lists
+ - Manage
- Sign Out
{{else}}
- Login
diff --git a/client/main.css b/client/main.css
index 15cdf23..1f3c654 100644
--- a/client/main.css
+++ b/client/main.css
@@ -19,4 +19,8 @@ input.dark-mode {
select.dark-mode {
color: #fcfcfc;
+}
+
+li.collection-item {
+ font-size: 24px;
}
\ No newline at end of file
diff --git a/imports/api/lists.js b/imports/api/lists.js
index 57dbb6e..e95e330 100644
--- a/imports/api/lists.js
+++ b/imports/api/lists.js
@@ -21,7 +21,8 @@ Meteor.methods({
return Lists.insert({
listName: listName,
- listOwner: this.userId;
+ listOwner: this.userId,
+ listComplete: false,
});
},
'edit.list' (listId, listName) {
@@ -47,11 +48,32 @@ Meteor.methods({
let listInfo = Lists.findOne({ _id: listId });
let myId = this.userId;
- if (myId == listInfo.owner) {
+ if (myId == listInfo.listOwner) {
return Lists.remove({ _id: listId });
} else {
console.log("User not allowed to delete this list. Not the owner!");
return("Not Allowed!");
}
+ },
+ 'mark.complete' (listId) {
+ check(listId, String);
+
+ if (!this.userId) {
+ throw new Meteor.Error('You are not allowed to mark lists complete. Make sure you are logged in with valid user credentials.');
+ }
+
+ let listInfo = Lists.findOne({ _id: listId });
+ let myId = this.userId;
+ if (myId == listInfo.listOwner) {
+ return Lists.update({ _id: listId }, {
+ $set: {
+ listComplete: true,
+ completedOn: new Date()
+ }
+ });
+ } else {
+ console.log("User not allowed to mark lists complete. Not a member of the list!");
+ return("Not Allowed!");
+ }
}
});
\ No newline at end of file
diff --git a/lib/routes.js b/lib/routes.js
index fb3d30a..33c5bb1 100644
--- a/lib/routes.js
+++ b/lib/routes.js
@@ -73,4 +73,11 @@ FlowRouter.route('/manageLocation', {
action() {
BlazeLayout.render('MainLayout', { main: 'locMgmt' });
}
+});
+
+FlowRouter.route('/manageLists', {
+ name: 'manageLists',
+ action() {
+ BlazeLayout.render('MainLayout', { main: 'listMgmt' });
+ }
});
\ No newline at end of file
diff --git a/server/publish.js b/server/publish.js
index 7823f66..40a6dbd 100644
--- a/server/publish.js
+++ b/server/publish.js
@@ -4,6 +4,7 @@ import { UserConfigOptions } from '../imports/api/userConfigOptions.js';
import { Products } from '../imports/api/products.js';
import { Categories } from '../imports/api/category.js';
import { Locations } from '../imports/api/location.js';
+import { Lists } from '../imports/api/lists.js';
Meteor.publish("SystemConfig", function() {
try {
@@ -47,4 +48,12 @@ Meteor.publish("myLocations", function() {
} catch (error) {
console.log(" ERROR pulling location data: " + error);
}
+});
+
+Meteor.publish("myLists", function() {
+ try {
+ return Lists.find({ listOwner: this.userId, listComplete: false });
+ } catch (error) {
+ console.log(" ERROR pulling list data: " + error);
+ }
});
\ No newline at end of file