mirror of
https://gitlab.com/bmcgonag/get_my.git
synced 2026-03-27 00:08:49 +00:00
Updated to filter Products when no store is assigned.
This commit is contained in:
parent
d0398ddc32
commit
a7a9c48e01
5 changed files with 31 additions and 10 deletions
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue