Fixing clean Up and added option to show which products arent used in a list

This commit is contained in:
Brian McGonagill 2025-08-09 07:21:46 -05:00
parent c6c5951d16
commit 680f7c614d
6 changed files with 71 additions and 10 deletions

View file

@ -29,7 +29,7 @@ Template.cleanUpModalConfirm.events({
case "Menus":
cleanUp("clean.Menus", whatItems);
case "Products":
// cleanUp("clean.Products", whatItems);
cleanUp("clean.Products", whatItems);
case "Stores":
// cleanUp("clean.Stores", whatItems);
case "Tasks":
@ -43,7 +43,7 @@ Template.cleanUpModalConfirm.events({
cleanUp = async function(methodName, whatItems) {
let result = Meteor.callAsync(methodName);
if (!result) {
console.log(" ERROR cleaning " + whatItems + ": " + err);
console.log(" ERROR cleaning " + whatItems);
} else {
showSnackbar(whatItems + " have been cleaned up!", "green");
let confirmModal = document.getElementById('cleanUpConfirm');
@ -51,6 +51,15 @@ cleanUp = async function(methodName, whatItems) {
}
}
cleanProducts = async function(methodName, whatItems) {
let result = await Meteor.call(methodName, whatItems);
if (!result) {
console.log(" ERROR cleaning " + whatItems);
} else {
showSnackbar(whatItems + " have been cleaned up.", "green");
}
}
cleanTasks = async function(methodName, whatItems) {
let timeFrame = Session.get("overdueVal");
let result = await Meteor.call(methodName, timeFrame);