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
|
|
@ -1,6 +1,8 @@
|
|||
<template name="catMgmt">
|
||||
<h4>Category Management</h4>
|
||||
{{> catMgmtForm}}
|
||||
<hr>
|
||||
{{> catMgmtTbl}}
|
||||
<div class="container">
|
||||
<h4>Category Management</h4>
|
||||
{{> catMgmtForm}}
|
||||
<hr>
|
||||
{{> catMgmtTbl}}
|
||||
</div>
|
||||
</template>
|
||||
|
|
@ -1,16 +1,22 @@
|
|||
<template name="catMgmtForm">
|
||||
<div class="row">
|
||||
<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}}" />
|
||||
<label for="catNameInp">Name*</label>
|
||||
<form action="submit" id="catInputForm">
|
||||
<div class="row">
|
||||
<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}}" />
|
||||
<label for="catNameInp">Name*</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col s6 m6 l6">
|
||||
<a class="waves-effect waves-light btn cancelCatMgmt orange">Cancel</a>
|
||||
<div class="row">
|
||||
<div class="col s6 m6 l6">
|
||||
<a class="waves-effect waves-light btn cancelCatMgmt orange">Cancel</a>
|
||||
</div>
|
||||
<div class="col s6 m6 l6">
|
||||
{{#if $eq catEditMode false}}
|
||||
<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 class="col s6 m6 l6">
|
||||
<a class="waves-effect waves-light btn saveCatMgmt green right">Add</a>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</template>
|
||||
|
|
@ -6,12 +6,16 @@ Template.catMgmtForm.onCreated(function() {
|
|||
|
||||
Template.catMgmtForm.onRendered(function() {
|
||||
Session.set("catNameMiss", false);
|
||||
Session.set("catEditMode", false);
|
||||
});
|
||||
|
||||
Template.catMgmtForm.helpers({
|
||||
catNameErr: function() {
|
||||
return Session.get("catNameMiss");
|
||||
},
|
||||
catEditMode: function() {
|
||||
return Session.get("catEditMode");
|
||||
}
|
||||
});
|
||||
|
||||
Template.catMgmtForm.events({
|
||||
|
|
@ -32,8 +36,60 @@ Template.catMgmtForm.events({
|
|||
});
|
||||
}
|
||||
},
|
||||
'click .editCatMgmt' (event) {
|
||||
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("");
|
||||
}
|
||||
});
|
||||
} 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}}
|
||||
<li class="collection-item">
|
||||
{{categoryName}}
|
||||
<i class="material-icons clickable deleteCategory right">delete</i>
|
||||
<i class="material-icons clickable editCategory right">edit</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 tooltipped" data-position="top" data-tooltip="Edit Category">edit</i>
|
||||
</li>
|
||||
{{/each}}
|
||||
</ul>
|
||||
|
|
|
|||
|
|
@ -5,7 +5,9 @@ Template.catMgmtTbl.onCreated(function() {
|
|||
});
|
||||
|
||||
Template.catMgmtTbl.onRendered(function() {
|
||||
|
||||
Meteor.setTimeout(function() {
|
||||
$('.tooltipped').tooltip();
|
||||
}, 150);
|
||||
});
|
||||
|
||||
Template.catMgmtTbl.helpers({
|
||||
|
|
@ -15,5 +17,21 @@ Template.catMgmtTbl.helpers({
|
|||
});
|
||||
|
||||
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" />
|
||||
<label for="listNameInp">List Name</label>
|
||||
</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}}
|
||||
<a class="waves-effect waves-light btn saveListMgmt green right">Add</a>
|
||||
{{else}}
|
||||
|
|
|
|||
|
|
@ -22,17 +22,19 @@ Template.listMgmtForm.events({
|
|||
'click .saveListMgmt' (event) {
|
||||
event.preventDefault();
|
||||
let listName = $("#listNameInp").val();
|
||||
let shared = $("#isShared").prop('checked');
|
||||
|
||||
if (listName == null || listName == "") {
|
||||
Session.set("listNameMiss", true);
|
||||
return;
|
||||
} else {
|
||||
Meteor.call('add.list', listName, function(err, result) {
|
||||
Meteor.call('add.list', listName, shared, function(err, result) {
|
||||
if (err) {
|
||||
console.log(" ERROR adding list name: " + err);
|
||||
} else {
|
||||
console.log(" SUCCESS adding list name.");
|
||||
$("#listNameInp").val("");
|
||||
$("#isShared").prop("checked", false);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -40,18 +42,20 @@ Template.listMgmtForm.events({
|
|||
'click .renameListMgmt' (event) {
|
||||
event.preventDefault();
|
||||
let listName = $("#listNameInp").val();
|
||||
let shared = $("#isShared").prop('checked');
|
||||
let listId = Session.get("listItemId");
|
||||
|
||||
if (listName == null || listName == "") {
|
||||
Session.set("listNameMiss", true);
|
||||
return;
|
||||
} else {
|
||||
Meteor.call('edit.list', listId, listName, function(err, result) {
|
||||
Meteor.call('edit.list', listId, listName, shared, function(err, result) {
|
||||
if (err) {
|
||||
console.log(" ERROR editing list name: " + err);
|
||||
} else {
|
||||
console.log(" SUCCESS editing list name.");
|
||||
$("#listNameInp").val("");
|
||||
$("#isShared").prop("checked", false);
|
||||
Session.set("listNameEditMode", false);
|
||||
}
|
||||
});
|
||||
|
|
@ -60,6 +64,7 @@ Template.listMgmtForm.events({
|
|||
'submit .listAdd' (event) {
|
||||
event.preventDefault();
|
||||
let editMode = Session.get("listNameEditMode");
|
||||
let shared = $("#isShared").prop("checked");
|
||||
let listName = $("#listNameInp").val();
|
||||
let listId = Session.get("listItemId");
|
||||
|
||||
|
|
@ -68,21 +73,23 @@ Template.listMgmtForm.events({
|
|||
return;
|
||||
} else {
|
||||
if (editMode == false) {
|
||||
Meteor.call('add.list', listName, function(err, result) {
|
||||
Meteor.call('add.list', listName, shared, function(err, result) {
|
||||
if (err) {
|
||||
console.log(" ERROR adding list name: " + err);
|
||||
} else {
|
||||
console.log(" SUCCESS adding list name.");
|
||||
$("#listNameInp").val("");
|
||||
$("#isShared").prop("checked", false);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
Meteor.call('edit.list', listId, listName, function(err, result) {
|
||||
Meteor.call('edit.list', listId, listName, shared, function(err, result) {
|
||||
if (err) {
|
||||
console.log(" ERROR editing list name: " + err);
|
||||
} else {
|
||||
console.log(" SUCCESS editing list name.");
|
||||
$("#listNameInp").val("");
|
||||
$("#isShared").prop("checked", false);
|
||||
Session.set("listNameEditMode", false);
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
<ul class="collection">
|
||||
{{#each lists}}
|
||||
<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 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>
|
||||
|
|
|
|||
|
|
@ -5,7 +5,9 @@ Template.listMgmtTbl.onCreated(function() {
|
|||
});
|
||||
|
||||
Template.listMgmtTbl.onRendered(function() {
|
||||
$('.tooltipped').tooltip();
|
||||
Meteor.setTimeout(function() {
|
||||
$('.tooltipped').tooltip();
|
||||
}, 150);
|
||||
});
|
||||
|
||||
Template.listMgmtTbl.helpers({
|
||||
|
|
@ -28,8 +30,15 @@ Template.listMgmtTbl.events({
|
|||
},
|
||||
'click .editListName' (event) {
|
||||
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);
|
||||
if (listShared == true) {
|
||||
$("#isShared").prop("checked", true);
|
||||
} else {
|
||||
$("#isShared").prop("checked", false);
|
||||
}
|
||||
Session.set("listNameEditMode", true);
|
||||
Session.set("listItemId", this._id);
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1,5 +1,8 @@
|
|||
<template name="locMgmt">
|
||||
{{> locMgmtForm}}
|
||||
<hr>
|
||||
{{> locMgmtTbl}}
|
||||
<div class="container">
|
||||
<h4>Location Management</h4>
|
||||
{{> locMgmtForm}}
|
||||
<hr>
|
||||
{{> locMgmtTbl}}
|
||||
</div>
|
||||
</template>
|
||||
|
|
@ -1,16 +1,22 @@
|
|||
<template name="locMgmtForm">
|
||||
<div class="row">
|
||||
<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}}" />
|
||||
<label for="locNameInp">Name*</label>
|
||||
<form action="" id="locInputForm">
|
||||
<div class="row">
|
||||
<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}}" />
|
||||
<label for="locNameInp">Name*</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col s6 m6 l6">
|
||||
<a class="waves-effect waves-light btn cancelLocMgmt orange">Cancel</a>
|
||||
<div class="row">
|
||||
<div class="col s6 m6 l6">
|
||||
<a class="waves-effect waves-light btn cancelLocMgmt orange">Cancel</a>
|
||||
</div>
|
||||
<div class="col s6 m6 l6">
|
||||
{{#if $eq locEditMode false}}
|
||||
<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 class="col s6 m6 l6">
|
||||
<a class="waves-effect waves-light btn saveLocMgmt green right">Add</a>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</template>
|
||||
|
|
@ -6,12 +6,16 @@ Template.locMgmtForm.onCreated(function() {
|
|||
|
||||
Template.locMgmtForm.onRendered(function() {
|
||||
Session.set("locNameMiss", false);
|
||||
Session.set("locEditMode", false);
|
||||
});
|
||||
|
||||
Template.locMgmtForm.helpers({
|
||||
locNameErr: function() {
|
||||
return Session.get("locNameMiss");
|
||||
},
|
||||
locEditMode: function() {
|
||||
return Session.get("locEditMode");
|
||||
}
|
||||
});
|
||||
|
||||
Template.locMgmtForm.events({
|
||||
|
|
@ -32,8 +36,60 @@ Template.locMgmtForm.events({
|
|||
});
|
||||
}
|
||||
},
|
||||
'click .editLocMgmt' (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 {
|
||||
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("");
|
||||
}
|
||||
});
|
||||
} 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">
|
||||
<table class="highlight striped responsive-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{#each locs}}
|
||||
<tr>
|
||||
<td>{{locationName}}</td>
|
||||
<td>
|
||||
<i class="material-icons clickable deleteCategory">delete</i>
|
||||
<i class="material-icons clickable editCategory">edit</i>
|
||||
</td>
|
||||
</tr>
|
||||
{{/each}}
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="row">
|
||||
<div class="col s12">
|
||||
<ul class="collection">
|
||||
{{#each locs}}
|
||||
<li class="collection-item">
|
||||
{{locationName}}
|
||||
<i class="material-icons clickable deleteLocation right tooltipped" data-position="top" data-tooltip="Delete Location">delete</i>
|
||||
<i class="material-icons clickable editLocation right tooltipped" data-position="top" data-tooltip="Edit Location">edit</i>
|
||||
</li>
|
||||
{{/each}}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
|
@ -5,7 +5,9 @@ Template.locMgmtTbl.onCreated(function() {
|
|||
});
|
||||
|
||||
Template.locMgmtTbl.onRendered(function() {
|
||||
|
||||
Meteor.setTimeout(function() {
|
||||
$('.tooltipped').tooltip();
|
||||
}, 150);
|
||||
});
|
||||
|
||||
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">
|
||||
<li class="collection-header"><h4>Management</h4></li>
|
||||
{{#if isInRole "systemadmin"}}
|
||||
<li><a href="#!" id="userMgmt" class="collection-item">User Management</a></li>
|
||||
<li class="collection-item" id="userMgmt">Users</li>
|
||||
{{/if}}
|
||||
<li><a href="#!" id="manageLists" class="collection-item">List</a></li>
|
||||
<li><a href="#!" id="manageCategory" class="collection-item">Category</a></li>
|
||||
<li><a href="#!" id="manageProduct" class="collection-item">Product</a></li>
|
||||
<li><a href="#!" id="manageLocation" class="collection-item">Location</a></li>
|
||||
<li><a href="#!" id="manageStore" class="collection-item">Store</a></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>
|
||||
<li id="manageLists" class="collection-item">Lists</li>
|
||||
<li id="manageProduct" class="collection-item">Product</li>
|
||||
<li id="manageCategory" class="collection-item">Category</li>
|
||||
<li id="manageLocation" class="collection-item">Location</li>
|
||||
<li id="manageStore" class="collection-item">Store</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,51 +1,57 @@
|
|||
<template name="prodMgmtForm">
|
||||
<h4>Product Management</h4>
|
||||
<div class="row">
|
||||
<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" />
|
||||
<label for="prodName">Name*</label>
|
||||
<form action="submit" class="prodInputForm">
|
||||
<div class="row">
|
||||
<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" />
|
||||
<label for="prodName">Name*</label>
|
||||
</div>
|
||||
<div class="col s12 m6 l6 input-field">
|
||||
<select name="prodCategory" id="prodCategory" class="prodCategory">
|
||||
<option value="" disabled selected></option>
|
||||
{{#each category}}
|
||||
<option value="{{categoryName}}">{{categoryName}}</option>
|
||||
{{/each}}
|
||||
<option id="addNewCategory" value="addNewCat">Add New Category</option>
|
||||
</select>
|
||||
<label for="prodCategory">Category</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col s12 m6 l6 input-field">
|
||||
<select name="prodCategory" id="prodCategory" class="prodCategory">
|
||||
<option value="" disabled selected></option>
|
||||
{{#each category}}
|
||||
<option value="{{categoryName}}">{{categoryName}}</option>
|
||||
{{/each}}
|
||||
<option id="addNewCategory" value="addNewCat">Add New Category</option>
|
||||
</select>
|
||||
<label for="prodCategory">Category</label>
|
||||
<div class="row">
|
||||
<div class="col s12 m6 l6 input-field">
|
||||
<select name="prodStore" id="prodStore" class="prodStore">
|
||||
<option value="" disabled selected></option>
|
||||
{{#each stores}}
|
||||
<option value="{{storeName}}">{{storeName}}</option>
|
||||
{{/each}}
|
||||
<option id="addNewStore" value="addNewStore">Add New Store</option>
|
||||
</select>
|
||||
<label for="prodStore">Store</label>
|
||||
</div>
|
||||
<div class="col s12 m6 l6 input-field">
|
||||
<select name="prodLocation" id="prodLocation" class="prodLocation {{#if $eq darkmode true}}dark-mode{{/if}}">
|
||||
<option value="" disabled selected></option>
|
||||
{{#each locations}}
|
||||
<option value="{{locationName}}">{{locationName}}</option>
|
||||
{{/each}}
|
||||
<option id="addNewLocation" value="addNewLocation">Add New Location</option>
|
||||
</select>
|
||||
<label for="prodLocation">Location</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col s12 m6 l6 input-field">
|
||||
<select name="prodStore" id="prodStore" class="prodStore">
|
||||
<option value="" disabled selected></option>
|
||||
{{#each stores}}
|
||||
<option value="{{storeName}}">{{storeName}}</option>
|
||||
{{/each}}
|
||||
<option id="addNewStore" value="addNewStore">Add New Store</option>
|
||||
</select>
|
||||
<label for="prodStore">Store</label>
|
||||
<div class="row">
|
||||
<div class="col s6 m6 l6">
|
||||
<a class="waves-effect waves-light btn cancelProdMgmt orange">Cancel</a>
|
||||
</div>
|
||||
<div class="col s6 m6 l6">
|
||||
{{#if $eq prodEditMode false}}
|
||||
<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 class="col s12 m6 l6 input-field">
|
||||
<select name="prodLocation" id="prodLocation" class="prodLocation {{#if $eq darkmode true}}dark-mode{{/if}}">
|
||||
<option value="" disabled selected></option>
|
||||
{{#each locations}}
|
||||
<option value="{{locationName}}">{{locationName}}</option>
|
||||
{{/each}}
|
||||
<option id="addNewLocation" value="addNewLocation">Add New Location</option>
|
||||
</select>
|
||||
<label for="prodLocation">Location</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col s6 m6 l6">
|
||||
<a class="waves-effect waves-light btn cancelProdMgmt orange">Cancel</a>
|
||||
</div>
|
||||
<div class="col s6 m6 l6">
|
||||
<a class="waves-effect waves-light btn saveProdMgmt green right">Add</a>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<!-- Store Modal Structure -->
|
||||
<div id="modalStore" class="modal">
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ Template.prodMgmtForm.onRendered(function() {
|
|||
}, 200);
|
||||
$('select').formSelect();
|
||||
$('.modal').modal();
|
||||
Session.set("prodEditMode", false);
|
||||
});
|
||||
|
||||
Template.prodMgmtForm.helpers({
|
||||
|
|
@ -31,12 +32,15 @@ Template.prodMgmtForm.helpers({
|
|||
locations: function() {
|
||||
return Locations.find({});
|
||||
},
|
||||
prodEditMode: function() {
|
||||
return Session.get("prodEditMode");
|
||||
},
|
||||
});
|
||||
|
||||
Template.prodMgmtForm.events({
|
||||
'click .saveProdMgmt' (event) {
|
||||
event.preventDefault();
|
||||
let name=$("#prodName").val();
|
||||
let name = $("#prodName").val();
|
||||
let cat = $("#prodCategory").val();
|
||||
let store = $("#prodStore").val();
|
||||
let location = $("#prodLocation").val();
|
||||
|
|
@ -66,16 +70,112 @@ Template.prodMgmtForm.events({
|
|||
$("#prodCategory").val("");
|
||||
$("#prodStore").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) {
|
||||
event.preventDefault();
|
||||
$("#prodName").val("");
|
||||
$("#prodCategory").val("");
|
||||
$("#prodStore").val("");
|
||||
$("#prodLocation").val("");
|
||||
$('select').formSelect();
|
||||
},
|
||||
'change #prodStore' (event) {
|
||||
event.preventDefault();
|
||||
|
|
|
|||
|
|
@ -19,8 +19,8 @@
|
|||
<td>{{prodStore}}</td>
|
||||
<td>{{prodLocation}}</td>
|
||||
<td>
|
||||
<i class="material-icons clickable deleteProduct">delete</i>
|
||||
<i class="material-icons clickable editProduct">edit</i>
|
||||
<i class="material-icons clickable deleteProduct tooltipped" data-position="top" data-tooltip="Delete Product">delete</i>
|
||||
<i class="material-icons clickable editProduct tooltipped" data-position="top" data-tooltip="Edit Product">edit</i>
|
||||
</td>
|
||||
</tr>
|
||||
{{/each}}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,9 @@ Template.prodMgmtTbl.onCreated(function() {
|
|||
});
|
||||
|
||||
Template.prodMgmtTbl.onRendered(function() {
|
||||
|
||||
Meteor.setTimeout(function() {
|
||||
$('.tooltipped').tooltip();
|
||||
}, 150);
|
||||
});
|
||||
|
||||
Template.prodMgmtTbl.helpers({
|
||||
|
|
@ -15,5 +17,25 @@ Template.prodMgmtTbl.helpers({
|
|||
});
|
||||
|
||||
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">
|
||||
<!-- Store Management Entry / Edit -->
|
||||
<h4>Store Management</h4>
|
||||
<p>Add Stores you commonly make lists for here.</p>
|
||||
|
||||
{{> storeMgmtForm}}
|
||||
<!-- Store Management Table List -->
|
||||
<hr>
|
||||
{{> storeMgmtTbl}}
|
||||
|
||||
<div class="container">
|
||||
<h4>Store Management</h4>
|
||||
{{> storeMgmtForm}}
|
||||
<hr>
|
||||
{{> storeMgmtTbl}}
|
||||
</div>
|
||||
</template>
|
||||
|
|
@ -1,20 +1,22 @@
|
|||
<template name="storeMgmtForm">
|
||||
<div class="row">
|
||||
<div class="col s12 m6 l6 input-field">
|
||||
<input type="text" class="storeName" id="storeName" />
|
||||
<label for="storeName">Name</label>
|
||||
<form id="storeForm" action="submit">
|
||||
<div class="row">
|
||||
<div class="col s12 input-field">
|
||||
<input type="text" class="storeName" id="storeName" />
|
||||
<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 class="row">
|
||||
<div class="col s6 m6 l6">
|
||||
<a class="waves-effect waves-light btn cancelStoreMgmt orange">Cancel</a>
|
||||
</div>
|
||||
<div class="col s6 m6 l6">
|
||||
{{#if $eq editModeStore false}}
|
||||
<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 class="row">
|
||||
<div class="col s6 m6 l6">
|
||||
<a class="waves-effect waves-light btn cancelStoreMgmt orange">Cancel</a>
|
||||
</div>
|
||||
<div class="col s6 m6 l6">
|
||||
<a class="waves-effect waves-light btn saveStoreMgmt green right">Add</a>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</template>
|
||||
|
|
@ -6,28 +6,83 @@ Template.storeMgmtForm.onCreated(function() {
|
|||
|
||||
Template.storeMgmtForm.onRendered(function() {
|
||||
Session.set("borderRed", false);
|
||||
Session.set("editModeStore", false);
|
||||
});
|
||||
|
||||
Template.storeMgmtForm.helpers({
|
||||
|
||||
editModeStore: function() {
|
||||
return Session.get("editModeStore");
|
||||
}
|
||||
});
|
||||
|
||||
Template.storeMgmtForm.events({
|
||||
'click .saveStoreMgmt' (event) {
|
||||
event.preventDefault();
|
||||
let storeName = $("#storeName").val();
|
||||
let storeType = $("#storeType").val();
|
||||
if (storeName == "" || storeName == null) {
|
||||
Session.set("borderRed", true);
|
||||
return;
|
||||
} else {
|
||||
Meteor.call("add.store", storeName, storeType, function(err, result) {
|
||||
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("");
|
||||
$("#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">
|
||||
<table class="highlight striped responsive-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Store Name</th>
|
||||
<th>Type</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{#each mgmtStoreInfo}}
|
||||
<tr>
|
||||
<td>
|
||||
<div class="row">
|
||||
<div class="col s12">
|
||||
<ul class="collection">
|
||||
{{#each mgmtStoreInfo}}
|
||||
<li class="collection-item">
|
||||
{{storeName}}
|
||||
</td>
|
||||
<td>
|
||||
{{storeType}}
|
||||
</td>
|
||||
<td>
|
||||
<i class="material-icons clickable deleteStore">delete</i>
|
||||
<i class="material-icons clickable editStore">edit</i>
|
||||
</td>
|
||||
</tr>
|
||||
{{/each}}
|
||||
</tbody>
|
||||
</table>
|
||||
<i class="material-icons clickable deleteStore right tooltipped" data-position="top" data-tooltip="Delete Store">delete</i>
|
||||
<i class="material-icons clickable editStore right tooltipped" data-position="top" data-tooltip="Edit Store Name">edit</i>
|
||||
</li>
|
||||
{{/each}}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
|
@ -5,7 +5,9 @@ Template.storeMgmtTbl.onCreated(function() {
|
|||
});
|
||||
|
||||
Template.storeMgmtTbl.onRendered(function() {
|
||||
|
||||
Meteor.setTimeout(function() {
|
||||
$('.tooltipped').tooltip();
|
||||
}, 150);
|
||||
});
|
||||
|
||||
Template.storeMgmtTbl.helpers({
|
||||
|
|
@ -17,10 +19,19 @@ Template.storeMgmtTbl.helpers({
|
|||
Template.storeMgmtTbl.events({
|
||||
'click .deleteStore' (event) {
|
||||
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) {
|
||||
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">
|
||||
{{#if isInRole 'systemadmin'}}
|
||||
<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">
|
||||
<span class="card-title"><h4>Users</h4></span>
|
||||
<div class="row">
|
||||
|
|
@ -12,13 +12,13 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="card-action">
|
||||
<a href="#" id="usermgmtlink">User Management</a>
|
||||
<a href="#" class="cardLink" id="userMgmtLink">User Management</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{/if}}
|
||||
<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">
|
||||
<span class="card-title"><h4>My Lists</h4></span>
|
||||
<div class="row">
|
||||
|
|
@ -26,15 +26,13 @@
|
|||
<div class="col s4"><h2>{{listCount}}</h2></div>
|
||||
</div>
|
||||
</div>
|
||||
{{#if isInRole 'systemadmin'}}
|
||||
<div class="card-action">
|
||||
<a href="#" id="usermgmtlink">List Management</a>
|
||||
<a href="#" class="cardLink" id="listMgmtLink">List Management</a>
|
||||
</div>
|
||||
{{/if}}
|
||||
</div>
|
||||
</div>
|
||||
<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">
|
||||
<span class="card-title"><h4>My Products</h4></span>
|
||||
<div class="row">
|
||||
|
|
@ -42,15 +40,13 @@
|
|||
<div class="col s4"><h2>{{productCount}}</h2></div>
|
||||
</div>
|
||||
</div>
|
||||
{{#if isInRole 'systemadmin'}}
|
||||
<div class="card-action">
|
||||
<a href="#" id="usermgmtlink">Product Management</a>
|
||||
<a href="#" class="cardLink" id="prodMgmtLink">Product Management</a>
|
||||
</div>
|
||||
{{/if}}
|
||||
</div>
|
||||
</div>
|
||||
<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">
|
||||
<span class="card-title"><h4>My Stores</h4></span>
|
||||
<div class="row">
|
||||
|
|
@ -58,15 +54,13 @@
|
|||
<div class="col s4"><h2>{{storeCount}}</h2></div>
|
||||
</div>
|
||||
</div>
|
||||
{{#if isInRole 'systemadmin'}}
|
||||
<div class="card-action">
|
||||
<a href="#" id="usermgmtlink">Store Management</a>
|
||||
<a href="#" class="cardLink" id="storeMgmtLink">Store Management</a>
|
||||
</div>
|
||||
{{/if}}
|
||||
</div>
|
||||
</div>
|
||||
<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">
|
||||
<span class="card-title"><h4>My Categories</h4></span>
|
||||
<div class="row">
|
||||
|
|
@ -74,11 +68,23 @@
|
|||
<div class="col s4"><h2>{{catCount}}</h2></div>
|
||||
</div>
|
||||
</div>
|
||||
{{#if isInRole 'systemadmin'}}
|
||||
<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>
|
||||
{{/if}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import { Categories } from "../../imports/api/category";
|
||||
import { Lists } from "../../imports/api/lists";
|
||||
import { Locations } from "../../imports/api/location";
|
||||
import { Products } from "../../imports/api/products";
|
||||
import { Stores } from "../../imports/api/stores";
|
||||
|
||||
|
|
@ -10,6 +11,7 @@ Template.dashboard.onCreated(function() {
|
|||
this.subscribe("myCategories");
|
||||
this.subscribe("storeInfo");
|
||||
this.subscribe("myProducts");
|
||||
this.subscribe("myLocations");
|
||||
});
|
||||
|
||||
Template.dashboard.onRendered(function() {
|
||||
|
|
@ -31,12 +33,64 @@ Template.dashboard.helpers({
|
|||
},
|
||||
catCount: function() {
|
||||
return Categories.find().count();
|
||||
},
|
||||
locCount: function() {
|
||||
return Locations.find().count();
|
||||
}
|
||||
});
|
||||
|
||||
Template.dashboard.events({
|
||||
"click #usermgmtlink" (event) {
|
||||
"click .cardLink" (event) {
|
||||
event.preventDefault();
|
||||
FlowRouter.go('/userMgmt');
|
||||
let link = event.currentTarget.id;
|
||||
switch(link) {
|
||||
case "userMgmtLink":
|
||||
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 {
|
||||
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="./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 src="https://kraaden.github.io/autocomplete/autocomplete.js"></script>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue