mirror of
https://gitlab.com/bmcgonag/get_my.git
synced 2026-03-27 00:08:49 +00:00
Many chcanges, but version 0.1.0 is ready to be cut.
This commit is contained in:
parent
42643a37f5
commit
6e37ae8c74
46 changed files with 1038 additions and 273 deletions
|
|
@ -30,4 +30,3 @@ raix:handlebar-helpers
|
||||||
kadira:flow-router
|
kadira:flow-router
|
||||||
kadira:blaze-layout
|
kadira:blaze-layout
|
||||||
accounts-password@2.3.1
|
accounts-password@2.3.1
|
||||||
# mizzao:autocomplete # for the @mentions functionality
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
<template name="catMgmt">
|
<template name="catMgmt">
|
||||||
|
<div class="container">
|
||||||
<h4>Category Management</h4>
|
<h4>Category Management</h4>
|
||||||
{{> catMgmtForm}}
|
{{> catMgmtForm}}
|
||||||
<hr>
|
<hr>
|
||||||
{{> catMgmtTbl}}
|
{{> catMgmtTbl}}
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
<template name="catMgmtForm">
|
<template name="catMgmtForm">
|
||||||
|
<form action="submit" id="catInputForm">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col s12 m6 l6 input-field">
|
<div class="col s12 m6 l6 input-field">
|
||||||
<input type="text" class="catNameInp" id="catNameInp" style="{{#if $eq catNameErr true}}border: 2px solid red;{{/if}}" />
|
<input type="text" class="catNameInp" id="catNameInp" style="{{#if $eq catNameErr true}}border: 2px solid red;{{/if}}" />
|
||||||
|
|
@ -10,7 +11,12 @@
|
||||||
<a class="waves-effect waves-light btn cancelCatMgmt orange">Cancel</a>
|
<a class="waves-effect waves-light btn cancelCatMgmt orange">Cancel</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="col s6 m6 l6">
|
<div class="col s6 m6 l6">
|
||||||
|
{{#if $eq catEditMode false}}
|
||||||
<a class="waves-effect waves-light btn saveCatMgmt green right">Add</a>
|
<a class="waves-effect waves-light btn saveCatMgmt green right">Add</a>
|
||||||
|
{{else}}
|
||||||
|
<a class="waves-effect waves-light btn editCatMgmt blue right">Rename</a>
|
||||||
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</form>
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -6,12 +6,16 @@ Template.catMgmtForm.onCreated(function() {
|
||||||
|
|
||||||
Template.catMgmtForm.onRendered(function() {
|
Template.catMgmtForm.onRendered(function() {
|
||||||
Session.set("catNameMiss", false);
|
Session.set("catNameMiss", false);
|
||||||
|
Session.set("catEditMode", false);
|
||||||
});
|
});
|
||||||
|
|
||||||
Template.catMgmtForm.helpers({
|
Template.catMgmtForm.helpers({
|
||||||
catNameErr: function() {
|
catNameErr: function() {
|
||||||
return Session.get("catNameMiss");
|
return Session.get("catNameMiss");
|
||||||
},
|
},
|
||||||
|
catEditMode: function() {
|
||||||
|
return Session.get("catEditMode");
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Template.catMgmtForm.events({
|
Template.catMgmtForm.events({
|
||||||
|
|
@ -32,8 +36,60 @@ Template.catMgmtForm.events({
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'click .cancelCatMgmt' (event) {
|
'click .editCatMgmt' (event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
let catName = $("#catNameInp").val();
|
||||||
|
let catId = this._id;
|
||||||
|
if (catName == null || catName == "") {
|
||||||
|
Session.set("catNameMiss", true);
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
let catId = Session.get("categoryEditId");
|
||||||
|
Meteor.call('edit.category', catId, catName, function(err, result) {
|
||||||
|
if (err) {
|
||||||
|
// console.log(" ERROR: Can't edit category: " + err);
|
||||||
|
} else {
|
||||||
|
// console.log(" SUCCESS editing category.");
|
||||||
|
$("#catNameInp").val("");
|
||||||
|
Session.set("catEditMode", false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'submit #catInputForm' (event) {
|
||||||
|
event.preventDefault();
|
||||||
|
let catName = $("#catNameInp").val();
|
||||||
|
let editMode = Session.get("catEditMode");
|
||||||
|
if (catName == null || catName == "") {
|
||||||
|
Session.set("catNameMiss", true);
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
if (editMode == false) {
|
||||||
|
Meteor.call('add.category', catName, function(err, result) {
|
||||||
|
if (err) {
|
||||||
|
// console.log(" ERROR: Can't add category: " + err);
|
||||||
|
} else {
|
||||||
|
// console.log(" SUCCESS adding category.");
|
||||||
$("#catNameInp").val("");
|
$("#catNameInp").val("");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
let catId = Session.get("categoryEditId");
|
||||||
|
Meteor.call('edit.category', catId, catName, function(err, result) {
|
||||||
|
if (err) {
|
||||||
|
// console.log(" ERROR: Can't edit category: " + err);
|
||||||
|
} else {
|
||||||
|
// console.log(" SUCCESS editing category.");
|
||||||
|
$("#catNameInp").val("");
|
||||||
|
Session.set("catEditMode", false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'click .cancelCatMgmt' (event) {
|
||||||
|
event.preventDefault();
|
||||||
|
$("#catNameInp").val("");
|
||||||
|
Session.set("catEditMode", false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
@ -5,8 +5,8 @@
|
||||||
{{#each cats}}
|
{{#each cats}}
|
||||||
<li class="collection-item">
|
<li class="collection-item">
|
||||||
{{categoryName}}
|
{{categoryName}}
|
||||||
<i class="material-icons clickable deleteCategory right">delete</i>
|
<i class="material-icons clickable deleteCategory right tooltipped" data-position="top" data-tooltip="Delete Category">delete</i>
|
||||||
<i class="material-icons clickable editCategory right">edit</i>
|
<i class="material-icons clickable editCategory right tooltipped" data-position="top" data-tooltip="Edit Category">edit</i>
|
||||||
</li>
|
</li>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,9 @@ Template.catMgmtTbl.onCreated(function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
Template.catMgmtTbl.onRendered(function() {
|
Template.catMgmtTbl.onRendered(function() {
|
||||||
|
Meteor.setTimeout(function() {
|
||||||
|
$('.tooltipped').tooltip();
|
||||||
|
}, 150);
|
||||||
});
|
});
|
||||||
|
|
||||||
Template.catMgmtTbl.helpers({
|
Template.catMgmtTbl.helpers({
|
||||||
|
|
@ -15,5 +17,21 @@ Template.catMgmtTbl.helpers({
|
||||||
});
|
});
|
||||||
|
|
||||||
Template.catMgmtTbl.events({
|
Template.catMgmtTbl.events({
|
||||||
|
'click .deleteCategory' (event) {
|
||||||
|
event.preventDefault();
|
||||||
|
Meteor.call('delete.category', this._id, function(err, result) {
|
||||||
|
if (err) {
|
||||||
|
console.log(" ERROR deleting category: " + err);
|
||||||
|
} else {
|
||||||
|
console.log(" SUCCESS deleting the category.");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
'click .editCategory' (event) {
|
||||||
|
event.preventDefault();
|
||||||
|
Session.set("categoryEditId", this._id);
|
||||||
|
Session.set("catEditMode", true);
|
||||||
|
let catInfo = Categories.findOne({ _id: this._id });
|
||||||
|
$("#catNameInp").val(catInfo.categoryName);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -6,7 +6,17 @@
|
||||||
<input type="text" class="listNameInp" style="{{#if $eq listNameErr true}}border: 2px solid red{{/if}}" id="listNameInp" />
|
<input type="text" class="listNameInp" style="{{#if $eq listNameErr true}}border: 2px solid red{{/if}}" id="listNameInp" />
|
||||||
<label for="listNameInp">List Name</label>
|
<label for="listNameInp">List Name</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="col s4 m4 l2">
|
<div class="col s4 m4 l2 input-field">
|
||||||
|
<p>
|
||||||
|
<label>
|
||||||
|
<input type="checkbox" id="isShared"/>
|
||||||
|
<span>Shared</span>
|
||||||
|
</label>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col s12 m12 l12">
|
||||||
{{#if $eq editMode false}}
|
{{#if $eq editMode false}}
|
||||||
<a class="waves-effect waves-light btn saveListMgmt green right">Add</a>
|
<a class="waves-effect waves-light btn saveListMgmt green right">Add</a>
|
||||||
{{else}}
|
{{else}}
|
||||||
|
|
|
||||||
|
|
@ -22,17 +22,19 @@ Template.listMgmtForm.events({
|
||||||
'click .saveListMgmt' (event) {
|
'click .saveListMgmt' (event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
let listName = $("#listNameInp").val();
|
let listName = $("#listNameInp").val();
|
||||||
|
let shared = $("#isShared").prop('checked');
|
||||||
|
|
||||||
if (listName == null || listName == "") {
|
if (listName == null || listName == "") {
|
||||||
Session.set("listNameMiss", true);
|
Session.set("listNameMiss", true);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
Meteor.call('add.list', listName, function(err, result) {
|
Meteor.call('add.list', listName, shared, function(err, result) {
|
||||||
if (err) {
|
if (err) {
|
||||||
console.log(" ERROR adding list name: " + err);
|
console.log(" ERROR adding list name: " + err);
|
||||||
} else {
|
} else {
|
||||||
console.log(" SUCCESS adding list name.");
|
console.log(" SUCCESS adding list name.");
|
||||||
$("#listNameInp").val("");
|
$("#listNameInp").val("");
|
||||||
|
$("#isShared").prop("checked", false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -40,18 +42,20 @@ Template.listMgmtForm.events({
|
||||||
'click .renameListMgmt' (event) {
|
'click .renameListMgmt' (event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
let listName = $("#listNameInp").val();
|
let listName = $("#listNameInp").val();
|
||||||
|
let shared = $("#isShared").prop('checked');
|
||||||
let listId = Session.get("listItemId");
|
let listId = Session.get("listItemId");
|
||||||
|
|
||||||
if (listName == null || listName == "") {
|
if (listName == null || listName == "") {
|
||||||
Session.set("listNameMiss", true);
|
Session.set("listNameMiss", true);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
Meteor.call('edit.list', listId, listName, function(err, result) {
|
Meteor.call('edit.list', listId, listName, shared, function(err, result) {
|
||||||
if (err) {
|
if (err) {
|
||||||
console.log(" ERROR editing list name: " + err);
|
console.log(" ERROR editing list name: " + err);
|
||||||
} else {
|
} else {
|
||||||
console.log(" SUCCESS editing list name.");
|
console.log(" SUCCESS editing list name.");
|
||||||
$("#listNameInp").val("");
|
$("#listNameInp").val("");
|
||||||
|
$("#isShared").prop("checked", false);
|
||||||
Session.set("listNameEditMode", false);
|
Session.set("listNameEditMode", false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -60,6 +64,7 @@ Template.listMgmtForm.events({
|
||||||
'submit .listAdd' (event) {
|
'submit .listAdd' (event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
let editMode = Session.get("listNameEditMode");
|
let editMode = Session.get("listNameEditMode");
|
||||||
|
let shared = $("#isShared").prop("checked");
|
||||||
let listName = $("#listNameInp").val();
|
let listName = $("#listNameInp").val();
|
||||||
let listId = Session.get("listItemId");
|
let listId = Session.get("listItemId");
|
||||||
|
|
||||||
|
|
@ -68,21 +73,23 @@ Template.listMgmtForm.events({
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
if (editMode == false) {
|
if (editMode == false) {
|
||||||
Meteor.call('add.list', listName, function(err, result) {
|
Meteor.call('add.list', listName, shared, function(err, result) {
|
||||||
if (err) {
|
if (err) {
|
||||||
console.log(" ERROR adding list name: " + err);
|
console.log(" ERROR adding list name: " + err);
|
||||||
} else {
|
} else {
|
||||||
console.log(" SUCCESS adding list name.");
|
console.log(" SUCCESS adding list name.");
|
||||||
$("#listNameInp").val("");
|
$("#listNameInp").val("");
|
||||||
|
$("#isShared").prop("checked", false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
Meteor.call('edit.list', listId, listName, function(err, result) {
|
Meteor.call('edit.list', listId, listName, shared, function(err, result) {
|
||||||
if (err) {
|
if (err) {
|
||||||
console.log(" ERROR editing list name: " + err);
|
console.log(" ERROR editing list name: " + err);
|
||||||
} else {
|
} else {
|
||||||
console.log(" SUCCESS editing list name.");
|
console.log(" SUCCESS editing list name.");
|
||||||
$("#listNameInp").val("");
|
$("#listNameInp").val("");
|
||||||
|
$("#isShared").prop("checked", false);
|
||||||
Session.set("listNameEditMode", false);
|
Session.set("listNameEditMode", false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
<ul class="collection">
|
<ul class="collection">
|
||||||
{{#each lists}}
|
{{#each lists}}
|
||||||
<li class="collection-item">
|
<li class="collection-item">
|
||||||
{{listName}}
|
<span class="{{#if $eq listShared true}}green-text{{/if}}">{{listName}}</span>
|
||||||
<i class="material-icons clickable deleteListName tooltipped right" data-position="top" data-tooltip="Delete This List">delete</i>
|
<i class="material-icons clickable deleteListName tooltipped right" data-position="top" data-tooltip="Delete This List">delete</i>
|
||||||
<i class="material-icons clickable editListName tooltipped right" data-position="top" data-tooltip="Edit This List">edit</i>
|
<i class="material-icons clickable editListName tooltipped right" data-position="top" data-tooltip="Edit This List">edit</i>
|
||||||
<i class="material-icons clickable markListComplete tooltipped right" data-position="top" data-tooltip="Mark Complete">check</i>
|
<i class="material-icons clickable markListComplete tooltipped right" data-position="top" data-tooltip="Mark Complete">check</i>
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,9 @@ Template.listMgmtTbl.onCreated(function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
Template.listMgmtTbl.onRendered(function() {
|
Template.listMgmtTbl.onRendered(function() {
|
||||||
|
Meteor.setTimeout(function() {
|
||||||
$('.tooltipped').tooltip();
|
$('.tooltipped').tooltip();
|
||||||
|
}, 150);
|
||||||
});
|
});
|
||||||
|
|
||||||
Template.listMgmtTbl.helpers({
|
Template.listMgmtTbl.helpers({
|
||||||
|
|
@ -28,8 +30,15 @@ Template.listMgmtTbl.events({
|
||||||
},
|
},
|
||||||
'click .editListName' (event) {
|
'click .editListName' (event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
let listName = Lists.findOne({ _id: this._id }).listName;
|
let listInfo = Lists.findOne({ _id: this._id });
|
||||||
|
let listName = listInfo.listName;
|
||||||
|
let listShared = listInfo.listShared;
|
||||||
$("#listNameInp").val(listName);
|
$("#listNameInp").val(listName);
|
||||||
|
if (listShared == true) {
|
||||||
|
$("#isShared").prop("checked", true);
|
||||||
|
} else {
|
||||||
|
$("#isShared").prop("checked", false);
|
||||||
|
}
|
||||||
Session.set("listNameEditMode", true);
|
Session.set("listNameEditMode", true);
|
||||||
Session.set("listItemId", this._id);
|
Session.set("listItemId", this._id);
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,8 @@
|
||||||
<template name="locMgmt">
|
<template name="locMgmt">
|
||||||
|
<div class="container">
|
||||||
|
<h4>Location Management</h4>
|
||||||
{{> locMgmtForm}}
|
{{> locMgmtForm}}
|
||||||
<hr>
|
<hr>
|
||||||
{{> locMgmtTbl}}
|
{{> locMgmtTbl}}
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
<template name="locMgmtForm">
|
<template name="locMgmtForm">
|
||||||
|
<form action="" id="locInputForm">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col s12 m6 l6 input-field">
|
<div class="col s12 m6 l6 input-field">
|
||||||
<input type="text" class="locNameInp" id="locNameInp" style="{{#if $eq locNameErr true}}border: 2px solid red;{{/if}}" />
|
<input type="text" class="locNameInp" id="locNameInp" style="{{#if $eq locNameErr true}}border: 2px solid red;{{/if}}" />
|
||||||
|
|
@ -10,7 +11,12 @@
|
||||||
<a class="waves-effect waves-light btn cancelLocMgmt orange">Cancel</a>
|
<a class="waves-effect waves-light btn cancelLocMgmt orange">Cancel</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="col s6 m6 l6">
|
<div class="col s6 m6 l6">
|
||||||
|
{{#if $eq locEditMode false}}
|
||||||
<a class="waves-effect waves-light btn saveLocMgmt green right">Add</a>
|
<a class="waves-effect waves-light btn saveLocMgmt green right">Add</a>
|
||||||
|
{{else}}
|
||||||
|
<a class="waves-effect waves-light btn editLocMgmt blue right">Rename</a>
|
||||||
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</form>
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -6,12 +6,16 @@ Template.locMgmtForm.onCreated(function() {
|
||||||
|
|
||||||
Template.locMgmtForm.onRendered(function() {
|
Template.locMgmtForm.onRendered(function() {
|
||||||
Session.set("locNameMiss", false);
|
Session.set("locNameMiss", false);
|
||||||
|
Session.set("locEditMode", false);
|
||||||
});
|
});
|
||||||
|
|
||||||
Template.locMgmtForm.helpers({
|
Template.locMgmtForm.helpers({
|
||||||
locNameErr: function() {
|
locNameErr: function() {
|
||||||
return Session.get("locNameMiss");
|
return Session.get("locNameMiss");
|
||||||
},
|
},
|
||||||
|
locEditMode: function() {
|
||||||
|
return Session.get("locEditMode");
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Template.locMgmtForm.events({
|
Template.locMgmtForm.events({
|
||||||
|
|
@ -32,8 +36,60 @@ Template.locMgmtForm.events({
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'click .cancelLocMgmt' (event) {
|
'click .editLocMgmt' (event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
let locName = $("#locNameInp").val();
|
||||||
|
let locEditMode = Session.get("locEditMode");
|
||||||
|
let locId = Session.get("locEditId");
|
||||||
|
if (locName == null || locName == "") {
|
||||||
|
Session.set("locNameMiss", true);
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
Meteor.call('edit.location', locId, locName, function(err, result) {
|
||||||
|
if (err) {
|
||||||
|
// console.log(" ERROR: Can't edit category: " + err);
|
||||||
|
} else {
|
||||||
|
// console.log(" SUCCESS editing category.");
|
||||||
|
$("#locNameInp").val("");
|
||||||
|
Session.set("locEditMode", false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'submit #locInputForm' (event) {
|
||||||
|
event.preventDefault();
|
||||||
|
let locName = $("#locNameInp").val();
|
||||||
|
let locEditMode = Session.get("locEditMode");
|
||||||
|
let locId = Session.get("locEditId");
|
||||||
|
if (locName == null || locName == "") {
|
||||||
|
Session.set("locNameMiss", true);
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
if (locEditMode == false) {
|
||||||
|
Meteor.call('add.location', locName, function(err, result) {
|
||||||
|
if (err) {
|
||||||
|
// console.log(" ERROR: Can't add category: " + err);
|
||||||
|
} else {
|
||||||
|
// console.log(" SUCCESS adding category.");
|
||||||
$("#locNameInp").val("");
|
$("#locNameInp").val("");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
Meteor.call('edit.location', locId, locName, function(err, result) {
|
||||||
|
if (err) {
|
||||||
|
// console.log(" ERROR: Can't edit category: " + err);
|
||||||
|
} else {
|
||||||
|
// console.log(" SUCCESS editing category.");
|
||||||
|
$("#locNameInp").val("");
|
||||||
|
Session.set("locEditMode", false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'click .cancelLocMgmt' (event) {
|
||||||
|
event.preventDefault();
|
||||||
|
$("#locNameInp").val("");
|
||||||
|
Session.set("locEditMode", false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
@ -1,21 +1,15 @@
|
||||||
<template name="locMgmtTbl">
|
<template name="locMgmtTbl">
|
||||||
<table class="highlight striped responsive-table">
|
<div class="row">
|
||||||
<thead>
|
<div class="col s12">
|
||||||
<tr>
|
<ul class="collection">
|
||||||
<th>Name</th>
|
|
||||||
<th>Actions</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
{{#each locs}}
|
{{#each locs}}
|
||||||
<tr>
|
<li class="collection-item">
|
||||||
<td>{{locationName}}</td>
|
{{locationName}}
|
||||||
<td>
|
<i class="material-icons clickable deleteLocation right tooltipped" data-position="top" data-tooltip="Delete Location">delete</i>
|
||||||
<i class="material-icons clickable deleteCategory">delete</i>
|
<i class="material-icons clickable editLocation right tooltipped" data-position="top" data-tooltip="Edit Location">edit</i>
|
||||||
<i class="material-icons clickable editCategory">edit</i>
|
</li>
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</tbody>
|
</ul>
|
||||||
</table>
|
</div>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -5,7 +5,9 @@ Template.locMgmtTbl.onCreated(function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
Template.locMgmtTbl.onRendered(function() {
|
Template.locMgmtTbl.onRendered(function() {
|
||||||
|
Meteor.setTimeout(function() {
|
||||||
|
$('.tooltipped').tooltip();
|
||||||
|
}, 150);
|
||||||
});
|
});
|
||||||
|
|
||||||
Template.locMgmtTbl.helpers({
|
Template.locMgmtTbl.helpers({
|
||||||
|
|
@ -14,6 +16,22 @@ Template.locMgmtTbl.helpers({
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Template.locMgmtTbl.events([
|
Template.locMgmtTbl.events({
|
||||||
|
'click .deleteLocation' (event) {
|
||||||
]);
|
event.preventDefault();
|
||||||
|
Meteor.call('delete.location', this._id, function(err, result) {
|
||||||
|
if (err) {
|
||||||
|
console.log(" ERROR deleting location: " + err);
|
||||||
|
} else {
|
||||||
|
console.log(" SUCCESS deleting the location.");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
'click .editLocation' (event) {
|
||||||
|
event.preventDefault();
|
||||||
|
Session.set("locEditMode", true);
|
||||||
|
Session.set("locEditId", this._id);
|
||||||
|
let locInfo = Locations.findOne({ _id: this._id });
|
||||||
|
$("#locNameInp").val(locInfo.locationName);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
@ -4,16 +4,13 @@
|
||||||
<ul class="collection with-header">
|
<ul class="collection with-header">
|
||||||
<li class="collection-header"><h4>Management</h4></li>
|
<li class="collection-header"><h4>Management</h4></li>
|
||||||
{{#if isInRole "systemadmin"}}
|
{{#if isInRole "systemadmin"}}
|
||||||
<li><a href="#!" id="userMgmt" class="collection-item">User Management</a></li>
|
<li class="collection-item" id="userMgmt">Users</li>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
<li><a href="#!" id="manageLists" class="collection-item">List</a></li>
|
<li id="manageLists" class="collection-item">Lists</li>
|
||||||
<li><a href="#!" id="manageCategory" class="collection-item">Category</a></li>
|
<li id="manageProduct" class="collection-item">Product</li>
|
||||||
<li><a href="#!" id="manageProduct" class="collection-item">Product</a></li>
|
<li id="manageCategory" class="collection-item">Category</li>
|
||||||
<li><a href="#!" id="manageLocation" class="collection-item">Location</a></li>
|
<li id="manageLocation" class="collection-item">Location</li>
|
||||||
<li><a href="#!" id="manageStore" class="collection-item">Store</a></li>
|
<li id="manageStore" class="collection-item">Store</li>
|
||||||
<li><a href="#!" id="manageCabinet" class="collection-item">Cabinet</a></li>
|
|
||||||
<li><a href="#!" id="manageShelf" class="collection-item">Shelf</a></li>
|
|
||||||
<li><a href="#!" id="manageBin" class="collection-item">Bin</a></li>
|
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
<template name="prodMgmtForm">
|
<template name="prodMgmtForm">
|
||||||
<h4>Product Management</h4>
|
<h4>Product Management</h4>
|
||||||
|
<form action="submit" class="prodInputForm">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col s12 m6 l6 input-field">
|
<div class="col s12 m6 l6 input-field">
|
||||||
<input type="text" class="prodName" style="{{#if $eq prodNameErr true}}border: 2px solid red;{{/if}}" id="prodName" />
|
<input type="text" class="prodName" style="{{#if $eq prodNameErr true}}border: 2px solid red;{{/if}}" id="prodName" />
|
||||||
|
|
@ -43,9 +44,14 @@
|
||||||
<a class="waves-effect waves-light btn cancelProdMgmt orange">Cancel</a>
|
<a class="waves-effect waves-light btn cancelProdMgmt orange">Cancel</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="col s6 m6 l6">
|
<div class="col s6 m6 l6">
|
||||||
|
{{#if $eq prodEditMode false}}
|
||||||
<a class="waves-effect waves-light btn saveProdMgmt green right">Add</a>
|
<a class="waves-effect waves-light btn saveProdMgmt green right">Add</a>
|
||||||
|
{{else}}
|
||||||
|
<a class="waves-effect waves-light btn editProdMgmt blue right">Save Edits</a>
|
||||||
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
<!-- Store Modal Structure -->
|
<!-- Store Modal Structure -->
|
||||||
<div id="modalStore" class="modal">
|
<div id="modalStore" class="modal">
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ Template.prodMgmtForm.onRendered(function() {
|
||||||
}, 200);
|
}, 200);
|
||||||
$('select').formSelect();
|
$('select').formSelect();
|
||||||
$('.modal').modal();
|
$('.modal').modal();
|
||||||
|
Session.set("prodEditMode", false);
|
||||||
});
|
});
|
||||||
|
|
||||||
Template.prodMgmtForm.helpers({
|
Template.prodMgmtForm.helpers({
|
||||||
|
|
@ -31,6 +32,9 @@ Template.prodMgmtForm.helpers({
|
||||||
locations: function() {
|
locations: function() {
|
||||||
return Locations.find({});
|
return Locations.find({});
|
||||||
},
|
},
|
||||||
|
prodEditMode: function() {
|
||||||
|
return Session.get("prodEditMode");
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
Template.prodMgmtForm.events({
|
Template.prodMgmtForm.events({
|
||||||
|
|
@ -66,16 +70,112 @@ Template.prodMgmtForm.events({
|
||||||
$("#prodCategory").val("");
|
$("#prodCategory").val("");
|
||||||
$("#prodStore").val("");
|
$("#prodStore").val("");
|
||||||
$("#prodLocation").val("");
|
$("#prodLocation").val("");
|
||||||
|
$('select').formSelect();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
'click .editProdMgmt' (event) {
|
||||||
|
event.preventDefault();
|
||||||
|
let name = $("#prodName").val();
|
||||||
|
let cat = $("#prodCategory").val();
|
||||||
|
let store = $("#prodStore").val();
|
||||||
|
let location = $("#prodLocation").val();
|
||||||
|
let prodId = Session.get("prodEditId");
|
||||||
|
|
||||||
|
if (cat == null) {
|
||||||
|
cat = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (location == null) {
|
||||||
|
location = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (store == null) {
|
||||||
|
store = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (name == "" || name == null) {
|
||||||
|
Session.set("prodNameRed", true);
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
Meteor.call('edit.product', prodId, name, cat, store, location, function(err, result) {
|
||||||
|
if (err) {
|
||||||
|
// console.log(" ERROR: can't add product: " + err);
|
||||||
|
} else {
|
||||||
|
// console.log(" SUCCESS adding product.");
|
||||||
|
$("#prodName").val("");
|
||||||
|
$("#prodCategory").val("");
|
||||||
|
$("#prodStore").val("");
|
||||||
|
$("#prodLocation").val("");
|
||||||
|
$('select').formSelect();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'keypress form.prodInputForm' (event) {
|
||||||
|
// event.preventDefault();
|
||||||
|
if (event.which === 13) {
|
||||||
|
let name = $("#prodName").val();
|
||||||
|
let cat = $("#prodCategory").val();
|
||||||
|
let store = $("#prodStore").val();
|
||||||
|
let location = $("#prodLocation").val();
|
||||||
|
let prodId = Session.get("prodEditId");
|
||||||
|
let prodEditMode = Session.get("prodEditMode");
|
||||||
|
console.log(" ---- got the submit event for products.");
|
||||||
|
if (cat == null) {
|
||||||
|
cat = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (location == null) {
|
||||||
|
location = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (store == null) {
|
||||||
|
store = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (name == "" || name == null) {
|
||||||
|
Session.set("prodNameRed", true);
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
if (prodEditMode == true) {
|
||||||
|
Meteor.call('edit.product', prodId, name, cat, store, location, function(err, result) {
|
||||||
|
if (err) {
|
||||||
|
// console.log(" ERROR: can't add product: " + err);
|
||||||
|
} else {
|
||||||
|
// console.log(" SUCCESS adding product.");
|
||||||
|
$("#prodName").val("");
|
||||||
|
$("#prodCategory").val("");
|
||||||
|
$("#prodStore").val("");
|
||||||
|
$("#prodLocation").val("");
|
||||||
|
$('select').formSelect();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
Meteor.call('add.product', name, cat, store, location, function(err, result) {
|
||||||
|
if (err) {
|
||||||
|
// console.log(" ERROR: can't add product: " + err);
|
||||||
|
} else {
|
||||||
|
// console.log(" SUCCESS adding product.");
|
||||||
|
$("#prodName").val("");
|
||||||
|
$("#prodCategory").val("");
|
||||||
|
$("#prodStore").val("");
|
||||||
|
$("#prodLocation").val("");
|
||||||
|
$('select').formSelect();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
'click .cancelProdMgmt' (event) {
|
'click .cancelProdMgmt' (event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
$("#prodName").val("");
|
$("#prodName").val("");
|
||||||
$("#prodCategory").val("");
|
$("#prodCategory").val("");
|
||||||
$("#prodStore").val("");
|
$("#prodStore").val("");
|
||||||
$("#prodLocation").val("");
|
$("#prodLocation").val("");
|
||||||
|
$('select').formSelect();
|
||||||
},
|
},
|
||||||
'change #prodStore' (event) {
|
'change #prodStore' (event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
|
||||||
|
|
@ -19,8 +19,8 @@
|
||||||
<td>{{prodStore}}</td>
|
<td>{{prodStore}}</td>
|
||||||
<td>{{prodLocation}}</td>
|
<td>{{prodLocation}}</td>
|
||||||
<td>
|
<td>
|
||||||
<i class="material-icons clickable deleteProduct">delete</i>
|
<i class="material-icons clickable deleteProduct tooltipped" data-position="top" data-tooltip="Delete Product">delete</i>
|
||||||
<i class="material-icons clickable editProduct">edit</i>
|
<i class="material-icons clickable editProduct tooltipped" data-position="top" data-tooltip="Edit Product">edit</i>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,9 @@ Template.prodMgmtTbl.onCreated(function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
Template.prodMgmtTbl.onRendered(function() {
|
Template.prodMgmtTbl.onRendered(function() {
|
||||||
|
Meteor.setTimeout(function() {
|
||||||
|
$('.tooltipped').tooltip();
|
||||||
|
}, 150);
|
||||||
});
|
});
|
||||||
|
|
||||||
Template.prodMgmtTbl.helpers({
|
Template.prodMgmtTbl.helpers({
|
||||||
|
|
@ -15,5 +17,25 @@ Template.prodMgmtTbl.helpers({
|
||||||
});
|
});
|
||||||
|
|
||||||
Template.prodMgmtTbl.events({
|
Template.prodMgmtTbl.events({
|
||||||
|
'click .deleteProduct' (event) {
|
||||||
|
event.preventDefault();
|
||||||
|
Meteor.call('delete.product', this._id, function(err, result) {
|
||||||
|
if (err) {
|
||||||
|
console.log(" ERROR deleting product: " + err);
|
||||||
|
} else {
|
||||||
|
console.log(" SUCCESS deleting the product.");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
'click .editProduct' (event) {
|
||||||
|
event.preventDefault();
|
||||||
|
Session.set("prodEditMode", true);
|
||||||
|
Session.set("prodEditId", this._id);
|
||||||
|
let prodInfo = Products.findOne({ _id: this._id });
|
||||||
|
$("#prodName").val(prodInfo.prodName);
|
||||||
|
$("#prodCategory").val(prodInfo.prodCategory);
|
||||||
|
$("#prodLocation").val(prodInfo.prodLocation);
|
||||||
|
$("#prodStore").val(prodInfo.prodStore);
|
||||||
|
$('select').formSelect();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -1,11 +1,8 @@
|
||||||
<template name="storeMgmt">
|
<template name="storeMgmt">
|
||||||
<!-- Store Management Entry / Edit -->
|
<div class="container">
|
||||||
<h4>Store Management</h4>
|
<h4>Store Management</h4>
|
||||||
<p>Add Stores you commonly make lists for here.</p>
|
|
||||||
|
|
||||||
{{> storeMgmtForm}}
|
{{> storeMgmtForm}}
|
||||||
<!-- Store Management Table List -->
|
|
||||||
<hr>
|
<hr>
|
||||||
{{> storeMgmtTbl}}
|
{{> storeMgmtTbl}}
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -1,20 +1,22 @@
|
||||||
<template name="storeMgmtForm">
|
<template name="storeMgmtForm">
|
||||||
|
<form id="storeForm" action="submit">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col s12 m6 l6 input-field">
|
<div class="col s12 input-field">
|
||||||
<input type="text" class="storeName" id="storeName" />
|
<input type="text" class="storeName" id="storeName" />
|
||||||
<label for="storeName">Name</label>
|
<label for="storeName">Name</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="col s12 m6 l6 input-field">
|
|
||||||
<input type="text" class="storeType" id="storeType" />
|
|
||||||
<label for="storeType">Type</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col s6 m6 l6">
|
<div class="col s6 m6 l6">
|
||||||
<a class="waves-effect waves-light btn cancelStoreMgmt orange">Cancel</a>
|
<a class="waves-effect waves-light btn cancelStoreMgmt orange">Cancel</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="col s6 m6 l6">
|
<div class="col s6 m6 l6">
|
||||||
|
{{#if $eq editModeStore false}}
|
||||||
<a class="waves-effect waves-light btn saveStoreMgmt green right">Add</a>
|
<a class="waves-effect waves-light btn saveStoreMgmt green right">Add</a>
|
||||||
|
{{else}}
|
||||||
|
<a class="waves-effect waves-light btn editStoreMgmt blue right">Rename</a>
|
||||||
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</form>
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -6,28 +6,83 @@ Template.storeMgmtForm.onCreated(function() {
|
||||||
|
|
||||||
Template.storeMgmtForm.onRendered(function() {
|
Template.storeMgmtForm.onRendered(function() {
|
||||||
Session.set("borderRed", false);
|
Session.set("borderRed", false);
|
||||||
|
Session.set("editModeStore", false);
|
||||||
});
|
});
|
||||||
|
|
||||||
Template.storeMgmtForm.helpers({
|
Template.storeMgmtForm.helpers({
|
||||||
|
editModeStore: function() {
|
||||||
|
return Session.get("editModeStore");
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Template.storeMgmtForm.events({
|
Template.storeMgmtForm.events({
|
||||||
'click .saveStoreMgmt' (event) {
|
'click .saveStoreMgmt' (event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
let storeName = $("#storeName").val();
|
let storeName = $("#storeName").val();
|
||||||
let storeType = $("#storeType").val();
|
|
||||||
if (storeName == "" || storeName == null) {
|
if (storeName == "" || storeName == null) {
|
||||||
Session.set("borderRed", true);
|
Session.set("borderRed", true);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
Meteor.call("add.store", storeName, storeType, function(err, result) {
|
Meteor.call("add.store", storeName, function(err, result) {
|
||||||
if (err) {
|
if (err) {
|
||||||
// console.log("ERROR: Store add failed: " + err);
|
// console.log("ERROR: Store add failed: " + err);
|
||||||
} else {
|
} else {
|
||||||
// console.log("Success adding store!");
|
// console.log("Success adding store!");
|
||||||
$("#storeName").val("");
|
$("#storeName").val("");
|
||||||
$("#storeType").val("");
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'click .cancelStoreMgmt' (event) {
|
||||||
|
event.preventDefault();
|
||||||
|
$("#storeName").val("");
|
||||||
|
Session.set("editModeStore", false);
|
||||||
|
},
|
||||||
|
'submit #storeForm' (event) {
|
||||||
|
event.preventDefault();
|
||||||
|
let editMode = Session.get("editModeStore");
|
||||||
|
let storeName = $("#storeName").val();
|
||||||
|
if (storeName == "" || storeName == null) {
|
||||||
|
Session.set("borderRed", true);
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
if (editMode == false) {
|
||||||
|
Meteor.call("add.store", storeName, function(err, result) {
|
||||||
|
if (err) {
|
||||||
|
// console.log("ERROR: Store add failed: " + err);
|
||||||
|
} else {
|
||||||
|
// console.log("Success adding store!");
|
||||||
|
$("#storeName").val("");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
let storeId = Session.get("storeIdEdit");
|
||||||
|
Meteor.call("edit.store", storeId, storeName, function(err, result) {
|
||||||
|
if (err) {
|
||||||
|
// console.log("ERROR: Store add failed: " + err);
|
||||||
|
} else {
|
||||||
|
// console.log("Success adding store!");
|
||||||
|
$("#storeName").val("");
|
||||||
|
Session.set("editModeStore", false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'click .editStoreMgmt' (event) {
|
||||||
|
let storeName = $("#storeName").val();
|
||||||
|
let storeId = Session.get("storeIdEdit");
|
||||||
|
if (storeName == "" || storeName == null) {
|
||||||
|
Session.set("borderRed", true);
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
Meteor.call("edit.store", storeId, storeName, function(err, result) {
|
||||||
|
if (err) {
|
||||||
|
// console.log("ERROR: Store add failed: " + err);
|
||||||
|
} else {
|
||||||
|
// console.log("Success adding store!");
|
||||||
|
$("#storeName").val("");
|
||||||
|
Session.set("editModeStore", false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,27 +1,15 @@
|
||||||
<template name="storeMgmtTbl">
|
<template name="storeMgmtTbl">
|
||||||
<table class="highlight striped responsive-table">
|
<div class="row">
|
||||||
<thead>
|
<div class="col s12">
|
||||||
<tr>
|
<ul class="collection">
|
||||||
<th>Store Name</th>
|
|
||||||
<th>Type</th>
|
|
||||||
<th>Actions</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
{{#each mgmtStoreInfo}}
|
{{#each mgmtStoreInfo}}
|
||||||
<tr>
|
<li class="collection-item">
|
||||||
<td>
|
|
||||||
{{storeName}}
|
{{storeName}}
|
||||||
</td>
|
<i class="material-icons clickable deleteStore right tooltipped" data-position="top" data-tooltip="Delete Store">delete</i>
|
||||||
<td>
|
<i class="material-icons clickable editStore right tooltipped" data-position="top" data-tooltip="Edit Store Name">edit</i>
|
||||||
{{storeType}}
|
</li>
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<i class="material-icons clickable deleteStore">delete</i>
|
|
||||||
<i class="material-icons clickable editStore">edit</i>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</tbody>
|
</ul>
|
||||||
</table>
|
</div>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -5,7 +5,9 @@ Template.storeMgmtTbl.onCreated(function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
Template.storeMgmtTbl.onRendered(function() {
|
Template.storeMgmtTbl.onRendered(function() {
|
||||||
|
Meteor.setTimeout(function() {
|
||||||
|
$('.tooltipped').tooltip();
|
||||||
|
}, 150);
|
||||||
});
|
});
|
||||||
|
|
||||||
Template.storeMgmtTbl.helpers({
|
Template.storeMgmtTbl.helpers({
|
||||||
|
|
@ -17,10 +19,19 @@ Template.storeMgmtTbl.helpers({
|
||||||
Template.storeMgmtTbl.events({
|
Template.storeMgmtTbl.events({
|
||||||
'click .deleteStore' (event) {
|
'click .deleteStore' (event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
// console.log("Delete Store Clicked");
|
Meteor.call('delete.store', this._id, function(err, result) {
|
||||||
|
if (err) {
|
||||||
|
console.log(" ERROR deleting store: " + err);
|
||||||
|
} else {
|
||||||
|
console.log(" SUCCESS deleting the store.");
|
||||||
|
}
|
||||||
|
});
|
||||||
},
|
},
|
||||||
'click .editStore' (event) {
|
'click .editStore' (event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
// console.log("Edit Store Clicked");
|
Session.set("storeIdEdit", this._id);
|
||||||
|
let storeInfo = Stores.findOne({ _id: this._id });
|
||||||
|
$("#storeName").val(storeInfo.storeName);
|
||||||
|
Session.set("editModeStore", true);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
<div class="row">
|
<div class="row">
|
||||||
{{#if isInRole 'systemadmin'}}
|
{{#if isInRole 'systemadmin'}}
|
||||||
<div class="col s12 m6 l4">
|
<div class="col s12 m6 l4">
|
||||||
<div class="card blue-grey darken-1">
|
<div class="card blue-grey darken-1" id="userInfoCard">
|
||||||
<div class="card-content white-text">
|
<div class="card-content white-text">
|
||||||
<span class="card-title"><h4>Users</h4></span>
|
<span class="card-title"><h4>Users</h4></span>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
|
@ -12,13 +12,13 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-action">
|
<div class="card-action">
|
||||||
<a href="#" id="usermgmtlink">User Management</a>
|
<a href="#" class="cardLink" id="userMgmtLink">User Management</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
<div class="col s12 m6 l4">
|
<div class="col s12 m6 l4">
|
||||||
<div class="card blue-grey darken-1">
|
<div class="card blue-grey darken-1" id="listInfoCard">
|
||||||
<div class="card-content white-text">
|
<div class="card-content white-text">
|
||||||
<span class="card-title"><h4>My Lists</h4></span>
|
<span class="card-title"><h4>My Lists</h4></span>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
|
@ -26,15 +26,13 @@
|
||||||
<div class="col s4"><h2>{{listCount}}</h2></div>
|
<div class="col s4"><h2>{{listCount}}</h2></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{#if isInRole 'systemadmin'}}
|
|
||||||
<div class="card-action">
|
<div class="card-action">
|
||||||
<a href="#" id="usermgmtlink">List Management</a>
|
<a href="#" class="cardLink" id="listMgmtLink">List Management</a>
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col s12 m6 l4">
|
<div class="col s12 m6 l4">
|
||||||
<div class="card blue-grey darken-1">
|
<div class="card blue-grey darken-1" id="prodInfoCard">
|
||||||
<div class="card-content white-text">
|
<div class="card-content white-text">
|
||||||
<span class="card-title"><h4>My Products</h4></span>
|
<span class="card-title"><h4>My Products</h4></span>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
|
@ -42,15 +40,13 @@
|
||||||
<div class="col s4"><h2>{{productCount}}</h2></div>
|
<div class="col s4"><h2>{{productCount}}</h2></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{#if isInRole 'systemadmin'}}
|
|
||||||
<div class="card-action">
|
<div class="card-action">
|
||||||
<a href="#" id="usermgmtlink">Product Management</a>
|
<a href="#" class="cardLink" id="prodMgmtLink">Product Management</a>
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col s12 m6 l4">
|
<div class="col s12 m6 l4">
|
||||||
<div class="card blue-grey darken-1">
|
<div class="card blue-grey darken-1" id="storeInfoCard">
|
||||||
<div class="card-content white-text">
|
<div class="card-content white-text">
|
||||||
<span class="card-title"><h4>My Stores</h4></span>
|
<span class="card-title"><h4>My Stores</h4></span>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
|
@ -58,15 +54,13 @@
|
||||||
<div class="col s4"><h2>{{storeCount}}</h2></div>
|
<div class="col s4"><h2>{{storeCount}}</h2></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{#if isInRole 'systemadmin'}}
|
|
||||||
<div class="card-action">
|
<div class="card-action">
|
||||||
<a href="#" id="usermgmtlink">Store Management</a>
|
<a href="#" class="cardLink" id="storeMgmtLink">Store Management</a>
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col s12 m6 l4">
|
<div class="col s12 m6 l4">
|
||||||
<div class="card blue-grey darken-1">
|
<div class="card blue-grey darken-1" id="catInfoCard">
|
||||||
<div class="card-content white-text">
|
<div class="card-content white-text">
|
||||||
<span class="card-title"><h4>My Categories</h4></span>
|
<span class="card-title"><h4>My Categories</h4></span>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
|
@ -74,11 +68,23 @@
|
||||||
<div class="col s4"><h2>{{catCount}}</h2></div>
|
<div class="col s4"><h2>{{catCount}}</h2></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{#if isInRole 'systemadmin'}}
|
|
||||||
<div class="card-action">
|
<div class="card-action">
|
||||||
<a href="#" id="usermgmtlink">Category Management</a>
|
<a href="#" class="cardLink" id="catMgmtLink">Category Management</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col s12 m6 l4">
|
||||||
|
<div class="card blue-grey darken-1" id="locInfoCard">
|
||||||
|
<div class="card-content white-text">
|
||||||
|
<span class="card-title"><h4>My Locations</h4></span>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col s8"><i class="medium material-icons">map</i></div>
|
||||||
|
<div class="col s4"><h2>{{locCount}}</h2></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="card-action">
|
||||||
|
<a href="#" class="cardLink" id="locationMgmtLink">Location Management</a>
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
import { Categories } from "../../imports/api/category";
|
import { Categories } from "../../imports/api/category";
|
||||||
import { Lists } from "../../imports/api/lists";
|
import { Lists } from "../../imports/api/lists";
|
||||||
|
import { Locations } from "../../imports/api/location";
|
||||||
import { Products } from "../../imports/api/products";
|
import { Products } from "../../imports/api/products";
|
||||||
import { Stores } from "../../imports/api/stores";
|
import { Stores } from "../../imports/api/stores";
|
||||||
|
|
||||||
|
|
@ -10,6 +11,7 @@ Template.dashboard.onCreated(function() {
|
||||||
this.subscribe("myCategories");
|
this.subscribe("myCategories");
|
||||||
this.subscribe("storeInfo");
|
this.subscribe("storeInfo");
|
||||||
this.subscribe("myProducts");
|
this.subscribe("myProducts");
|
||||||
|
this.subscribe("myLocations");
|
||||||
});
|
});
|
||||||
|
|
||||||
Template.dashboard.onRendered(function() {
|
Template.dashboard.onRendered(function() {
|
||||||
|
|
@ -31,12 +33,64 @@ Template.dashboard.helpers({
|
||||||
},
|
},
|
||||||
catCount: function() {
|
catCount: function() {
|
||||||
return Categories.find().count();
|
return Categories.find().count();
|
||||||
|
},
|
||||||
|
locCount: function() {
|
||||||
|
return Locations.find().count();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Template.dashboard.events({
|
Template.dashboard.events({
|
||||||
"click #usermgmtlink" (event) {
|
"click .cardLink" (event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
let link = event.currentTarget.id;
|
||||||
|
switch(link) {
|
||||||
|
case "userMgmtLink":
|
||||||
FlowRouter.go('/userMgmt');
|
FlowRouter.go('/userMgmt');
|
||||||
|
break;
|
||||||
|
case "listMgmtLink":
|
||||||
|
FlowRouter.go('/manageLists');
|
||||||
|
break;
|
||||||
|
case "storeMgmtLink":
|
||||||
|
FlowRouter.go('/manageStore');
|
||||||
|
break;
|
||||||
|
case "prodMgmtLink":
|
||||||
|
FlowRouter.go('/manageProduct');
|
||||||
|
break;
|
||||||
|
case "catMgmtLink":
|
||||||
|
FlowRouter.go('/manageCategory');
|
||||||
|
break;
|
||||||
|
case "locationMgmtLink":
|
||||||
|
FlowRouter.go('/manageLocation');
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
'click .card' (event) {
|
||||||
|
event.preventDefault();
|
||||||
|
let cardId = event.currentTarget.id;
|
||||||
|
|
||||||
|
switch(cardId) {
|
||||||
|
case "userInfoCard":
|
||||||
|
FlowRouter.go('/userMgmt');
|
||||||
|
break;
|
||||||
|
case "listInfoCard":
|
||||||
|
FlowRouter.go("/mylists");
|
||||||
|
break;
|
||||||
|
case "storeInfoCard":
|
||||||
|
FlowRouter.go('/manageStore');
|
||||||
|
break;
|
||||||
|
case "catInfoCard":
|
||||||
|
FlowRouter.go('/manageCategory');
|
||||||
|
break;
|
||||||
|
case "locInfoCard":
|
||||||
|
FlowRouter.go('/manageLocation');
|
||||||
|
break;
|
||||||
|
case "prodInfoCard":
|
||||||
|
FlowRouter.go("/manageProduct");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
34
client/ListItems/listItemsForm.html
Normal file
34
client/ListItems/listItemsForm.html
Normal file
|
|
@ -0,0 +1,34 @@
|
||||||
|
<template name="listItemsForm">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col s6">
|
||||||
|
<h4>{{selListName}}</h4>
|
||||||
|
</div>
|
||||||
|
<div class="col s6">
|
||||||
|
<p>
|
||||||
|
<label>
|
||||||
|
<input type="checkbox" id="showReceivedItems" />
|
||||||
|
<span>Show Recv'd</span>
|
||||||
|
</label>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col s9 m10 l10">
|
||||||
|
<input list="listItemsData" name="listItems" id="listItems">
|
||||||
|
|
||||||
|
<datalist id="listItemsData">
|
||||||
|
{{#each itemProdName}}
|
||||||
|
<option value="{{prodName}}">{{prodName}}</option>
|
||||||
|
{{/each}}
|
||||||
|
</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}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</template>
|
||||||
68
client/ListItems/listItemsForm.js
Normal file
68
client/ListItems/listItemsForm.js
Normal file
|
|
@ -0,0 +1,68 @@
|
||||||
|
import { ListItems } from '../../imports/api/listItems.js'
|
||||||
|
import { Lists } from '../../imports/api/lists.js';
|
||||||
|
import { Products } from '../../imports/api/products.js';
|
||||||
|
|
||||||
|
Template.listItemsForm.onCreated(function() {
|
||||||
|
this.subscribe("myListItems", Session.get("listId"));
|
||||||
|
this.subscribe("myLists");
|
||||||
|
this.subscribe("myProducts");
|
||||||
|
});
|
||||||
|
|
||||||
|
Template.listItemsForm.onRendered(function() {
|
||||||
|
Meteor.setTimeout(function() {
|
||||||
|
$('select').formSelect();
|
||||||
|
}, 100);
|
||||||
|
$('select').formSelect();
|
||||||
|
Session.set("listItemEditMode", false);
|
||||||
|
Session.set("itemReqErr", false);
|
||||||
|
Session.set("showReceivedItems", false);
|
||||||
|
});
|
||||||
|
|
||||||
|
Template.listItemsForm.helpers({
|
||||||
|
selListName: function() {
|
||||||
|
let selListId = Session.get("listId");
|
||||||
|
console.log("List ID in Helper is: " + selListId);
|
||||||
|
let listInfo = Lists.findOne({ _id: selListId });
|
||||||
|
return listInfo.listName;
|
||||||
|
},
|
||||||
|
itemProdName: function() {
|
||||||
|
return Products.find({});
|
||||||
|
},
|
||||||
|
editMode: function() {
|
||||||
|
return Session.get("listItemEditMode");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Template.listItemsForm.events({
|
||||||
|
'click .saveListItem' (event) {
|
||||||
|
event.preventDefault();
|
||||||
|
let item = $("#listItems").val();
|
||||||
|
let listId = Session.get("listId");
|
||||||
|
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.");
|
||||||
|
$("#listItems").val("");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'keypress #listItemInput' (event) {
|
||||||
|
event.preventDefault();
|
||||||
|
|
||||||
|
},
|
||||||
|
'click .editListItem' (event) {
|
||||||
|
event.preventDefault();
|
||||||
|
},
|
||||||
|
'click #showReceivedItems' (event) {
|
||||||
|
if ($("#showReceivedItems").prop('checked') == true) {
|
||||||
|
Session.set("showReceivedItems", true);
|
||||||
|
} else {
|
||||||
|
Session.set("showReceivedItems", false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
5
client/ListItems/listItemsMain.html
Normal file
5
client/ListItems/listItemsMain.html
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
<template name="listItemsMain">
|
||||||
|
{{> listItemsForm}}
|
||||||
|
<hr>
|
||||||
|
{{> listItemsTbl}}
|
||||||
|
</template>
|
||||||
15
client/ListItems/listItemsMain.js
Normal file
15
client/ListItems/listItemsMain.js
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
Template.listItemsMain.onCreated(function() {
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
Template.listItemsMain.onRendered(function() {
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
Template.listItemsMain.helpers({
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
Template.listItemsMain.events({
|
||||||
|
|
||||||
|
});
|
||||||
21
client/ListItems/listItemsTbl.html
Normal file
21
client/ListItems/listItemsTbl.html
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
<template name="listItemsTbl">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col s12">
|
||||||
|
<ul class="collection">
|
||||||
|
{{#each thisListItems}}
|
||||||
|
<li class="collection-item">
|
||||||
|
<span>
|
||||||
|
{{#if $eq itemOrdered true}}
|
||||||
|
<strike>{{itemName}}</strike>
|
||||||
|
{{else}}
|
||||||
|
{{itemName}}
|
||||||
|
{{/if}}
|
||||||
|
</span>
|
||||||
|
<i class="material-icons clickable deleteListItem right">delete</i>
|
||||||
|
<i class="material-icons clickable markListItemReceived right">check</i>
|
||||||
|
</li>
|
||||||
|
{{/each}}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
67
client/ListItems/listItemsTbl.js
Normal file
67
client/ListItems/listItemsTbl.js
Normal file
|
|
@ -0,0 +1,67 @@
|
||||||
|
import { ListItems } from '../../imports/api/listItems.js';
|
||||||
|
|
||||||
|
Template.listItemsTbl.onCreated(function() {
|
||||||
|
this.autorun( () => {
|
||||||
|
this.subscribe("myListItems", Session.get("listId"));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
Template.listItemsTbl.onRendered(function() {
|
||||||
|
Session.set("showReceivedItems", false);
|
||||||
|
});
|
||||||
|
|
||||||
|
Template.listItemsTbl.helpers({
|
||||||
|
'thisListItems': function() {
|
||||||
|
let showRecvd = Session.get("showReceivedItems");
|
||||||
|
console.log("Show Received is: " + showRecvd);
|
||||||
|
if (showRecvd == false) {
|
||||||
|
return ListItems.find({ itemReceived: false });
|
||||||
|
} else {
|
||||||
|
return ListItems.find({});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
Template.listItemsTbl.events({
|
||||||
|
'click li' (event) {
|
||||||
|
event.preventDefault();
|
||||||
|
let itemInfo = ListItems.findOne({ _id: this._id });
|
||||||
|
if (itemInfo.itemOrdered == true) {
|
||||||
|
Meteor.call('setNotOrdered.listItem', this._id, function(err, result) {
|
||||||
|
if (err) {
|
||||||
|
console.log(" ERROR setting this item as NOT ordered: " + err);
|
||||||
|
} else {
|
||||||
|
console.log(" SUCCESS setting this item as NOT ordered.");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
Meteor.call('setOrdered.listItem', this._id, function(err, result) {
|
||||||
|
if (err) {
|
||||||
|
console.log(" ERROR marking item ordered: " + err);
|
||||||
|
} else {
|
||||||
|
console.log(" SUCCESS marking this item ordered.");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'click .markListItemReceived' (event) {
|
||||||
|
event.preventDefault();
|
||||||
|
Meteor.call('setReceived.listItem', this._id, function(err, result) {
|
||||||
|
if (err) {
|
||||||
|
console.log(" ERROR setting item as received: " + err);
|
||||||
|
} else {
|
||||||
|
console.log(" SUCCESS setting item received.");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
'click .deleteListItem' (event) {
|
||||||
|
event.preventDefault();
|
||||||
|
Meteor.call('delete.listItem', this._id, function(err, result) {
|
||||||
|
if (err) {
|
||||||
|
console.log(" ERROR deleting the list item: " + err);
|
||||||
|
} else {
|
||||||
|
console.log(" SUCCESS deleting the list item.");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
4
client/Lists/listsMain.html
Normal file
4
client/Lists/listsMain.html
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
<template name="listsMain">
|
||||||
|
<h4>My Lists</h4>
|
||||||
|
{{> listsTbl}}
|
||||||
|
</template>
|
||||||
16
client/Lists/listsMain.js
Normal file
16
client/Lists/listsMain.js
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
|
||||||
|
Template.listsMain.onCreated(function() {
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
Template.listsMain.onRendered(function() {
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
Template.listsMain.helpers({
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
Template.listsMain.events({
|
||||||
|
|
||||||
|
});
|
||||||
26
client/Lists/listsTbl.html
Normal file
26
client/Lists/listsTbl.html
Normal file
|
|
@ -0,0 +1,26 @@
|
||||||
|
<template name="listsTbl">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col s12">
|
||||||
|
<ul class="collection">
|
||||||
|
{{#each mylists}}
|
||||||
|
<li class="collection-item clickable" id="{{this._id}}">
|
||||||
|
<span class="{{#if $eq listShared true}}green-text{{/if}}">{{listName}}</span>
|
||||||
|
<i class="material-icons clickable markAsComplete right" id="check_{{this._id}}">check</i>
|
||||||
|
</li>
|
||||||
|
{{/each}}
|
||||||
|
<li class="collection-item clickable addNew" id="addList"> + Add New List</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- Modal for the Add List Option -->
|
||||||
|
<div id="modalList" class="modal">
|
||||||
|
<div class="modal-content">
|
||||||
|
<h4>Add New List</h4>
|
||||||
|
{{> listMgmtForm}}
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<a href="#!" class="modal-close waves-effect waves-green btn-flat">Done</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{{> snackbar}}
|
||||||
|
</template>
|
||||||
57
client/Lists/listsTbl.js
Normal file
57
client/Lists/listsTbl.js
Normal file
|
|
@ -0,0 +1,57 @@
|
||||||
|
import { Lists } from '../../imports/api/lists.js';
|
||||||
|
|
||||||
|
Template.listsTbl.onCreated(function() {
|
||||||
|
this.subscribe("myLists");
|
||||||
|
});
|
||||||
|
|
||||||
|
Template.listsTbl.onRendered(function() {
|
||||||
|
$('.modal').modal();
|
||||||
|
});
|
||||||
|
|
||||||
|
Template.listsTbl.helpers({
|
||||||
|
mylists: function() {
|
||||||
|
return Lists.find({});
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
Template.listsTbl.events({
|
||||||
|
'click li.collection-item' (event) {
|
||||||
|
event.preventDefault();
|
||||||
|
let sender = event.target;
|
||||||
|
// console.log("Sender origination from: ");
|
||||||
|
// console.log(sender.localName);
|
||||||
|
if (sender.localName == "li") {
|
||||||
|
let listId = event.currentTarget.id;
|
||||||
|
if (listId == "addList") {
|
||||||
|
$('#modalList').modal('open');
|
||||||
|
} else {
|
||||||
|
console.log("listId is: " + listId);
|
||||||
|
Session.set("listId", listId);
|
||||||
|
Meteor.setTimeout(function() {
|
||||||
|
FlowRouter.go('/listitems');
|
||||||
|
}, 100);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'click i.markAsComplete' (event) {
|
||||||
|
event.preventDefault();
|
||||||
|
let sender = event.target;
|
||||||
|
// console.log("Sender origination from: " );
|
||||||
|
// console.log(sender.localName);
|
||||||
|
if (sender.localName == "i") {
|
||||||
|
let listFullId = event.currentTarget.id;
|
||||||
|
let splitList = listFullId.split("_");
|
||||||
|
let listId = splitList[1];
|
||||||
|
// console.log("listId is " + listId);
|
||||||
|
Meteor.call("mark.complete", listId, function(err, result){
|
||||||
|
if (err) {
|
||||||
|
console.log(" ERROR marking list complete! " + err);
|
||||||
|
showSnackbar("ERROR! List Not Makred Complete!", "red");
|
||||||
|
} else {
|
||||||
|
console.log(" SUCCESS marking list complete.");
|
||||||
|
showSnackbar("List Marked Complete!", "green");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
@ -22,5 +22,20 @@ select.dark-mode {
|
||||||
}
|
}
|
||||||
|
|
||||||
li.collection-item {
|
li.collection-item {
|
||||||
font-size: 24px;
|
font-size: 20px;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
li.collection-item.addNew {
|
||||||
|
background-color: rgb(218, 218, 218);
|
||||||
|
color: #343434;
|
||||||
|
}
|
||||||
|
|
||||||
|
li.collection-item:active {
|
||||||
|
background-color: #bebebe;
|
||||||
|
}
|
||||||
|
|
||||||
|
strike {
|
||||||
|
text-decoration-thickness: 3px;
|
||||||
|
text-decoration-color: red;
|
||||||
}
|
}
|
||||||
|
|
@ -6,8 +6,11 @@
|
||||||
|
|
||||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
||||||
<link href="./lib/assets/materialize.css" rel="stylesheet">
|
<link href="./lib/assets/materialize.css" rel="stylesheet">
|
||||||
|
<link rel="stylesheet" type="text/css" href="https://kraaden.github.io/autocomplete/autocomplete.css">
|
||||||
|
|
||||||
<script type="text/javascript" src="./lib/assets/materialize.js"></script>
|
<script type="text/javascript" src="./lib/assets/materialize.js"></script>
|
||||||
|
<script src="https://kraaden.github.io/autocomplete/autocomplete.js"></script>
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
|
||||||
|
|
@ -14,27 +14,41 @@ ListItems.allow({
|
||||||
});
|
});
|
||||||
|
|
||||||
Meteor.methods({
|
Meteor.methods({
|
||||||
'add.listItem' (itemName, prodId, itemQty, shopListId) {
|
'add.listItem' (itemName, listId) {
|
||||||
check(itemName, String);
|
check(itemName, String);
|
||||||
check(prodId, String);
|
check(listId, String);
|
||||||
check(itemQty, String);
|
|
||||||
check(shopListId, String);
|
|
||||||
|
|
||||||
if (!this.userId) {
|
if (!this.userId) {
|
||||||
throw new Meteor.Error('You are not allowed to add items. Make sure you are logged in with valid user credentials.');
|
throw new Meteor.Error('You are not allowed to add items. Make sure you are logged in with valid user credentials.');
|
||||||
}
|
}
|
||||||
|
|
||||||
// look up the item from the Products collection
|
// look up the item from the Products collection
|
||||||
let prodInfo = Products.findOne({ _id: prodId });
|
let prodInfo = Products.findOne({ prodName: itemName });
|
||||||
|
if (typeof prodInfo == "undefined") {
|
||||||
// look up the shopList by shopListId
|
Meteor.call("add.product", itemName, "", "", "", function(err, result) {
|
||||||
let shopListInfo = ShopLists.findOne({ _id: shopListId });
|
if (err) {
|
||||||
|
console.log(" ERROR adding item to products: " + err);
|
||||||
|
} else {
|
||||||
|
console.log(" SUCCESS adding item to Products.");
|
||||||
return ListItems.insert({
|
return ListItems.insert({
|
||||||
itemName: itemName,
|
itemName: itemName,
|
||||||
prodId: prodId,
|
listId: listId,
|
||||||
itemQty: itemQty,
|
prodId: result,
|
||||||
itemOwner: shopListInfo.ownerId,
|
addedBy: this.userId,
|
||||||
|
itemCategory: "",
|
||||||
|
itemStore: "",
|
||||||
|
itemLocation: "",
|
||||||
|
itemOrdered: false,
|
||||||
|
itemReceived: false,
|
||||||
|
dateAddedToList: new Date(),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
return ListItems.insert({
|
||||||
|
itemName: itemName,
|
||||||
|
listId: listId,
|
||||||
|
prodId: prodInfo._id,
|
||||||
addedBy: this.userId,
|
addedBy: this.userId,
|
||||||
itemCategory: prodInfo.prodCategory,
|
itemCategory: prodInfo.prodCategory,
|
||||||
itemStore: prodInfo.prodStore,
|
itemStore: prodInfo.prodStore,
|
||||||
|
|
@ -43,6 +57,10 @@ Meteor.methods({
|
||||||
itemReceived: false,
|
itemReceived: false,
|
||||||
dateAddedToList: new Date(),
|
dateAddedToList: new Date(),
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
'setOrdered.listItem' (itemId) {
|
'setOrdered.listItem' (itemId) {
|
||||||
check(itemId, String);
|
check(itemId, String);
|
||||||
|
|
@ -109,33 +127,17 @@ Meteor.methods({
|
||||||
// set all items that are not already listed as received to received on this list
|
// set all items that are not already listed as received to received on this list
|
||||||
|
|
||||||
},
|
},
|
||||||
'edit.listItem' (itemId, itemName, prodId, itemQty, shopListId) {
|
'edit.listItem' (itemId, itemName) {
|
||||||
check(itemId, String);
|
check(itemId, String);
|
||||||
check(itemName, String);
|
check(itemName, String);
|
||||||
check(prodId, String);
|
|
||||||
check(itemQty, String);
|
|
||||||
check(shopListId, String);
|
|
||||||
|
|
||||||
if (!this.userId) {
|
if (!this.userId) {
|
||||||
throw new Meteor.Error('You are not allowed to add items. Make sure you are logged in with valid user credentials.');
|
throw new Meteor.Error('You are not allowed to add items. Make sure you are logged in with valid user credentials.');
|
||||||
}
|
}
|
||||||
|
|
||||||
// look up the item from the Products collection
|
|
||||||
let prodInfo = Products.findOne({ _id: prodId });
|
|
||||||
|
|
||||||
// look up the shopList by shopListId
|
|
||||||
let shopListInfo = ShopLists.findOne({ _id: shopListId });
|
|
||||||
|
|
||||||
return ListItems.update({ _id: itemId }, {
|
return ListItems.update({ _id: itemId }, {
|
||||||
$set: {
|
$set: {
|
||||||
itemName: itemName,
|
itemName: itemName,
|
||||||
prodId: prodId,
|
|
||||||
itemQty: itemQty,
|
|
||||||
itemOwner: shopListInfo.ownerId,
|
|
||||||
editedBy: this.userId,
|
|
||||||
itemCategory: prodInfo.prodCategory,
|
|
||||||
itemStore: prodInfo.prodStore,
|
|
||||||
itemLocation: prodInfo.prodLocation,
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
@ -146,13 +148,6 @@ Meteor.methods({
|
||||||
throw new Meteor.Error('You are not allowed to delete list items. Make sure you are logged in with valid user credentials.');
|
throw new Meteor.Error('You are not allowed to delete list items. Make sure you are logged in with valid user credentials.');
|
||||||
}
|
}
|
||||||
|
|
||||||
let itemInfo = ListItems.findOne({ _id: itemId });
|
|
||||||
let myId = this.userId;
|
|
||||||
if (myId == itemInfo.owner) {
|
|
||||||
return ListItems.remove({ _id: itemId });
|
return ListItems.remove({ _id: itemId });
|
||||||
} else {
|
|
||||||
console.log("User not allowed to delete this list item. Not the owner!");
|
|
||||||
return("Not Allowed!");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -12,8 +12,9 @@ Lists.allow({
|
||||||
});
|
});
|
||||||
|
|
||||||
Meteor.methods({
|
Meteor.methods({
|
||||||
'add.list' (listName) {
|
'add.list' (listName, isShared) {
|
||||||
check(listName, String);
|
check(listName, String);
|
||||||
|
check(isShared, Boolean);
|
||||||
|
|
||||||
if (!this.userId) {
|
if (!this.userId) {
|
||||||
throw new Meteor.Error('You are not allowed to add lists. Make sure you are logged in with valid user credentials.');
|
throw new Meteor.Error('You are not allowed to add lists. Make sure you are logged in with valid user credentials.');
|
||||||
|
|
@ -21,13 +22,15 @@ Meteor.methods({
|
||||||
|
|
||||||
return Lists.insert({
|
return Lists.insert({
|
||||||
listName: listName,
|
listName: listName,
|
||||||
|
listShared: isShared,
|
||||||
listOwner: this.userId,
|
listOwner: this.userId,
|
||||||
listComplete: false,
|
listComplete: false,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
'edit.list' (listId, listName) {
|
'edit.list' (listId, listName, isShared) {
|
||||||
check(listId, String);
|
check(listId, String);
|
||||||
check(listName, String);
|
check(listName, String);
|
||||||
|
check(isShared, Boolean);
|
||||||
|
|
||||||
if (!this.userId) {
|
if (!this.userId) {
|
||||||
throw new Meteor.Error('You are not allowed to edit lists. Make sure you are logged in with valid user credentials.');
|
throw new Meteor.Error('You are not allowed to edit lists. Make sure you are logged in with valid user credentials.');
|
||||||
|
|
@ -36,6 +39,7 @@ Meteor.methods({
|
||||||
return Lists.update({ _id: listId }, {
|
return Lists.update({ _id: listId }, {
|
||||||
$set: {
|
$set: {
|
||||||
listName: listName,
|
listName: listName,
|
||||||
|
listShared: isShared,
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
@ -62,18 +66,11 @@ Meteor.methods({
|
||||||
throw new Meteor.Error('You are not allowed to mark lists complete. Make sure you are logged in with valid user credentials.');
|
throw new Meteor.Error('You are not allowed to mark lists complete. Make sure you are logged in with valid user credentials.');
|
||||||
}
|
}
|
||||||
|
|
||||||
let listInfo = Lists.findOne({ _id: listId });
|
|
||||||
let myId = this.userId;
|
|
||||||
if (myId == listInfo.listOwner) {
|
|
||||||
return Lists.update({ _id: listId }, {
|
return Lists.update({ _id: listId }, {
|
||||||
$set: {
|
$set: {
|
||||||
listComplete: true,
|
listComplete: true,
|
||||||
completedOn: new Date()
|
completedOn: new Date()
|
||||||
}
|
}
|
||||||
});
|
});;
|
||||||
} else {
|
|
||||||
console.log("User not allowed to mark lists complete. Not a member of the list!");
|
|
||||||
return("Not Allowed!");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -41,7 +41,7 @@ Meteor.methods({
|
||||||
throw new Meteor.Error('You are not allowed to edit products. Make sure you are logged in with valid user credentials.');
|
throw new Meteor.Error('You are not allowed to edit products. Make sure you are logged in with valid user credentials.');
|
||||||
}
|
}
|
||||||
|
|
||||||
return Products.update({ _id: itemId }, {
|
return Products.update({ _id: prodId }, {
|
||||||
$set: {
|
$set: {
|
||||||
prodName: prodName,
|
prodName: prodName,
|
||||||
prodCategory: prodCategory,
|
prodCategory: prodCategory,
|
||||||
|
|
@ -59,7 +59,7 @@ Meteor.methods({
|
||||||
|
|
||||||
let prodInfo = Products.findOne({ _id: prodId });
|
let prodInfo = Products.findOne({ _id: prodId });
|
||||||
let myId = this.userId;
|
let myId = this.userId;
|
||||||
if (myId == prodInfo.owner) {
|
if (myId == prodInfo.prodOwner) {
|
||||||
return Products.remove({ _id: prodId });
|
return Products.remove({ _id: prodId });
|
||||||
} else {
|
} else {
|
||||||
console.log("User not allowed to delete this product. Not the owner!");
|
console.log("User not allowed to delete this product. Not the owner!");
|
||||||
|
|
|
||||||
|
|
@ -12,26 +12,21 @@ Stores.allow({
|
||||||
});
|
});
|
||||||
|
|
||||||
Meteor.methods({
|
Meteor.methods({
|
||||||
'add.store' (storeName, storeType) {
|
'add.store' (storeName) {
|
||||||
check(storeName, String);
|
check(storeName, String);
|
||||||
check(storeType, String);
|
|
||||||
|
|
||||||
if (!this.userId) {
|
if (!this.userId) {
|
||||||
throw new Meteor.Error('You are not allowed to add stores. Make sure you are logged in with valid user credentials.');
|
throw new Meteor.Error('You are not allowed to add stores. Make sure you are logged in with valid user credentials.');
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(" ---- userid: " + Meteor.user()._id);
|
|
||||||
|
|
||||||
return Stores.insert({
|
return Stores.insert({
|
||||||
storeName: storeName,
|
storeName: storeName,
|
||||||
storeType: storeType,
|
owner: this.userId,
|
||||||
owner: Meteor.user()._id,
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
'edit.store' (storeId, storeName, storeType) {
|
'edit.store' (storeId, storeName) {
|
||||||
check(storeId, String);
|
check(storeId, String);
|
||||||
check(storeName, String);
|
check(storeName, String);
|
||||||
check(storeType, String);
|
|
||||||
|
|
||||||
if (!this.userId) {
|
if (!this.userId) {
|
||||||
throw new Meteor.Error('You are not allowed to edit stores. Make sure you are logged in with valid user credentials.');
|
throw new Meteor.Error('You are not allowed to edit stores. Make sure you are logged in with valid user credentials.');
|
||||||
|
|
@ -40,7 +35,6 @@ Meteor.methods({
|
||||||
return Stores.update({ _id: storeId }, {
|
return Stores.update({ _id: storeId }, {
|
||||||
$set: {
|
$set: {
|
||||||
storeName: storeName,
|
storeName: storeName,
|
||||||
storeType: storeType,
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -81,3 +81,17 @@ FlowRouter.route('/manageLists', {
|
||||||
BlazeLayout.render('MainLayout', { main: 'listMgmt' });
|
BlazeLayout.render('MainLayout', { main: 'listMgmt' });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
FlowRouter.route('/mylists', {
|
||||||
|
name: 'mylists',
|
||||||
|
action() {
|
||||||
|
BlazeLayout.render('MainLayout', { main: 'listsMain' });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
FlowRouter.route('/listItems', {
|
||||||
|
name: 'listItems',
|
||||||
|
action() {
|
||||||
|
BlazeLayout.render('MainLayout', { main: 'listItemsMain' });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
@ -3,6 +3,8 @@ import { Meteor } from 'meteor/meteor';
|
||||||
Meteor.startup(() => {
|
Meteor.startup(() => {
|
||||||
// code to run on server at startup
|
// code to run on server at startup
|
||||||
Roles.createRole("user", {unlessExists: true});
|
Roles.createRole("user", {unlessExists: true});
|
||||||
|
Roles.createRole("groupLeader", {unlessExists: true});
|
||||||
|
Roles.createRole("groupMember", {unlessExists: true});
|
||||||
Roles.createRole("admin", {unlessExists: true});
|
Roles.createRole("admin", {unlessExists: true});
|
||||||
Roles.createRole("systemadmin", {unlessExists: true});
|
Roles.createRole("systemadmin", {unlessExists: true});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import { Products } from '../imports/api/products.js';
|
||||||
import { Categories } from '../imports/api/category.js';
|
import { Categories } from '../imports/api/category.js';
|
||||||
import { Locations } from '../imports/api/location.js';
|
import { Locations } from '../imports/api/location.js';
|
||||||
import { Lists } from '../imports/api/lists.js';
|
import { Lists } from '../imports/api/lists.js';
|
||||||
|
import { ListItems } from '../imports/api/listItems.js';
|
||||||
|
|
||||||
Meteor.publish("SystemConfig", function() {
|
Meteor.publish("SystemConfig", function() {
|
||||||
try {
|
try {
|
||||||
|
|
@ -52,8 +53,17 @@ Meteor.publish("myLocations", function() {
|
||||||
|
|
||||||
Meteor.publish("myLists", function() {
|
Meteor.publish("myLists", function() {
|
||||||
try {
|
try {
|
||||||
return Lists.find({ listOwner: this.userId, listComplete: false });
|
return Lists.find( { $or: [ { listOwner: this.userId, listComplete: false }, { listShared: true, listComplete: false } ] } );
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(" ERROR pulling list data: " + error);
|
console.log(" ERROR pulling list data: " + error);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Meteor.publish("myListItems", function(listId) {
|
||||||
|
try {
|
||||||
|
console.log("List Id is: " + listId);
|
||||||
|
return ListItems.find({ listId: listId });
|
||||||
|
} catch (error) {
|
||||||
|
console.log(" ERROR pulling list items for this list: " + error);
|
||||||
|
}
|
||||||
|
});
|
||||||
Loading…
Add table
Add a link
Reference in a new issue