mirror of
https://gitlab.com/bmcgonag/get_my.git
synced 2026-03-27 00:08:49 +00:00
Updating framework to meteor 3 and later
This commit is contained in:
parent
717994508a
commit
cca29bc591
58 changed files with 2332 additions and 1611 deletions
|
|
@ -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");
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue