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);
|
||||
},
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue