Updating the materialize library and calls.

This commit is contained in:
Brian McGonagill 2024-07-22 11:56:35 -05:00
parent a118bf38fc
commit e44ef98be4
17 changed files with 10582 additions and 15529 deletions

View file

@ -1,27 +1,26 @@
import { ListItems } from '../../imports/api/listItems.js'
import { Lists } from '../../imports/api/lists.js';
import { Products } from '../../imports/api/products.js';
import { typeahead } from 'typeahead-standalone';
import { M } from '../lib/assets/materialize.js';
Template.listItemsForm.onCreated(function() {
this.subscribe("myListItems", Session.get("listId"));
this.subscribe("myLists");
// this.subscribe("listProducts", Session.get("listItemVal"));
this.subscribe("myProducts");
});
Template.listItemsForm.onRendered(function() {
Meteor.setTimeout(function() {
$('select').formSelect();
}, 100);
$('select').formSelect();
var elems = document.querySelectorAll('select');
var instances = M.FormSelect.init(elems, {});
Session.set("listItemEditMode", false);
Session.set("itemReqErr", false);
Session.set("showReceivedItems", false);
Session.set("filtering", false);
Session.set("findListItems", {});
this.autorun(() => {
$('input.autocomplete').autocomplete({
var elems = document.querySelectorAll('.autocomplete');
var instances = M.Autocomplete.init(elems, {
minLength: 0,
data: Session.get("findListItems"),
});
});
@ -95,20 +94,11 @@ Template.listItemsForm.events({
},
'keyup #findListItems' (event) {
if (event.which !== 13) {
let listItemObj = {};
let findItemVal = $("#findListItems").val();
console.log("Should start showing options now...");
Session.set("listItemVal", findItemVal);
let listItemInfo = Products.find({ prodName: {$regex: findItemVal + '.*', $options: 'i'}}, { limit: 5 }).fetch();
let listItemInfo = Products.find({ prodName: {$regex: findItemVal + '.*', $options: 'i'}}).fetch();
if (typeof listItemInfo != 'undefined' && listItemInfo != "" && listItemInfo != null) {
for (i=0; i < listItemInfo.length; i++) {
let item = listItemInfo[i].prodName;
let store = listItemInfo[i].prodStore;
listItemObj[item] = store;
}
Session.set("findListItems", listItemObj);
getDataList(listItemInfo);
}
}
},
'click #filterOn' (event) {
@ -119,4 +109,10 @@ Template.listItemsForm.events({
event.preventDefault();
Session.set("filtering", false);
}
});
});
getDataList = function(listItemInfo) {
let listItemObjArray = [];
listItemObjArray = listItemInfo.map(info => ({ id: info._id, text: info.prodName, store: info.prodStore }))
Session.set("findListItems", listItemObjArray);
}

View file

@ -7,7 +7,8 @@ Template.listItemsTbl.onCreated(function() {
});
Template.listItemsTbl.onRendered(function() {
$('.modal').modal();
// new modal init here
// $('.modal').modal();
Session.set("showReceivedItems", false);
Session.set("searchVal", "");
});
@ -70,6 +71,8 @@ Template.listItemsTbl.events({
Session.set("method", "delete.listItem");
Session.set("item", this.itemName);
Session.set("view", "List Items");
$('#modalDelete').modal('open');
// put the new modal js here
// $('#modalDelete').modal('open');
},
});