mirror of
https://gitlab.com/bmcgonag/get_my.git
synced 2026-03-27 00:08:49 +00:00
Removed Categories and Locations
This commit is contained in:
parent
c916c278a2
commit
2b1022f513
23 changed files with 4 additions and 637 deletions
|
|
@ -1,8 +0,0 @@
|
||||||
<template name="catMgmt">
|
|
||||||
<div class="container">
|
|
||||||
<h4>Category Management</h4>
|
|
||||||
{{> catMgmtForm}}
|
|
||||||
<hr>
|
|
||||||
{{> catMgmtTbl}}
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
@ -1,17 +0,0 @@
|
||||||
import { Categories } from '../../../imports/api/category.js';
|
|
||||||
|
|
||||||
Template.catMgmt.onCreated(function() {
|
|
||||||
this.subscribe("myCategories");
|
|
||||||
});
|
|
||||||
|
|
||||||
Template.catMgmt.onRendered(function() {
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
Template.catMgmt.helpers({
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
Template.catMgmt.events({
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
@ -1,17 +0,0 @@
|
||||||
<template name="catMgmtForm">
|
|
||||||
<form action="submit" id="catInputForm">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col s8 m10 l10 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 class="col s4 m2 l2 input-field">
|
|
||||||
{{#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>
|
|
||||||
</form>
|
|
||||||
</template>
|
|
||||||
|
|
@ -1,95 +0,0 @@
|
||||||
import { Categories } from '../../../imports/api/category.js';
|
|
||||||
|
|
||||||
Template.catMgmtForm.onCreated(function() {
|
|
||||||
this.subscribe("myCategories");
|
|
||||||
});
|
|
||||||
|
|
||||||
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({
|
|
||||||
'click .saveCatMgmt' (event) {
|
|
||||||
event.preventDefault();
|
|
||||||
let catName = $("#catNameInp").val();
|
|
||||||
if (catName == null || catName == "") {
|
|
||||||
Session.set("catNameMiss", true);
|
|
||||||
return;
|
|
||||||
} else {
|
|
||||||
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("");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
'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);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
@ -1,16 +0,0 @@
|
||||||
<template name="catMgmtTbl">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col s12">
|
|
||||||
<ul class="collection">
|
|
||||||
{{#each cats}}
|
|
||||||
<li class="collection-item">
|
|
||||||
{{categoryName}}
|
|
||||||
<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>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{{> deleteConfirmationModal}}
|
|
||||||
</template>
|
|
||||||
|
|
@ -1,35 +0,0 @@
|
||||||
import { Categories } from '../../../imports/api/category.js';
|
|
||||||
|
|
||||||
Template.catMgmtTbl.onCreated(function() {
|
|
||||||
this.subscribe("myCategories");
|
|
||||||
});
|
|
||||||
|
|
||||||
Template.catMgmtTbl.onRendered(function() {
|
|
||||||
Meteor.setTimeout(function() {
|
|
||||||
$('.tooltipped').tooltip();
|
|
||||||
}, 150);
|
|
||||||
});
|
|
||||||
|
|
||||||
Template.catMgmtTbl.helpers({
|
|
||||||
cats: function() {
|
|
||||||
return Categories.find({});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
Template.catMgmtTbl.events({
|
|
||||||
'click .deleteCategory' (event) {
|
|
||||||
event.preventDefault();
|
|
||||||
Session.set("deleteId", this._id);
|
|
||||||
Session.set("method", "delete.category");
|
|
||||||
Session.set("item", this.categoryName);
|
|
||||||
Session.set("view", "Categories");
|
|
||||||
$('#modalDelete').modal('open');
|
|
||||||
},
|
|
||||||
'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);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
<template name="locMgmt">
|
|
||||||
<div class="container">
|
|
||||||
<h4>Location Management</h4>
|
|
||||||
{{> locMgmtForm}}
|
|
||||||
<hr>
|
|
||||||
{{> locMgmtTbl}}
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
@ -1,15 +0,0 @@
|
||||||
Template.locMgmt.onCreated(function() {
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
Template.locMgmt.onRendered(function() {
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
Template.locMgmt.helpers({
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
Template.locMgmt.events({
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
@ -1,17 +0,0 @@
|
||||||
<template name="locMgmtForm">
|
|
||||||
<form action="" id="locInputForm">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col s8 m10 l10 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 class="col s4 m2 l2 input-field">
|
|
||||||
{{#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>
|
|
||||||
</form>
|
|
||||||
</template>
|
|
||||||
|
|
@ -1,95 +0,0 @@
|
||||||
import { Locations } from '../../../imports/api/location.js';
|
|
||||||
|
|
||||||
Template.locMgmtForm.onCreated(function() {
|
|
||||||
this.subscribe("myLocations");
|
|
||||||
});
|
|
||||||
|
|
||||||
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({
|
|
||||||
'click .saveLocMgmt' (event) {
|
|
||||||
event.preventDefault();
|
|
||||||
let locName = $("#locNameInp").val();
|
|
||||||
if (locName == null || locName == "") {
|
|
||||||
Session.set("locNameMiss", true);
|
|
||||||
return;
|
|
||||||
} else {
|
|
||||||
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("");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
'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,16 +0,0 @@
|
||||||
<template name="locMgmtTbl">
|
|
||||||
<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>
|
|
||||||
{{> deleteConfirmationModal}}
|
|
||||||
</template>
|
|
||||||
|
|
@ -1,35 +0,0 @@
|
||||||
import { Locations } from '../../../imports/api/location.js';
|
|
||||||
|
|
||||||
Template.locMgmtTbl.onCreated(function() {
|
|
||||||
this.subscribe("myLocations");
|
|
||||||
});
|
|
||||||
|
|
||||||
Template.locMgmtTbl.onRendered(function() {
|
|
||||||
Meteor.setTimeout(function() {
|
|
||||||
$('.tooltipped').tooltip();
|
|
||||||
}, 150);
|
|
||||||
});
|
|
||||||
|
|
||||||
Template.locMgmtTbl.helpers({
|
|
||||||
locs: function() {
|
|
||||||
return Locations.find({});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
Template.locMgmtTbl.events({
|
|
||||||
'click .deleteLocation' (event) {
|
|
||||||
event.preventDefault();
|
|
||||||
Session.set("deleteId", this._id);
|
|
||||||
Session.set("method", "delete.location");
|
|
||||||
Session.set("item", this.locationName);
|
|
||||||
Session.set("view", "Locations");
|
|
||||||
$('#modalDelete').modal('open');
|
|
||||||
},
|
|
||||||
'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);
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
@ -6,18 +6,6 @@
|
||||||
<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" />
|
||||||
<label for="prodName">Name*</label>
|
<label for="prodName">Name*</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>
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col s12 m6 l6 input-field">
|
<div class="col s12 m6 l6 input-field">
|
||||||
<select name="prodStore" id="prodStore" class="prodStore">
|
<select name="prodStore" id="prodStore" class="prodStore">
|
||||||
<option value="" disabled selected></option>
|
<option value="" disabled selected></option>
|
||||||
|
|
@ -28,16 +16,6 @@
|
||||||
</select>
|
</select>
|
||||||
<label for="prodStore">Store</label>
|
<label for="prodStore">Store</label>
|
||||||
</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>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col s6 m6 l6">
|
<div class="col s6 m6 l6">
|
||||||
|
|
@ -63,26 +41,4 @@
|
||||||
<a href="#!" class="modal-close waves-effect waves-green btn-flat">Done</a>
|
<a href="#!" class="modal-close waves-effect waves-green btn-flat">Done</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Location Modal Structure -->
|
|
||||||
<div id="modalLocation" class="modal">
|
|
||||||
<div class="modal-content">
|
|
||||||
<h4>Add New Location</h4>
|
|
||||||
{{> locMgmtForm}}
|
|
||||||
</div>
|
|
||||||
<div class="modal-footer">
|
|
||||||
<a href="#!" class="modal-close waves-effect waves-green btn-flat">Done</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Category Modal Structure -->
|
|
||||||
<div id="modalCategory" class="modal">
|
|
||||||
<div class="modal-content">
|
|
||||||
<h4>Add New Category</h4>
|
|
||||||
{{> catMgmtForm}}
|
|
||||||
</div>
|
|
||||||
<div class="modal-footer">
|
|
||||||
<a href="#!" class="modal-close waves-effect waves-green btn-flat">Done</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -1,7 +1,5 @@
|
||||||
import { Products } from '../../../imports/api/products.js';
|
import { Products } from '../../../imports/api/products.js';
|
||||||
import { Stores } from '../../../imports/api/stores.js';
|
import { Stores } from '../../../imports/api/stores.js';
|
||||||
import { Categories } from '../../../imports/api/category.js';
|
|
||||||
import { Locations } from '../../../imports/api/location.js';
|
|
||||||
|
|
||||||
Template.prodMgmtForm.onCreated(function() {
|
Template.prodMgmtForm.onCreated(function() {
|
||||||
this.subscribe("myProducts");
|
this.subscribe("myProducts");
|
||||||
|
|
@ -26,12 +24,6 @@ Template.prodMgmtForm.helpers({
|
||||||
prodNameErr: function() {
|
prodNameErr: function() {
|
||||||
return Session.get("prodNameRed");
|
return Session.get("prodNameRed");
|
||||||
},
|
},
|
||||||
category: function() {
|
|
||||||
return Categories.find({});
|
|
||||||
},
|
|
||||||
locations: function() {
|
|
||||||
return Locations.find({});
|
|
||||||
},
|
|
||||||
prodEditMode: function() {
|
prodEditMode: function() {
|
||||||
return Session.get("prodEditMode");
|
return Session.get("prodEditMode");
|
||||||
},
|
},
|
||||||
|
|
@ -41,17 +33,7 @@ Template.prodMgmtForm.events({
|
||||||
'click .saveProdMgmt' (event) {
|
'click .saveProdMgmt' (event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
let name = $("#prodName").val();
|
let name = $("#prodName").val();
|
||||||
let cat = $("#prodCategory").val();
|
|
||||||
let store = $("#prodStore").val();
|
let store = $("#prodStore").val();
|
||||||
let location = $("#prodLocation").val();
|
|
||||||
|
|
||||||
if (cat == null) {
|
|
||||||
cat = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (location == null) {
|
|
||||||
location = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (store == null) {
|
if (store == null) {
|
||||||
store = "";
|
store = "";
|
||||||
|
|
@ -61,15 +43,13 @@ Template.prodMgmtForm.events({
|
||||||
Session.set("prodNameRed", true);
|
Session.set("prodNameRed", true);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
Meteor.call('add.product', name, cat, store, location, function(err, result) {
|
Meteor.call('add.product', name, store, function(err, result) {
|
||||||
if (err) {
|
if (err) {
|
||||||
// console.log(" ERROR: can't add product: " + err);
|
// console.log(" ERROR: can't add product: " + err);
|
||||||
} else {
|
} else {
|
||||||
// console.log(" SUCCESS adding product.");
|
// console.log(" SUCCESS adding product.");
|
||||||
$("#prodName").val("");
|
$("#prodName").val("");
|
||||||
$("#prodCategory").val("");
|
|
||||||
$("#prodStore").val("");
|
$("#prodStore").val("");
|
||||||
$("#prodLocation").val("");
|
|
||||||
$('select').formSelect();
|
$('select').formSelect();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -78,8 +58,7 @@ Template.prodMgmtForm.events({
|
||||||
'click .editProdMgmt' (event) {
|
'click .editProdMgmt' (event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
let name = $("#prodName").val();
|
let name = $("#prodName").val();
|
||||||
let cat = $("#prodCategory").val();
|
|
||||||
let store = $("#prodStore").val();
|
|
||||||
let location = $("#prodLocation").val();
|
let location = $("#prodLocation").val();
|
||||||
let prodId = Session.get("prodEditId");
|
let prodId = Session.get("prodEditId");
|
||||||
|
|
||||||
|
|
@ -105,9 +84,7 @@ Template.prodMgmtForm.events({
|
||||||
} else {
|
} else {
|
||||||
// console.log(" SUCCESS adding product.");
|
// console.log(" SUCCESS adding product.");
|
||||||
$("#prodName").val("");
|
$("#prodName").val("");
|
||||||
$("#prodCategory").val("");
|
|
||||||
$("#prodStore").val("");
|
$("#prodStore").val("");
|
||||||
$("#prodLocation").val("");
|
|
||||||
$('select').formSelect();
|
$('select').formSelect();
|
||||||
Session.set("prodEditMode", false);
|
Session.set("prodEditMode", false);
|
||||||
}
|
}
|
||||||
|
|
@ -118,9 +95,7 @@ Template.prodMgmtForm.events({
|
||||||
// event.preventDefault();
|
// event.preventDefault();
|
||||||
if (event.which === 13) {
|
if (event.which === 13) {
|
||||||
let name = $("#prodName").val();
|
let name = $("#prodName").val();
|
||||||
let cat = $("#prodCategory").val();
|
|
||||||
let store = $("#prodStore").val();
|
let store = $("#prodStore").val();
|
||||||
let location = $("#prodLocation").val();
|
|
||||||
let prodId = Session.get("prodEditId");
|
let prodId = Session.get("prodEditId");
|
||||||
let prodEditMode = Session.get("prodEditMode");
|
let prodEditMode = Session.get("prodEditMode");
|
||||||
console.log(" ---- got the submit event for products.");
|
console.log(" ---- got the submit event for products.");
|
||||||
|
|
@ -147,9 +122,7 @@ Template.prodMgmtForm.events({
|
||||||
} else {
|
} else {
|
||||||
// console.log(" SUCCESS adding product.");
|
// console.log(" SUCCESS adding product.");
|
||||||
$("#prodName").val("");
|
$("#prodName").val("");
|
||||||
$("#prodCategory").val("");
|
|
||||||
$("#prodStore").val("");
|
$("#prodStore").val("");
|
||||||
$("#prodLocation").val("");
|
|
||||||
$('select').formSelect();
|
$('select').formSelect();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -160,9 +133,7 @@ Template.prodMgmtForm.events({
|
||||||
} else {
|
} else {
|
||||||
// console.log(" SUCCESS adding product.");
|
// console.log(" SUCCESS adding product.");
|
||||||
$("#prodName").val("");
|
$("#prodName").val("");
|
||||||
$("#prodCategory").val("");
|
|
||||||
$("#prodStore").val("");
|
$("#prodStore").val("");
|
||||||
$("#prodLocation").val("");
|
|
||||||
$('select').formSelect();
|
$('select').formSelect();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -173,9 +144,7 @@ Template.prodMgmtForm.events({
|
||||||
'click .cancelProdMgmt' (event) {
|
'click .cancelProdMgmt' (event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
$("#prodName").val("");
|
$("#prodName").val("");
|
||||||
$("#prodCategory").val("");
|
|
||||||
$("#prodStore").val("");
|
$("#prodStore").val("");
|
||||||
$("#prodLocation").val("");
|
|
||||||
$('select').formSelect();
|
$('select').formSelect();
|
||||||
},
|
},
|
||||||
'change #prodStore' (event) {
|
'change #prodStore' (event) {
|
||||||
|
|
@ -188,26 +157,6 @@ Template.prodMgmtForm.events({
|
||||||
$('#modalStore').modal('open');
|
$('#modalStore').modal('open');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'change #prodLocation' (event) {
|
|
||||||
event.preventDefault();
|
|
||||||
let val = $("#prodLocation").val();
|
|
||||||
|
|
||||||
if (val == "addNewLocation") {
|
|
||||||
$("#prodLocation").val("");
|
|
||||||
// open a modal to enter store information.
|
|
||||||
$('#modalLocation').modal('open');
|
|
||||||
}
|
|
||||||
},
|
|
||||||
'change #prodCategory' (event) {
|
|
||||||
event.preventDefault();
|
|
||||||
let val = $("#prodCategory").val();
|
|
||||||
|
|
||||||
if (val == "addNewCat") {
|
|
||||||
$("#prodCategory").val("");
|
|
||||||
// open a modal to enter store information.
|
|
||||||
$('#modalCategory').modal('open');
|
|
||||||
}
|
|
||||||
},
|
|
||||||
'click .modal-close' (event) {
|
'click .modal-close' (event) {
|
||||||
$('select').formSelect();
|
$('select').formSelect();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,9 +13,7 @@
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</th>
|
</th>
|
||||||
<th>Category</th>
|
|
||||||
<th>Store</th>
|
<th>Store</th>
|
||||||
<th>Location</th>
|
|
||||||
<th>Actions</th>
|
<th>Actions</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
|
@ -23,9 +21,7 @@
|
||||||
{{#each products}}
|
{{#each products}}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{prodName}} </td>
|
<td>{{prodName}} </td>
|
||||||
<td>{{prodCategory}}</td>
|
|
||||||
<td>{{prodStore}}</td>
|
<td>{{prodStore}}</td>
|
||||||
<td>{{prodLocation}}</td>
|
|
||||||
<td>
|
<td>
|
||||||
<i class="material-icons clickable deleteProduct">delete</i>
|
<i class="material-icons clickable deleteProduct">delete</i>
|
||||||
<i class="material-icons clickable editProduct">edit</i>
|
<i class="material-icons clickable editProduct">edit</i>
|
||||||
|
|
|
||||||
|
|
@ -40,8 +40,6 @@ Template.prodMgmtTbl.events({
|
||||||
Session.set("prodEditId", this._id);
|
Session.set("prodEditId", this._id);
|
||||||
let prodInfo = Products.findOne({ _id: this._id });
|
let prodInfo = Products.findOne({ _id: this._id });
|
||||||
$("#prodName").val(prodInfo.prodName);
|
$("#prodName").val(prodInfo.prodName);
|
||||||
$("#prodCategory").val(prodInfo.prodCategory);
|
|
||||||
$("#prodLocation").val(prodInfo.prodLocation);
|
|
||||||
$("#prodStore").val(prodInfo.prodStore);
|
$("#prodStore").val(prodInfo.prodStore);
|
||||||
$('select').formSelect();
|
$('select').formSelect();
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,4 @@
|
||||||
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";
|
||||||
import { Menus } from '../../imports/api/menu.js';
|
import { Menus } from '../../imports/api/menu.js';
|
||||||
|
|
@ -75,12 +73,6 @@ Template.dashboard.events({
|
||||||
case "prodMgmtLink":
|
case "prodMgmtLink":
|
||||||
FlowRouter.go('/manageProduct');
|
FlowRouter.go('/manageProduct');
|
||||||
break;
|
break;
|
||||||
case "catMgmtLink":
|
|
||||||
FlowRouter.go('/manageCategory');
|
|
||||||
break;
|
|
||||||
case "locationMgmtLink":
|
|
||||||
FlowRouter.go('/manageLocation');
|
|
||||||
break;
|
|
||||||
case "myMenuLink":
|
case "myMenuLink":
|
||||||
FlowRouter.go('/mymenus');
|
FlowRouter.go('/mymenus');
|
||||||
break;
|
break;
|
||||||
|
|
@ -105,12 +97,6 @@ Template.dashboard.events({
|
||||||
case "storeInfoCard":
|
case "storeInfoCard":
|
||||||
FlowRouter.go('/manageStore');
|
FlowRouter.go('/manageStore');
|
||||||
break;
|
break;
|
||||||
case "catInfoCard":
|
|
||||||
FlowRouter.go('/manageCategory');
|
|
||||||
break;
|
|
||||||
case "locInfoCard":
|
|
||||||
FlowRouter.go('/manageLocation');
|
|
||||||
break;
|
|
||||||
case "prodInfoCard":
|
case "prodInfoCard":
|
||||||
FlowRouter.go("/manageProduct");
|
FlowRouter.go("/manageProduct");
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -1,50 +0,0 @@
|
||||||
import { Meteor } from 'meteor/meteor';
|
|
||||||
import { Mongo } from 'meteor/mongo';
|
|
||||||
import { check } from 'meteor/check';
|
|
||||||
|
|
||||||
export const Categories = new Mongo.Collection('categories');
|
|
||||||
|
|
||||||
Categories.allow({
|
|
||||||
insert: function(userId, doc){
|
|
||||||
// if use id exists, allow insert
|
|
||||||
return !!userId;
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
Meteor.methods({
|
|
||||||
'add.category' (categoryName) {
|
|
||||||
check(categoryName, String);
|
|
||||||
|
|
||||||
if (!this.userId) {
|
|
||||||
throw new Meteor.Error('You are not allowed to add categories. Make sure you are logged in with valid user credentials.');
|
|
||||||
}
|
|
||||||
|
|
||||||
return Categories.insert({
|
|
||||||
categoryName: categoryName,
|
|
||||||
categoryOwner: this.userId,
|
|
||||||
});
|
|
||||||
},
|
|
||||||
'edit.category' (categoryId, categoryName,) {
|
|
||||||
check(categoryId, String);
|
|
||||||
check(categoryName, String);
|
|
||||||
|
|
||||||
if (!this.userId) {
|
|
||||||
throw new Meteor.Error('You are not allowed to edit categories. Make sure you are logged in with valid user credentials.');
|
|
||||||
}
|
|
||||||
|
|
||||||
return Categories.update({ _id: categoryId }, {
|
|
||||||
$set: {
|
|
||||||
categoryName: categoryName,
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
'delete.category' (categoryId) {
|
|
||||||
check(categoryId, String);
|
|
||||||
|
|
||||||
if (!this.userId) {
|
|
||||||
throw new Meteor.Error('You are not allowed to delete categories. Make sure you are logged in with valid user credentials.');
|
|
||||||
}
|
|
||||||
|
|
||||||
return Categories.remove({ _id: categoryId });
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
@ -35,9 +35,7 @@ Meteor.methods({
|
||||||
listId: listId,
|
listId: listId,
|
||||||
prodId: result,
|
prodId: result,
|
||||||
addedBy: this.userId,
|
addedBy: this.userId,
|
||||||
itemCategory: "",
|
|
||||||
itemStore: "",
|
itemStore: "",
|
||||||
itemLocation: "",
|
|
||||||
itemOrdered: false,
|
itemOrdered: false,
|
||||||
itemReceived: false,
|
itemReceived: false,
|
||||||
dateAddedToList: new Date(),
|
dateAddedToList: new Date(),
|
||||||
|
|
@ -50,9 +48,7 @@ Meteor.methods({
|
||||||
listId: listId,
|
listId: listId,
|
||||||
prodId: prodInfo._id,
|
prodId: prodInfo._id,
|
||||||
addedBy: this.userId,
|
addedBy: this.userId,
|
||||||
itemCategory: prodInfo.prodCategory,
|
|
||||||
itemStore: prodInfo.prodStore,
|
itemStore: prodInfo.prodStore,
|
||||||
itemLocation: prodInfo.prodLocation,
|
|
||||||
itemOrdered: false,
|
itemOrdered: false,
|
||||||
itemReceived: false,
|
itemReceived: false,
|
||||||
dateAddedToList: new Date(),
|
dateAddedToList: new Date(),
|
||||||
|
|
|
||||||
|
|
@ -1,50 +0,0 @@
|
||||||
import { Meteor } from 'meteor/meteor';
|
|
||||||
import { Mongo } from 'meteor/mongo';
|
|
||||||
import { check } from 'meteor/check';
|
|
||||||
|
|
||||||
export const Locations = new Mongo.Collection('locations');
|
|
||||||
|
|
||||||
Locations.allow({
|
|
||||||
insert: function(userId, doc){
|
|
||||||
// if use id exists, allow insert
|
|
||||||
return !!userId;
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
Meteor.methods({
|
|
||||||
'add.location' (name) {
|
|
||||||
check(name, String);
|
|
||||||
|
|
||||||
if (!this.userId) {
|
|
||||||
throw new Meteor.Error('You are not allowed to add locations. Make sure you are logged in with valid user credentials.');
|
|
||||||
}
|
|
||||||
|
|
||||||
return Locations.insert({
|
|
||||||
locationName: name,
|
|
||||||
owner: this.userId,
|
|
||||||
});
|
|
||||||
},
|
|
||||||
'edit.location' (locationId, locationName) {
|
|
||||||
check(locationId, String);
|
|
||||||
check(locationName, String);
|
|
||||||
|
|
||||||
if (!this.userId) {
|
|
||||||
throw new Meteor.Error('You are not allowed to edit locations. Make sure you are logged in with valid user credentials.');
|
|
||||||
}
|
|
||||||
|
|
||||||
return Locations.update({ _id: locationId }, {
|
|
||||||
$set: {
|
|
||||||
locationName: locationName,
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
'delete.location' (locationId) {
|
|
||||||
check(locationId, String);
|
|
||||||
|
|
||||||
if (!this.userId) {
|
|
||||||
throw new Meteor.Error('You are not allowed to delete locations. Make sure you are logged in with valid user credentials.');
|
|
||||||
}
|
|
||||||
|
|
||||||
return Locations.remove({ _id: locationId });
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
@ -12,11 +12,9 @@ Products.allow({
|
||||||
});
|
});
|
||||||
|
|
||||||
Meteor.methods({
|
Meteor.methods({
|
||||||
'add.product' (prodName, prodCategory, prodStore, prodLocation) {
|
'add.product' (prodName, prodStore) {
|
||||||
check(prodName, String);
|
check(prodName, String);
|
||||||
check(prodCategory, String);
|
|
||||||
check(prodStore, String);
|
check(prodStore, String);
|
||||||
check(prodLocation, String);
|
|
||||||
|
|
||||||
if (!this.userId) {
|
if (!this.userId) {
|
||||||
throw new Meteor.Error('You are not allowed to add products. Make sure you are logged in with valid user credentials.');
|
throw new Meteor.Error('You are not allowed to add products. Make sure you are logged in with valid user credentials.');
|
||||||
|
|
@ -25,17 +23,13 @@ Meteor.methods({
|
||||||
return Products.insert({
|
return Products.insert({
|
||||||
prodName: prodName,
|
prodName: prodName,
|
||||||
prodOwner: this.userId,
|
prodOwner: this.userId,
|
||||||
prodCategory: prodCategory,
|
|
||||||
prodStore: prodStore,
|
prodStore: prodStore,
|
||||||
prodLocation: prodLocation,
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
'edit.product' (prodId, prodName, prodCategory, prodStore, prodLocation) {
|
'edit.product' (prodId, prodName, prodStore) {
|
||||||
check(prodId, String);
|
check(prodId, String);
|
||||||
check(prodName, String);
|
check(prodName, String);
|
||||||
check(prodCategory, String);
|
|
||||||
check(prodStore, String);
|
check(prodStore, String);
|
||||||
check(prodLocation, String);
|
|
||||||
|
|
||||||
if (!this.userId) {
|
if (!this.userId) {
|
||||||
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.');
|
||||||
|
|
@ -44,9 +38,7 @@ Meteor.methods({
|
||||||
return Products.update({ _id: prodId }, {
|
return Products.update({ _id: prodId }, {
|
||||||
$set: {
|
$set: {
|
||||||
prodName: prodName,
|
prodName: prodName,
|
||||||
prodCategory: prodCategory,
|
|
||||||
prodStore: prodStore,
|
prodStore: prodStore,
|
||||||
prodLocation: prodLocation,
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -61,20 +61,6 @@ FlowRouter.route('/manageProduct', {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
FlowRouter.route('/manageCategory', {
|
|
||||||
name: 'manageCategory',
|
|
||||||
action() {
|
|
||||||
BlazeLayout.render('MainLayout', { main: 'catMgmt' });
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
FlowRouter.route('/manageLocation', {
|
|
||||||
name: 'manageLocation',
|
|
||||||
action() {
|
|
||||||
BlazeLayout.render('MainLayout', { main: 'locMgmt' });
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
FlowRouter.route('/manageLists', {
|
FlowRouter.route('/manageLists', {
|
||||||
name: 'manageLists',
|
name: 'manageLists',
|
||||||
action() {
|
action() {
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,6 @@ import { SysConfig } from '../imports/api/systemConfig.js';
|
||||||
import { Stores } from '../imports/api/stores.js';
|
import { Stores } from '../imports/api/stores.js';
|
||||||
import { UserConfigOptions } from '../imports/api/userConfigOptions.js';
|
import { UserConfigOptions } from '../imports/api/userConfigOptions.js';
|
||||||
import { Products } from '../imports/api/products.js';
|
import { Products } from '../imports/api/products.js';
|
||||||
import { Categories } from '../imports/api/category.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';
|
import { ListItems } from '../imports/api/listItems.js';
|
||||||
import { Menus } from '../imports/api/menu.js';
|
import { Menus } from '../imports/api/menu.js';
|
||||||
|
|
@ -39,22 +37,6 @@ Meteor.publish("myProducts", function() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Meteor.publish("myCategories", function() {
|
|
||||||
try {
|
|
||||||
return Categories.find({});
|
|
||||||
} catch (error) {
|
|
||||||
console.log(" ERROR pulling category data: " + error);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
Meteor.publish("myLocations", function() {
|
|
||||||
try {
|
|
||||||
return Locations.find({});
|
|
||||||
} catch (error) {
|
|
||||||
console.log(" ERROR pulling location data: " + error);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
Meteor.publish("myLists", function() {
|
Meteor.publish("myLists", function() {
|
||||||
try {
|
try {
|
||||||
return Lists.find( { $or: [ { listOwner: this.userId, listComplete: false }, { listShared: true, listComplete: false } ] } );
|
return Lists.find( { $or: [ { listOwner: this.userId, listComplete: false }, { listShared: true, listComplete: false } ] } );
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue