Updating framework to meteor 3 and later

This commit is contained in:
Brian McGonagill 2025-06-21 07:28:59 -05:00
parent 717994508a
commit cca29bc591
58 changed files with 2332 additions and 1611 deletions

View file

@ -35,36 +35,19 @@ Template.prodMgmtForm.events({
'click .saveProdMgmt, click .editProdMgmt' (event) {
let name = $("#prodName").val();
let store = $("#prodStore").val();
let prodId = Session.get("prodEditId");
let prodEditMode = Session.get("prodEditMode");
if (store == null) {
store = "";
}
if (name == "" || name == null) {
Session.set("prodNameRed", true);
return;
} else {
if (prodEditMode == true) {
Meteor.call('edit.product', prodId, name, store, function(err, result) {
if (err) {
console.log(" ERROR: can't add product: " + err);
} else {
$("#prodName").val("");
showSnackbar("Successfully Edited Product!", "green");
}
});
editProd(prodId, name, store);
} else {
Meteor.call('add.product', name, store, function(err, result) {
if (err) {
console.log(" ERROR: can't add product: " + err);
} else {
$("#prodName").val("");
showSnackbar("Product Added Succssfully!", "green");
}
});
newProd(name, store);
}
}
},
@ -76,5 +59,33 @@ Template.prodMgmtForm.events({
} else {
Session.set("noStoreSet", false);
}
}
},
'submit .prodInputForm' (event) {
},
});
const newProd = async(name, store) => {
let result = await Meteor.callAsync('add.product', name, store);
try {
if (!result) {
console.log("No result when trying to add a new product.");
showSnackbar("Unable to add new product.");
} else {
$("#prodName").val("");
showSnackbar("New Product Added!", "green");
}
} catch(error) {
console.log(" ERROR - couldn't add product: " + error);
}
}
const editProd = async(prodId, name, store) => {
let result = await Meteor.callAsync('edit.product', prodId, name, store);
if (!result) {
console.log(" ERROR: can't add product: " + err);
} else {
$("#prodName").val("");
showSnackbar("Successfully Edited Product!", "green");
}
}