From a7a9c48e017fb2752ba555e49751eb2fc572f482 Mon Sep 17 00:00:00 2001 From: Brian McGonagill Date: Fri, 9 Aug 2024 12:03:49 -0500 Subject: [PATCH] Updated to filter Products when no store is assigned. --- client/AdminMgmt/ProductMgmt/prodMgmtForm.html | 10 +++++++++- client/AdminMgmt/ProductMgmt/prodMgmtForm.js | 11 ++++++++++- client/AdminMgmt/ProductMgmt/prodMgmtTbl.js | 6 +++++- server/main.js | 8 ++++---- server/methods.js | 6 +++--- 5 files changed, 31 insertions(+), 10 deletions(-) diff --git a/client/AdminMgmt/ProductMgmt/prodMgmtForm.html b/client/AdminMgmt/ProductMgmt/prodMgmtForm.html index 42b686e..fb1be33 100644 --- a/client/AdminMgmt/ProductMgmt/prodMgmtForm.html +++ b/client/AdminMgmt/ProductMgmt/prodMgmtForm.html @@ -2,6 +2,14 @@

Product Management

{{#if Template.subscriptionsReady}}
+
+

+ +

+
@@ -37,4 +45,4 @@
{{> snackbar}} - \ No newline at end of file + diff --git a/client/AdminMgmt/ProductMgmt/prodMgmtForm.js b/client/AdminMgmt/ProductMgmt/prodMgmtForm.js index 0d826b4..6f096bb 100644 --- a/client/AdminMgmt/ProductMgmt/prodMgmtForm.js +++ b/client/AdminMgmt/ProductMgmt/prodMgmtForm.js @@ -136,4 +136,13 @@ Template.prodMgmtForm.events({ storeModal.open(); } }, -}); \ No newline at end of file + 'click #showNoStoreSet' (event) { + let noStoreSet = $("#showNoStoreSet").prop('checked'); + console.log("Clicked: " + noStoreSet); + if (noStoreSet == true) { + Session.set("noStoreSet", true); + } else { + Session.set("noStoreSet", false); + } + } +}); diff --git a/client/AdminMgmt/ProductMgmt/prodMgmtTbl.js b/client/AdminMgmt/ProductMgmt/prodMgmtTbl.js index 1c98c8c..8f4b4cc 100644 --- a/client/AdminMgmt/ProductMgmt/prodMgmtTbl.js +++ b/client/AdminMgmt/ProductMgmt/prodMgmtTbl.js @@ -8,12 +8,14 @@ Template.prodMgmtTbl.onCreated(function() { Template.prodMgmtTbl.onRendered(function() { Session.set("searchProds", false); Session.set("searchStore", false); + Session.set("noStoreSet", false); }); Template.prodMgmtTbl.helpers({ products: function() { let searchProd = Session.get("searchProds"); let searchStore = Session.get("searchStore"); + let noStoreSet = Session.get("noStoreSet"); if (searchProd == true) { let searchVal = Session.get("searchVal"); @@ -29,6 +31,8 @@ Template.prodMgmtTbl.helpers({ } else { return Products.find({ prodStore: { $regex: searchVal + '.*', $options: 'i' } }); } + } else if (noStoreSet == true) { + return Products.find({ prodStore: '' }); } else { return Products.find({}); } @@ -86,4 +90,4 @@ Template.prodMgmtTbl.events({ Session.set("searchStoreVal", searchVal); } } -}); \ No newline at end of file +}); diff --git a/server/main.js b/server/main.js index 524eb75..ce57672 100644 --- a/server/main.js +++ b/server/main.js @@ -17,15 +17,15 @@ Meteor.startup(() => { allowReg: true, }); } else { - console.log("Registration policy already set."); + // console.log("Registration policy already set."); } // check if the isLInked item exists on menuitems, and if not, add it (data cleanup task) let itemInfoNoLink = MenuItems.find({ isLinked: { $exists: false } }).fetch(); console.log("No Ites with isLinked not set: " + itemInfoNoLink.length); if (itemInfoNoLink.length > 0) { - console.log("found items with isLinked not set."); - console.dir(itemInfoNoLink); + // console.log("found items with isLinked not set."); + // console.dir(itemInfoNoLink); let infoLength = itemInfoNoLink.length; for (i=0; i < infoLength; i++) { MenuItems.update({ _id: itemInfoNoLink[i]._id }, { @@ -36,7 +36,7 @@ Meteor.startup(() => { } } else { // this will show if all items are found to have isLInked set. - console.log("No itesm with isLinked not set."); + // console.log("No itesm with isLinked not set."); } }); diff --git a/server/methods.js b/server/methods.js index d695cf1..ecb0347 100644 --- a/server/methods.js +++ b/server/methods.js @@ -16,7 +16,7 @@ Meteor.methods({ if (err) { console.log(" ERROR: can't set user dark mode preference: " + err); } else { - console.log(" SUCCESSFULLY set user dark mode preference."); + // console.log(" SUCCESSFULLY set user dark mode preference."); } }); } else if (countOfUsers == 1) { @@ -27,7 +27,7 @@ Meteor.methods({ if (err) { console.log(" ERROR: can't set user dark mode preference: " + err); } else { - console.log(" SUCCESSFULLY set user dark mode preference."); + // console.log(" SUCCESSFULLY set user dark mode preference."); } }); } @@ -59,4 +59,4 @@ Meteor.methods({ return Roles.setUserRoles(userId, role); }, -}); \ No newline at end of file +});