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
|
|
@ -48,6 +48,7 @@ Template.listItemsForm.helpers({
|
|||
}
|
||||
},
|
||||
itemProdName: function() {
|
||||
|
||||
return Products.find({});
|
||||
},
|
||||
editMode: function() {
|
||||
|
|
@ -66,14 +67,7 @@ Template.listItemsForm.events({
|
|||
if (item == null || item == "") {
|
||||
Session.set("itemReqErr", true);
|
||||
} else {
|
||||
Meteor.call("add.listItem", item, listId, function(err, result) {
|
||||
if (err) {
|
||||
console.log(" ERROR adding item to list: " + err);
|
||||
} else {
|
||||
console.log(" SUCCESS adding item to list.");
|
||||
$("#findListItems").val("");
|
||||
}
|
||||
});
|
||||
addItem(item, listId);
|
||||
}
|
||||
},
|
||||
'keydown #findListItems' (event) {
|
||||
|
|
@ -83,14 +77,7 @@ Template.listItemsForm.events({
|
|||
if (item == null || item == "") {
|
||||
Session.set("itemReqErr", true);
|
||||
} else {
|
||||
Meteor.call("add.listItem", item, listId, function(err, result) {
|
||||
if (err) {
|
||||
console.log(" ERROR adding item to list: " + err);
|
||||
} else {
|
||||
console.log(" SUCCESS adding item to list.");
|
||||
$("#findListItems").val("");
|
||||
}
|
||||
});
|
||||
addItem(item, listId);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
@ -110,8 +97,11 @@ Template.listItemsForm.events({
|
|||
'keyup #findListItems' (event) {
|
||||
if (event.which !== 13) {
|
||||
let findItemVal = $("#findListItems").val();
|
||||
// console.log(findItemVal);
|
||||
let listItemInfo = Products.find({ prodName: {$regex: findItemVal + '.*', $options: 'i'}}).fetch();
|
||||
if (typeof listItemInfo != 'undefined' && listItemInfo != "" && listItemInfo != null) {
|
||||
if (!listItemInfo) {
|
||||
console.log("No data for key input.");
|
||||
} else {
|
||||
getDataList(listItemInfo);
|
||||
}
|
||||
}
|
||||
|
|
@ -128,7 +118,21 @@ Template.listItemsForm.events({
|
|||
});
|
||||
|
||||
getDataList = function(listItemInfo) {
|
||||
// console.log(listItemInfo);
|
||||
let listItemObjArray = [];
|
||||
listItemObjArray = listItemInfo.map(info => ({ id: info._id, text: info.prodName, store: info.prodStore }))
|
||||
Session.set("findListItems", listItemObjArray);
|
||||
}
|
||||
|
||||
const addItem = async(item, listId) => {
|
||||
let result = await Meteor.callAsync("add.listItem", item, listId);
|
||||
try {
|
||||
if (!result) {
|
||||
console.log(" ISSUE adding list item. See logs.");
|
||||
} else {
|
||||
$("#findListItems").val("");
|
||||
}
|
||||
} catch(error) {
|
||||
console.log(" ERROR adding list item: " + error);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue