Added filtering option to Lists and Products views.

This commit is contained in:
Brian McGonagill 2022-08-25 15:39:27 -05:00
parent 0768e707b8
commit 7641b17e6f
6 changed files with 208 additions and 20 deletions

111
.gitignore vendored Normal file
View file

@ -0,0 +1,111 @@
node_modules/@babel/runtime/.meteor-portable-2.json
node_modules/@babel/runtime/helpers/esm/.meteor-portable-2.json
node_modules/jquery/.meteor-portable-2.json
node_modules/meteor-node-stubs/.meteor-portable-2.json
node_modules/meteor-node-stubs/node_modules/asn1.js/.meteor-portable-2.json
node_modules/meteor-node-stubs/node_modules/asn1.js/node_modules/bn.js/.meteor-portable-2.json
node_modules/meteor-node-stubs/node_modules/assert/.meteor-portable-2.json
node_modules/meteor-node-stubs/node_modules/available-typed-arrays/.meteor-portable-2.json
node_modules/meteor-node-stubs/node_modules/base64-js/.meteor-portable-2.json
node_modules/meteor-node-stubs/node_modules/bn.js/.meteor-portable-2.json
node_modules/meteor-node-stubs/node_modules/brorand/.meteor-portable-2.json
node_modules/meteor-node-stubs/node_modules/browserify-aes/.meteor-portable-2.json
node_modules/meteor-node-stubs/node_modules/browserify-cipher/.meteor-portable-2.json
node_modules/meteor-node-stubs/node_modules/browserify-des/.meteor-portable-2.json
node_modules/meteor-node-stubs/node_modules/browserify-rsa/.meteor-portable-2.json
node_modules/meteor-node-stubs/node_modules/browserify-sign/.meteor-portable-2.json
node_modules/meteor-node-stubs/node_modules/browserify-zlib/.meteor-portable-2.json
node_modules/meteor-node-stubs/node_modules/buffer/.meteor-portable-2.json
node_modules/meteor-node-stubs/node_modules/buffer-xor/.meteor-portable-2.json
node_modules/meteor-node-stubs/node_modules/builtin-status-codes/.meteor-portable-2.json
node_modules/meteor-node-stubs/node_modules/call-bind/.meteor-portable-2.json
node_modules/meteor-node-stubs/node_modules/cipher-base/.meteor-portable-2.json
node_modules/meteor-node-stubs/node_modules/console-browserify/.meteor-portable-2.json
node_modules/meteor-node-stubs/node_modules/constants-browserify/.meteor-portable-2.json
node_modules/meteor-node-stubs/node_modules/create-ecdh/.meteor-portable-2.json
node_modules/meteor-node-stubs/node_modules/create-ecdh/node_modules/bn.js/.meteor-portable-2.json
node_modules/meteor-node-stubs/node_modules/create-hash/.meteor-portable-2.json
node_modules/meteor-node-stubs/node_modules/create-hmac/.meteor-portable-2.json
node_modules/meteor-node-stubs/node_modules/crypto-browserify/.meteor-portable-2.json
node_modules/meteor-node-stubs/node_modules/define-properties/.meteor-portable-2.json
node_modules/meteor-node-stubs/node_modules/des.js/.meteor-portable-2.json
node_modules/meteor-node-stubs/node_modules/diffie-hellman/.meteor-portable-2.json
node_modules/meteor-node-stubs/node_modules/diffie-hellman/node_modules/bn.js/.meteor-portable-2.json
node_modules/meteor-node-stubs/node_modules/domain-browser/.meteor-portable-2.json
node_modules/meteor-node-stubs/node_modules/elliptic/.meteor-portable-2.json
node_modules/meteor-node-stubs/node_modules/elliptic/node_modules/bn.js/.meteor-portable-2.json
node_modules/meteor-node-stubs/node_modules/es-abstract/.meteor-portable-2.json
node_modules/meteor-node-stubs/node_modules/es-to-primitive/.meteor-portable-2.json
node_modules/meteor-node-stubs/node_modules/es6-object-assign/.meteor-portable-2.json
node_modules/meteor-node-stubs/node_modules/events/.meteor-portable-2.json
node_modules/meteor-node-stubs/node_modules/evp_bytestokey/.meteor-portable-2.json
node_modules/meteor-node-stubs/node_modules/foreach/.meteor-portable-2.json
node_modules/meteor-node-stubs/node_modules/function-bind/.meteor-portable-2.json
node_modules/meteor-node-stubs/node_modules/get-intrinsic/.meteor-portable-2.json
node_modules/meteor-node-stubs/node_modules/has/.meteor-portable-2.json
node_modules/meteor-node-stubs/node_modules/has-bigints/.meteor-portable-2.json
node_modules/meteor-node-stubs/node_modules/has-symbols/.meteor-portable-2.json
node_modules/meteor-node-stubs/node_modules/hash-base/.meteor-portable-2.json
node_modules/meteor-node-stubs/node_modules/hash.js/.meteor-portable-2.json
node_modules/meteor-node-stubs/node_modules/hmac-drbg/.meteor-portable-2.json
node_modules/meteor-node-stubs/node_modules/https-browserify/.meteor-portable-2.json
node_modules/meteor-node-stubs/node_modules/ieee754/.meteor-portable-2.json
node_modules/meteor-node-stubs/node_modules/inherits/.meteor-portable-2.json
node_modules/meteor-node-stubs/node_modules/is-arguments/.meteor-portable-2.json
node_modules/meteor-node-stubs/node_modules/is-bigint/.meteor-portable-2.json
node_modules/meteor-node-stubs/node_modules/is-boolean-object/.meteor-portable-2.json
node_modules/meteor-node-stubs/node_modules/is-callable/.meteor-portable-2.json
node_modules/meteor-node-stubs/node_modules/is-date-object/.meteor-portable-2.json
node_modules/meteor-node-stubs/node_modules/is-generator-function/.meteor-portable-2.json
node_modules/meteor-node-stubs/node_modules/is-nan/.meteor-portable-2.json
node_modules/meteor-node-stubs/node_modules/is-negative-zero/.meteor-portable-2.json
node_modules/meteor-node-stubs/node_modules/is-number-object/.meteor-portable-2.json
node_modules/meteor-node-stubs/node_modules/is-regex/.meteor-portable-2.json
node_modules/meteor-node-stubs/node_modules/is-string/.meteor-portable-2.json
node_modules/meteor-node-stubs/node_modules/is-symbol/.meteor-portable-2.json
node_modules/meteor-node-stubs/node_modules/is-typed-array/.meteor-portable-2.json
node_modules/meteor-node-stubs/node_modules/md5.js/.meteor-portable-2.json
node_modules/meteor-node-stubs/node_modules/miller-rabin/.meteor-portable-2.json
node_modules/meteor-node-stubs/node_modules/miller-rabin/node_modules/bn.js/.meteor-portable-2.json
node_modules/meteor-node-stubs/node_modules/minimalistic-assert/.meteor-portable-2.json
node_modules/meteor-node-stubs/node_modules/minimalistic-crypto-utils/.meteor-portable-2.json
node_modules/meteor-node-stubs/node_modules/object-inspect/.meteor-portable-2.json
node_modules/meteor-node-stubs/node_modules/object-is/.meteor-portable-2.json
node_modules/meteor-node-stubs/node_modules/object-keys/.meteor-portable-2.json
node_modules/meteor-node-stubs/node_modules/object.assign/.meteor-portable-2.json
node_modules/meteor-node-stubs/node_modules/os-browserify/.meteor-portable-2.json
node_modules/meteor-node-stubs/node_modules/pako/.meteor-portable-2.json
node_modules/meteor-node-stubs/node_modules/parse-asn1/.meteor-portable-2.json
node_modules/meteor-node-stubs/node_modules/path-browserify/.meteor-portable-2.json
node_modules/meteor-node-stubs/node_modules/pbkdf2/.meteor-portable-2.json
node_modules/meteor-node-stubs/node_modules/process/.meteor-portable-2.json
node_modules/meteor-node-stubs/node_modules/public-encrypt/.meteor-portable-2.json
node_modules/meteor-node-stubs/node_modules/public-encrypt/node_modules/bn.js/.meteor-portable-2.json
node_modules/meteor-node-stubs/node_modules/punycode/.meteor-portable-2.json
node_modules/meteor-node-stubs/node_modules/querystring/.meteor-portable-2.json
node_modules/meteor-node-stubs/node_modules/querystring-es3/.meteor-portable-2.json
node_modules/meteor-node-stubs/node_modules/randombytes/.meteor-portable-2.json
node_modules/meteor-node-stubs/node_modules/randomfill/.meteor-portable-2.json
node_modules/meteor-node-stubs/node_modules/readable-stream/.meteor-portable-2.json
node_modules/meteor-node-stubs/node_modules/ripemd160/.meteor-portable-2.json
node_modules/meteor-node-stubs/node_modules/safe-buffer/.meteor-portable-2.json
node_modules/meteor-node-stubs/node_modules/safer-buffer/.meteor-portable-2.json
node_modules/meteor-node-stubs/node_modules/setimmediate/.meteor-portable-2.json
node_modules/meteor-node-stubs/node_modules/sha.js/.meteor-portable-2.json
node_modules/meteor-node-stubs/node_modules/stream-browserify/.meteor-portable-2.json
node_modules/meteor-node-stubs/node_modules/stream-http/.meteor-portable-2.json
node_modules/meteor-node-stubs/node_modules/string.prototype.trimend/.meteor-portable-2.json
node_modules/meteor-node-stubs/node_modules/string.prototype.trimstart/.meteor-portable-2.json
node_modules/meteor-node-stubs/node_modules/string_decoder/.meteor-portable-2.json
node_modules/meteor-node-stubs/node_modules/timers-browserify/.meteor-portable-2.json
node_modules/meteor-node-stubs/node_modules/tty-browserify/.meteor-portable-2.json
node_modules/meteor-node-stubs/node_modules/unbox-primitive/.meteor-portable-2.json
node_modules/meteor-node-stubs/node_modules/url/.meteor-portable-2.json
node_modules/meteor-node-stubs/node_modules/url/node_modules/punycode/.meteor-portable-2.json
node_modules/meteor-node-stubs/node_modules/util/.meteor-portable-2.json
node_modules/meteor-node-stubs/node_modules/util-deprecate/.meteor-portable-2.json
node_modules/meteor-node-stubs/node_modules/vm-browserify/.meteor-portable-2.json
node_modules/meteor-node-stubs/node_modules/which-boxed-primitive/.meteor-portable-2.json
node_modules/meteor-node-stubs/node_modules/which-typed-array/.meteor-portable-2.json
node_modules/meteor-node-stubs/node_modules/xtend/.meteor-portable-2.json
node_modules/regenerator-runtime/.meteor-portable-2.json

View file

@ -4,7 +4,15 @@
<table class="highlight striped responsive-table">
<thead>
<tr>
<th>Product Name</th>
<th>
{{#if $eq searchProd false}}
Product Name <i class="material-icons clickable right" id="filterProds">search</i>
{{else}}
<div style="width: 100%;">
<input type="text" class="searchProds" id="searchProds" style="width:85%" /> <i class="material-icons clickable" id="closeFilter">close</i>
</div>
{{/if}}
</th>
<th>Category</th>
<th>Store</th>
<th>Location</th>
@ -14,7 +22,7 @@
<tbody>
{{#each products}}
<tr>
<td>{{prodName}}</td>
<td>{{prodName}} </td>
<td>{{prodCategory}}</td>
<td>{{prodStore}}</td>
<td>{{prodLocation}}</td>

View file

@ -8,12 +8,21 @@ Template.prodMgmtTbl.onRendered(function() {
Meteor.setTimeout(function() {
$('.tooltipped').tooltip();
}, 150);
Session.set("searchProds", false);
});
Template.prodMgmtTbl.helpers({
products: function() {
return Products.find({});
let searchVal = Session.get("searchVal");
if (typeof searchVal == 'undefined' || searchVal.length == 0) {
return Products.find({});
} else {
return Products.find({ prodName: { $regex: searchVal + '.*', $options: 'i' } });
}
},
searchProd: function() {
return Session.get("searchProds");
}
});
Template.prodMgmtTbl.events({
@ -37,5 +46,19 @@ Template.prodMgmtTbl.events({
$("#prodLocation").val(prodInfo.prodLocation);
$("#prodStore").val(prodInfo.prodStore);
$('select').formSelect();
},
'click #filterProds' (event) {
event.preventDefault();
Session.set("searchProds", true);
},
'click #closeFilter' (event) {
event.preventDefault();
Session.set("searchProds", false);
},
"keyup #searchProds" (event) {
if (event.which !== 13) {
let searchVal = $("#searchProds").val();
Session.set("searchVal", searchVal);
}
}
});

View file

@ -1,17 +1,39 @@
<template name="listItemsForm">
<div class="row">
<div class="col s6">
<h4>{{selListName}}</h4>
<div class="col s6 center">
<h5>{{selListName}}</h5>
</div>
<div class="col s6">
<p>
<label>
<input type="checkbox" id="showReceivedItems" />
<span>Show Recv'd</span>
</label>
</p>
<div class="row">
<div class="col s12">
<p>
<label>
<input type="checkbox" id="showReceivedItems" />
<span>Show Recv'd</span>
</label>
</p>
</div>
<div class="col s2 m1 l1">
{{#if $eq filtering false}}
<i class="material-icons clickable" id="filterOn">filter_list</i>
{{else}}
<i class="material-icons clickable" id="filterOff">clear</i>
{{/if}}
</div>
<div class="col s10 m11 l11">
Filter LIst
</div>
</div>
</div>
</div>
{{#if $eq filtering true}}
<div class="row">
<div class="col s8 input-field">
<input type="text" class="searchListItems" id="searchListItems" />
<label for="searchlistItems">Filter</label>
</div>
</div>
{{else}}
<div class="row">
<div class="col s9 m10 l10">
<input list="listItemsData" name="listItems" id="listItems">
@ -23,11 +45,8 @@
</datalist>
</div>
<div class="col s3 m2 l2">
{{#if $eq editMode false}}
<a class="waves-effect waves-light btn saveListItem green right">Add</a>
{{else}}
<a class="waves-effect waves-light btn renameListItem blue right">Rename</a>
{{/if}}
<a class="waves-effect waves-light btn saveListItem green right">Add</a>
</div>
</div>
{{/if}}
</template>

View file

@ -16,6 +16,7 @@ Template.listItemsForm.onRendered(function() {
Session.set("listItemEditMode", false);
Session.set("itemReqErr", false);
Session.set("showReceivedItems", false);
Session.set("filtering", false);
});
Template.listItemsForm.helpers({
@ -30,6 +31,9 @@ Template.listItemsForm.helpers({
},
editMode: function() {
return Session.get("listItemEditMode");
},
filtering: function() {
return Session.get("filtering");
}
});
@ -75,5 +79,19 @@ Template.listItemsForm.events({
} else {
Session.set("showReceivedItems", false);
}
},
'keyup #searchListItems' (event) {
if (event.which !== 13) {
let searchVal = $("#searchListItems").val();
Session.set("searchVal", searchVal);
}
},
'click #filterOn' (event) {
event.preventDefault();
Session.set("filtering", true);
},
'click #filterOff' (event) {
event.preventDefault();
Session.set("filtering", false);
}
});

View file

@ -8,16 +8,25 @@ Template.listItemsTbl.onCreated(function() {
Template.listItemsTbl.onRendered(function() {
Session.set("showReceivedItems", false);
Session.set("searchVal", "");
});
Template.listItemsTbl.helpers({
'thisListItems': function() {
let showRecvd = Session.get("showReceivedItems");
console.log("Show Received is: " + showRecvd);
let searchVal = Session.get("searchVal");;
if (showRecvd == false) {
return ListItems.find({ itemReceived: false });
if (typeof searchVal == 'undefined' || searchVal.length === 0) {
return ListItems.find({ itemReceived: false });
} else {
return ListItems.find({ itemReceived: false, itemName: { $regex: searchVal + '.*', $options: 'i' } });
}
} else {
return ListItems.find({});
if (typeof searchVal == 'undefined' || searchVal.length == 0) {
return ListItems.find({});
} else {
return ListItems.find({ itemName: { $regex: searchVal + '.*', $options: 'i' } });
}
}
},
});
@ -63,5 +72,5 @@ Template.listItemsTbl.events({
console.log(" SUCCESS deleting the list item.");
}
});
}
},
});