From 266dbd0856eae9d154f37dfc3bec5e69660cdd88 Mon Sep 17 00:00:00 2001 From: Brian McGonagill Date: Mon, 15 Aug 2022 18:07:39 -0500 Subject: [PATCH] Lots of changes and additions to the project. Still early, and not usable. --- .meteor/packages | 2 +- client/Accounts/UserMgmt/userMgmt.js | 2 +- client/AdminMgmt/CategoryMgMt/catMgmt.html | 6 + client/AdminMgmt/CategoryMgMt/catMgmt.js | 17 +++ .../AdminMgmt/CategoryMgMt/catMgmtForm.html | 16 +++ client/AdminMgmt/CategoryMgMt/catMgmtForm.js | 39 +++++++ client/AdminMgmt/CategoryMgMt/catMgmtTbl.html | 21 ++++ client/AdminMgmt/CategoryMgMt/catMgmtTbl.js | 19 ++++ client/AdminMgmt/LocationMgmt/locMgmt.html | 5 + client/AdminMgmt/LocationMgmt/locMgmt.js | 15 +++ .../AdminMgmt/LocationMgmt/locMgmtForm.html | 16 +++ client/AdminMgmt/LocationMgmt/locMgmtForm.js | 39 +++++++ client/AdminMgmt/LocationMgmt/locMgmtTbl.html | 21 ++++ client/AdminMgmt/LocationMgmt/locMgmtTbl.js | 19 ++++ client/AdminMgmt/MgmtPage/mgmtPage.html | 20 ++++ client/AdminMgmt/MgmtPage/mgmtPage.js | 21 ++++ client/AdminMgmt/ProductMgmt/prodMgmt.html | 5 + client/AdminMgmt/ProductMgmt/prodMgmt.js | 17 +++ .../AdminMgmt/ProductMgmt/prodMgmtForm.html | 59 ++++++++++ client/AdminMgmt/ProductMgmt/prodMgmtForm.js | 107 ++++++++++++++++++ client/AdminMgmt/ProductMgmt/prodMgmtTbl.html | 31 +++++ client/AdminMgmt/ProductMgmt/prodMgmtTbl.js | 19 ++++ client/AdminMgmt/StoreMgMt/storeMgmt.html | 11 ++ client/AdminMgmt/StoreMgMt/storeMgmt.js | 17 +++ client/AdminMgmt/StoreMgMt/storeMgmtForm.html | 20 ++++ client/AdminMgmt/StoreMgMt/storeMgmtForm.js | 35 ++++++ client/AdminMgmt/StoreMgMt/storeMgmtTbl.html | 27 +++++ client/AdminMgmt/StoreMgMt/storeMgmtTbl.js | 26 +++++ client/Dashboard/dashboard.js | 2 +- client/General/headerBar.html | 51 ++------- client/General/headerBar.js | 2 + client/MainLayout.js | 17 +++ client/main.css | 12 ++ client/main.html | 2 +- imports/api/category.js | 8 +- imports/api/location.js | 10 +- imports/api/stores.js | 4 +- imports/api/userConfigOptions.js | 32 ++++++ lib/routes.js | 56 +++++++-- server/methods.js | 14 +++ server/publish.js | 41 +++++++ 41 files changed, 836 insertions(+), 67 deletions(-) create mode 100644 client/AdminMgmt/CategoryMgMt/catMgmt.html create mode 100644 client/AdminMgmt/CategoryMgMt/catMgmt.js create mode 100644 client/AdminMgmt/CategoryMgMt/catMgmtForm.html create mode 100644 client/AdminMgmt/CategoryMgMt/catMgmtForm.js create mode 100644 client/AdminMgmt/CategoryMgMt/catMgmtTbl.html create mode 100644 client/AdminMgmt/CategoryMgMt/catMgmtTbl.js create mode 100644 client/AdminMgmt/LocationMgmt/locMgmt.html create mode 100644 client/AdminMgmt/LocationMgmt/locMgmt.js create mode 100644 client/AdminMgmt/LocationMgmt/locMgmtForm.html create mode 100644 client/AdminMgmt/LocationMgmt/locMgmtForm.js create mode 100644 client/AdminMgmt/LocationMgmt/locMgmtTbl.html create mode 100644 client/AdminMgmt/LocationMgmt/locMgmtTbl.js create mode 100644 client/AdminMgmt/MgmtPage/mgmtPage.html create mode 100644 client/AdminMgmt/MgmtPage/mgmtPage.js create mode 100644 client/AdminMgmt/ProductMgmt/prodMgmt.html create mode 100644 client/AdminMgmt/ProductMgmt/prodMgmt.js create mode 100644 client/AdminMgmt/ProductMgmt/prodMgmtForm.html create mode 100644 client/AdminMgmt/ProductMgmt/prodMgmtForm.js create mode 100644 client/AdminMgmt/ProductMgmt/prodMgmtTbl.html create mode 100644 client/AdminMgmt/ProductMgmt/prodMgmtTbl.js create mode 100644 client/AdminMgmt/StoreMgMt/storeMgmt.html create mode 100644 client/AdminMgmt/StoreMgMt/storeMgmt.js create mode 100644 client/AdminMgmt/StoreMgMt/storeMgmtForm.html create mode 100644 client/AdminMgmt/StoreMgMt/storeMgmtForm.js create mode 100644 client/AdminMgmt/StoreMgMt/storeMgmtTbl.html create mode 100644 client/AdminMgmt/StoreMgMt/storeMgmtTbl.js create mode 100644 client/MainLayout.js create mode 100644 imports/api/userConfigOptions.js diff --git a/.meteor/packages b/.meteor/packages index 3a2514f..8ca9ca0 100644 --- a/.meteor/packages +++ b/.meteor/packages @@ -30,4 +30,4 @@ raix:handlebar-helpers kadira:flow-router kadira:blaze-layout accounts-password@2.3.1 -# mizzao:autocomplete # for the @mentions functionality +# mizzao:autocomplete # for the @mentions functionality \ No newline at end of file diff --git a/client/Accounts/UserMgmt/userMgmt.js b/client/Accounts/UserMgmt/userMgmt.js index d773caa..7e02689 100644 --- a/client/Accounts/UserMgmt/userMgmt.js +++ b/client/Accounts/UserMgmt/userMgmt.js @@ -1,7 +1,7 @@ Template.userMgmt.onCreated(function() { - + this.subscribe("userList"); }); Template.userMgmt.onRendered(function() { diff --git a/client/AdminMgmt/CategoryMgMt/catMgmt.html b/client/AdminMgmt/CategoryMgMt/catMgmt.html new file mode 100644 index 0000000..dd86347 --- /dev/null +++ b/client/AdminMgmt/CategoryMgMt/catMgmt.html @@ -0,0 +1,6 @@ + \ No newline at end of file diff --git a/client/AdminMgmt/CategoryMgMt/catMgmt.js b/client/AdminMgmt/CategoryMgMt/catMgmt.js new file mode 100644 index 0000000..5db371f --- /dev/null +++ b/client/AdminMgmt/CategoryMgMt/catMgmt.js @@ -0,0 +1,17 @@ +import { Categories } from '../../../imports/api/category.js'; + +Template.catMgmt.onCreated(function() { + this.subscribe("myCategories"); +}); + +Template.catMgmt.onRendered(function() { + +}); + +Template.catMgmt.helpers({ + +}); + +Template.catMgmt.events({ + +}); \ No newline at end of file diff --git a/client/AdminMgmt/CategoryMgMt/catMgmtForm.html b/client/AdminMgmt/CategoryMgMt/catMgmtForm.html new file mode 100644 index 0000000..df5eb53 --- /dev/null +++ b/client/AdminMgmt/CategoryMgMt/catMgmtForm.html @@ -0,0 +1,16 @@ + \ No newline at end of file diff --git a/client/AdminMgmt/CategoryMgMt/catMgmtForm.js b/client/AdminMgmt/CategoryMgMt/catMgmtForm.js new file mode 100644 index 0000000..17a31de --- /dev/null +++ b/client/AdminMgmt/CategoryMgMt/catMgmtForm.js @@ -0,0 +1,39 @@ +import { Categories } from '../../../imports/api/category.js'; + +Template.catMgmtForm.onCreated(function() { + this.subscribe("myCategories"); +}); + +Template.catMgmtForm.onRendered(function() { + Session.set("catNameMiss", false); +}); + +Template.catMgmtForm.helpers({ + catNameErr: function() { + return Session.get("catNameMiss"); + }, +}); + +Template.catMgmtForm.events({ + 'click .saveCatMgmt' (event) { + event.preventDefault(); + let catName = $("#catNameInp").val(); + if (catName == null || catName == "") { + Session.set("catNameMiss", true); + return; + } else { + Meteor.call('add.category', catName, function(err, result) { + if (err) { + // console.log(" ERROR: Can't add category: " + err); + } else { + // console.log(" SUCCESS adding category."); + $("#catNameInp").val(""); + } + }); + } + }, + 'click .cancelCatMgmt' (event) { + event.preventDefault(); + $("#catNameInp").val(""); + } +}); \ No newline at end of file diff --git a/client/AdminMgmt/CategoryMgMt/catMgmtTbl.html b/client/AdminMgmt/CategoryMgMt/catMgmtTbl.html new file mode 100644 index 0000000..cd65384 --- /dev/null +++ b/client/AdminMgmt/CategoryMgMt/catMgmtTbl.html @@ -0,0 +1,21 @@ + \ No newline at end of file diff --git a/client/AdminMgmt/CategoryMgMt/catMgmtTbl.js b/client/AdminMgmt/CategoryMgMt/catMgmtTbl.js new file mode 100644 index 0000000..57982ed --- /dev/null +++ b/client/AdminMgmt/CategoryMgMt/catMgmtTbl.js @@ -0,0 +1,19 @@ +import { Categories } from '../../../imports/api/category.js'; + +Template.catMgmtTbl.onCreated(function() { + this.subscribe("myCategories"); +}); + +Template.catMgmtTbl.onRendered(function() { + +}); + +Template.catMgmtTbl.helpers({ + cats: function() { + return Categories.find({}); + } +}); + +Template.catMgmtTbl.events({ + +}); \ No newline at end of file diff --git a/client/AdminMgmt/LocationMgmt/locMgmt.html b/client/AdminMgmt/LocationMgmt/locMgmt.html new file mode 100644 index 0000000..8194b3c --- /dev/null +++ b/client/AdminMgmt/LocationMgmt/locMgmt.html @@ -0,0 +1,5 @@ + \ No newline at end of file diff --git a/client/AdminMgmt/LocationMgmt/locMgmt.js b/client/AdminMgmt/LocationMgmt/locMgmt.js new file mode 100644 index 0000000..c658703 --- /dev/null +++ b/client/AdminMgmt/LocationMgmt/locMgmt.js @@ -0,0 +1,15 @@ +Template.locMgmt.onCreated(function() { + +}); + +Template.locMgmt.onRendered(function() { + +}); + +Template.locMgmt.helpers({ + +}); + +Template.locMgmt.events({ + +}); \ No newline at end of file diff --git a/client/AdminMgmt/LocationMgmt/locMgmtForm.html b/client/AdminMgmt/LocationMgmt/locMgmtForm.html new file mode 100644 index 0000000..9febef8 --- /dev/null +++ b/client/AdminMgmt/LocationMgmt/locMgmtForm.html @@ -0,0 +1,16 @@ + \ No newline at end of file diff --git a/client/AdminMgmt/LocationMgmt/locMgmtForm.js b/client/AdminMgmt/LocationMgmt/locMgmtForm.js new file mode 100644 index 0000000..f6aff83 --- /dev/null +++ b/client/AdminMgmt/LocationMgmt/locMgmtForm.js @@ -0,0 +1,39 @@ +import { Locations } from '../../../imports/api/location.js'; + +Template.locMgmtForm.onCreated(function() { + this.subscribe("myLocations"); +}); + +Template.locMgmtForm.onRendered(function() { + Session.set("locNameMiss", false); +}); + +Template.locMgmtForm.helpers({ + locNameErr: function() { + return Session.get("locNameMiss"); + }, +}); + +Template.locMgmtForm.events({ + 'click .saveLocMgmt' (event) { + event.preventDefault(); + let locName = $("#locNameInp").val(); + if (locName == null || locName == "") { + Session.set("locNameMiss", true); + return; + } else { + Meteor.call('add.location', locName, function(err, result) { + if (err) { + // console.log(" ERROR: Can't add category: " + err); + } else { + // console.log(" SUCCESS adding category."); + $("#locNameInp").val(""); + } + }); + } + }, + 'click .cancelLocMgmt' (event) { + event.preventDefault(); + $("#locNameInp").val(""); + } +}); \ No newline at end of file diff --git a/client/AdminMgmt/LocationMgmt/locMgmtTbl.html b/client/AdminMgmt/LocationMgmt/locMgmtTbl.html new file mode 100644 index 0000000..6f3924c --- /dev/null +++ b/client/AdminMgmt/LocationMgmt/locMgmtTbl.html @@ -0,0 +1,21 @@ + \ No newline at end of file diff --git a/client/AdminMgmt/LocationMgmt/locMgmtTbl.js b/client/AdminMgmt/LocationMgmt/locMgmtTbl.js new file mode 100644 index 0000000..e7328a1 --- /dev/null +++ b/client/AdminMgmt/LocationMgmt/locMgmtTbl.js @@ -0,0 +1,19 @@ +import { Locations } from '../../../imports/api/location.js'; + +Template.locMgmtTbl.onCreated(function() { + this.subscribe("myLocations"); +}); + +Template.locMgmtTbl.onRendered(function() { + +}); + +Template.locMgmtTbl.helpers({ + locs: function() { + return Locations.find({}); + } +}); + +Template.locMgmtTbl.events([ + +]); \ No newline at end of file diff --git a/client/AdminMgmt/MgmtPage/mgmtPage.html b/client/AdminMgmt/MgmtPage/mgmtPage.html new file mode 100644 index 0000000..0bf42f8 --- /dev/null +++ b/client/AdminMgmt/MgmtPage/mgmtPage.html @@ -0,0 +1,20 @@ + \ No newline at end of file diff --git a/client/AdminMgmt/MgmtPage/mgmtPage.js b/client/AdminMgmt/MgmtPage/mgmtPage.js new file mode 100644 index 0000000..162c17b --- /dev/null +++ b/client/AdminMgmt/MgmtPage/mgmtPage.js @@ -0,0 +1,21 @@ + +Template.mgmtPage.onCreated(function() { + +}); + +Template.mgmtPage.onRendered(function() { + +}); + +Template.mgmtPage.helpers ({ + +}); + +Template.mgmtPage.events ({ + 'click .collection-item' (event) { + event.preventDefault(); + var clickedTarget = event.target.id; + // console.log("should be going to /" + clickedTarget); + FlowRouter.go('/' + clickedTarget); + }, +}); \ No newline at end of file diff --git a/client/AdminMgmt/ProductMgmt/prodMgmt.html b/client/AdminMgmt/ProductMgmt/prodMgmt.html new file mode 100644 index 0000000..c4b4685 --- /dev/null +++ b/client/AdminMgmt/ProductMgmt/prodMgmt.html @@ -0,0 +1,5 @@ + \ No newline at end of file diff --git a/client/AdminMgmt/ProductMgmt/prodMgmt.js b/client/AdminMgmt/ProductMgmt/prodMgmt.js new file mode 100644 index 0000000..7e127b1 --- /dev/null +++ b/client/AdminMgmt/ProductMgmt/prodMgmt.js @@ -0,0 +1,17 @@ +import { Products } from '../../../imports/api/products.js'; + +Template.prodMgmt.onCreated(function() { + this.subscribe("myProducts"); +}); + +Template.prodMgmt.onRendered(function() { + +}); + +Template.prodMgmt.helpers({ + +}); + +Template.prodMgmt.events({ + +}); \ No newline at end of file diff --git a/client/AdminMgmt/ProductMgmt/prodMgmtForm.html b/client/AdminMgmt/ProductMgmt/prodMgmtForm.html new file mode 100644 index 0000000..83d9d63 --- /dev/null +++ b/client/AdminMgmt/ProductMgmt/prodMgmtForm.html @@ -0,0 +1,59 @@ + \ No newline at end of file diff --git a/client/AdminMgmt/ProductMgmt/prodMgmtForm.js b/client/AdminMgmt/ProductMgmt/prodMgmtForm.js new file mode 100644 index 0000000..bd28377 --- /dev/null +++ b/client/AdminMgmt/ProductMgmt/prodMgmtForm.js @@ -0,0 +1,107 @@ +import { Products } from '../../../imports/api/products.js'; +import { Stores } from '../../../imports/api/stores.js'; +import { Categories } from '../../../imports/api/category.js'; +import { Locations } from '../../../imports/api/location.js'; + +Template.prodMgmtForm.onCreated(function() { + this.subscribe("myProducts"); + this.subscribe("storeInfo"); + this.subscribe("myCategories"); + this.subscribe("myLocations"); +}); + +Template.prodMgmtForm.onRendered(function() { + Meteor.setTimeout(function() { + $('select').formSelect(); + }, 200); + $('select').formSelect(); + $('.modal').modal(); +}); + +Template.prodMgmtForm.helpers({ + stores: function() { + return Stores.find({}); + }, + prodNameErr: function() { + return Session.get("prodNameRed"); + }, + category: function() { + return Categories.find({}); + }, + locations: function() { + return Locations.find({}); + }, +}); + +Template.prodMgmtForm.events({ + 'click .saveProdMgmt' (event) { + event.preventDefault(); + let name=$("#prodName").val(); + let cat = $("#prodCategory").val(); + let store = $("#prodStore").val(); + let location = $("#prodLocation").val(); + + if (cat == null) { + cat = ""; + } + + if (location == null) { + location = ""; + } + + if (store == null) { + store = ""; + } + + if (name == "" || name == null) { + Session.set("prodNameRed", true); + return; + } else { + Meteor.call('add.product', name, cat, store, location, function(err, result) { + if (err) { + // console.log(" ERROR: can't add product: " + err); + } else { + // console.log(" SUCCESS adding product."); + } + }); + } + }, + 'click .cancelProdMgmt' (event) { + event.preventDefault(); + $("#prodName").val(""); + $("#prodCategory").val(""); + $("#prodStore").val(""); + $("#prodLocation").val("") + }, + 'change #prodStore' (event) { + event.preventDefault(); + let val = $("#prodStore").val(); + + if (val == "addNewStore") { + $("#prodStore").val(""); + // open a modal to enter store information. + $('#modalStore').modal('open'); + + } + }, + 'change #prodLocation' (event) { + event.preventDefault(); + let val = $("#prodLocation").val(); + + if (val == "addNewLocation") { + $("#prodLocation").val(""); + // open a modal to enter store information. + $('#modalLocation').modal('open'); + } + }, + 'change #prodCategory' (event) { + event.preventDefault(); + let val = $("#prodCategory").val(); + + if (val == "addNewCategory") { + $("#prodCategory").val(""); + // open a modal to enter store information. + $('#modalCategory').modal('open'); + } + }, +}); \ No newline at end of file diff --git a/client/AdminMgmt/ProductMgmt/prodMgmtTbl.html b/client/AdminMgmt/ProductMgmt/prodMgmtTbl.html new file mode 100644 index 0000000..42bb906 --- /dev/null +++ b/client/AdminMgmt/ProductMgmt/prodMgmtTbl.html @@ -0,0 +1,31 @@ + \ No newline at end of file diff --git a/client/AdminMgmt/ProductMgmt/prodMgmtTbl.js b/client/AdminMgmt/ProductMgmt/prodMgmtTbl.js new file mode 100644 index 0000000..efa748c --- /dev/null +++ b/client/AdminMgmt/ProductMgmt/prodMgmtTbl.js @@ -0,0 +1,19 @@ +import { Products } from '../../../imports/api/products.js'; + +Template.prodMgmtTbl.onCreated(function() { + this.subscribe("myProducts"); +}); + +Template.prodMgmtTbl.onRendered(function() { + +}); + +Template.prodMgmtTbl.helpers({ + products: function() { + return Products.find({}); + }, +}); + +Template.prodMgmtTbl.events({ + +}); \ No newline at end of file diff --git a/client/AdminMgmt/StoreMgMt/storeMgmt.html b/client/AdminMgmt/StoreMgMt/storeMgmt.html new file mode 100644 index 0000000..c2b5aa1 --- /dev/null +++ b/client/AdminMgmt/StoreMgMt/storeMgmt.html @@ -0,0 +1,11 @@ + \ No newline at end of file diff --git a/client/AdminMgmt/StoreMgMt/storeMgmt.js b/client/AdminMgmt/StoreMgMt/storeMgmt.js new file mode 100644 index 0000000..6dd2a05 --- /dev/null +++ b/client/AdminMgmt/StoreMgMt/storeMgmt.js @@ -0,0 +1,17 @@ +import { Stores } from '../../../imports/api/stores'; + +Template.storeMgmt.onCreated(function() { + +}); + +Template.storeMgmt.onRendered(function() { + +}); + +Template.storeMgmt.helpers({ + +}); + +Template.storeMgmt.events({ + +}); \ No newline at end of file diff --git a/client/AdminMgmt/StoreMgMt/storeMgmtForm.html b/client/AdminMgmt/StoreMgMt/storeMgmtForm.html new file mode 100644 index 0000000..b3804cf --- /dev/null +++ b/client/AdminMgmt/StoreMgMt/storeMgmtForm.html @@ -0,0 +1,20 @@ + \ No newline at end of file diff --git a/client/AdminMgmt/StoreMgMt/storeMgmtForm.js b/client/AdminMgmt/StoreMgMt/storeMgmtForm.js new file mode 100644 index 0000000..c9cbea0 --- /dev/null +++ b/client/AdminMgmt/StoreMgMt/storeMgmtForm.js @@ -0,0 +1,35 @@ +import { Stores } from '../../../imports/api/stores'; + +Template.storeMgmtForm.onCreated(function() { + this.subscribe("storeInfo"); +}); + +Template.storeMgmtForm.onRendered(function() { + Session.set("borderRed", false); +}); + +Template.storeMgmtForm.helpers({ + +}); + +Template.storeMgmtForm.events({ + 'click .saveStoreMgmt' (event) { + event.preventDefault(); + let storeName = $("#storeName").val(); + let storeType = $("#storeType").val(); + if (storeName == "" || storeName == null) { + Session.set("borderRed", true); + return; + } else { + Meteor.call("add.store", storeName, storeType, function(err, result) { + if (err) { + // console.log("ERROR: Store add failed: " + err); + } else { + // console.log("Success adding store!"); + $("#storeName").val(""); + $("#storeType").val(""); + } + }); + } + } +}); \ No newline at end of file diff --git a/client/AdminMgmt/StoreMgMt/storeMgmtTbl.html b/client/AdminMgmt/StoreMgMt/storeMgmtTbl.html new file mode 100644 index 0000000..3a0daad --- /dev/null +++ b/client/AdminMgmt/StoreMgMt/storeMgmtTbl.html @@ -0,0 +1,27 @@ + \ No newline at end of file diff --git a/client/AdminMgmt/StoreMgMt/storeMgmtTbl.js b/client/AdminMgmt/StoreMgMt/storeMgmtTbl.js new file mode 100644 index 0000000..0622b3f --- /dev/null +++ b/client/AdminMgmt/StoreMgMt/storeMgmtTbl.js @@ -0,0 +1,26 @@ +import { Stores } from '../../../imports/api/stores'; + +Template.storeMgmtTbl.onCreated(function() { + this.subscribe("storeInfo"); +}); + +Template.storeMgmtTbl.onRendered(function() { + +}); + +Template.storeMgmtTbl.helpers({ + mgmtStoreInfo: function() { + return Stores.find({}); + }, +}); + +Template.storeMgmtTbl.events({ + 'click .deleteStore' (event) { + event.preventDefault(); + // console.log("Delete Store Clicked"); + }, + 'click .editStore' (event) { + event.preventDefault(); + // console.log("Edit Store Clicked"); + }, +}); \ No newline at end of file diff --git a/client/Dashboard/dashboard.js b/client/Dashboard/dashboard.js index b0ab05f..f699886 100644 --- a/client/Dashboard/dashboard.js +++ b/client/Dashboard/dashboard.js @@ -1,7 +1,7 @@ Template.dashboard.onCreated(function() { - + this.subscribe("userList"); }); Template.dashboard.onRendered(function() { diff --git a/client/General/headerBar.html b/client/General/headerBar.html index 767ce13..3c9a950 100644 --- a/client/General/headerBar.html +++ b/client/General/headerBar.html @@ -1,28 +1,16 @@