mirror of
https://gitlab.com/bmcgonag/get_my.git
synced 2026-03-27 00:08:49 +00:00
Lots of changes and additions to the project. Still early, and not usable.
This commit is contained in:
parent
8636f8cf9b
commit
266dbd0856
41 changed files with 836 additions and 67 deletions
|
|
@ -30,4 +30,4 @@ raix:handlebar-helpers
|
||||||
kadira:flow-router
|
kadira:flow-router
|
||||||
kadira:blaze-layout
|
kadira:blaze-layout
|
||||||
accounts-password@2.3.1
|
accounts-password@2.3.1
|
||||||
# mizzao:autocomplete # for the @mentions functionality
|
# mizzao:autocomplete # for the @mentions functionality
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
|
|
||||||
Template.userMgmt.onCreated(function() {
|
Template.userMgmt.onCreated(function() {
|
||||||
|
this.subscribe("userList");
|
||||||
});
|
});
|
||||||
|
|
||||||
Template.userMgmt.onRendered(function() {
|
Template.userMgmt.onRendered(function() {
|
||||||
|
|
|
||||||
6
client/AdminMgmt/CategoryMgMt/catMgmt.html
Normal file
6
client/AdminMgmt/CategoryMgMt/catMgmt.html
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
<template name="catMgmt">
|
||||||
|
<h4>Category Management</h4>
|
||||||
|
{{> catMgmtForm}}
|
||||||
|
<hr>
|
||||||
|
{{> catMgmtTbl}}
|
||||||
|
</template>
|
||||||
17
client/AdminMgmt/CategoryMgMt/catMgmt.js
Normal file
17
client/AdminMgmt/CategoryMgMt/catMgmt.js
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
import { Categories } from '../../../imports/api/category.js';
|
||||||
|
|
||||||
|
Template.catMgmt.onCreated(function() {
|
||||||
|
this.subscribe("myCategories");
|
||||||
|
});
|
||||||
|
|
||||||
|
Template.catMgmt.onRendered(function() {
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
Template.catMgmt.helpers({
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
Template.catMgmt.events({
|
||||||
|
|
||||||
|
});
|
||||||
16
client/AdminMgmt/CategoryMgMt/catMgmtForm.html
Normal file
16
client/AdminMgmt/CategoryMgMt/catMgmtForm.html
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
<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>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<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">
|
||||||
|
<a class="waves-effect waves-light btn saveCatMgmt green right">Add</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
39
client/AdminMgmt/CategoryMgMt/catMgmtForm.js
Normal file
39
client/AdminMgmt/CategoryMgMt/catMgmtForm.js
Normal file
|
|
@ -0,0 +1,39 @@
|
||||||
|
import { Categories } from '../../../imports/api/category.js';
|
||||||
|
|
||||||
|
Template.catMgmtForm.onCreated(function() {
|
||||||
|
this.subscribe("myCategories");
|
||||||
|
});
|
||||||
|
|
||||||
|
Template.catMgmtForm.onRendered(function() {
|
||||||
|
Session.set("catNameMiss", false);
|
||||||
|
});
|
||||||
|
|
||||||
|
Template.catMgmtForm.helpers({
|
||||||
|
catNameErr: function() {
|
||||||
|
return Session.get("catNameMiss");
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
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 .cancelCatMgmt' (event) {
|
||||||
|
event.preventDefault();
|
||||||
|
$("#catNameInp").val("");
|
||||||
|
}
|
||||||
|
});
|
||||||
21
client/AdminMgmt/CategoryMgMt/catMgmtTbl.html
Normal file
21
client/AdminMgmt/CategoryMgMt/catMgmtTbl.html
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
<template name="catMgmtTbl">
|
||||||
|
<table class="highlight striped responsive-table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Name</th>
|
||||||
|
<th>Actions</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{{#each cats}}
|
||||||
|
<tr>
|
||||||
|
<td>{{categoryName}}</td>
|
||||||
|
<td>
|
||||||
|
<i class="material-icons clickable deleteCategory">delete</i>
|
||||||
|
<i class="material-icons clickable editCategory">edit</i>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{{/each}}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</template>
|
||||||
19
client/AdminMgmt/CategoryMgMt/catMgmtTbl.js
Normal file
19
client/AdminMgmt/CategoryMgMt/catMgmtTbl.js
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
import { Categories } from '../../../imports/api/category.js';
|
||||||
|
|
||||||
|
Template.catMgmtTbl.onCreated(function() {
|
||||||
|
this.subscribe("myCategories");
|
||||||
|
});
|
||||||
|
|
||||||
|
Template.catMgmtTbl.onRendered(function() {
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
Template.catMgmtTbl.helpers({
|
||||||
|
cats: function() {
|
||||||
|
return Categories.find({});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Template.catMgmtTbl.events({
|
||||||
|
|
||||||
|
});
|
||||||
5
client/AdminMgmt/LocationMgmt/locMgmt.html
Normal file
5
client/AdminMgmt/LocationMgmt/locMgmt.html
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
<template name="locMgmt">
|
||||||
|
{{> locMgmtForm}}
|
||||||
|
<hr>
|
||||||
|
{{> locMgmtTbl}}
|
||||||
|
</template>
|
||||||
15
client/AdminMgmt/LocationMgmt/locMgmt.js
Normal file
15
client/AdminMgmt/LocationMgmt/locMgmt.js
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
Template.locMgmt.onCreated(function() {
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
Template.locMgmt.onRendered(function() {
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
Template.locMgmt.helpers({
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
Template.locMgmt.events({
|
||||||
|
|
||||||
|
});
|
||||||
16
client/AdminMgmt/LocationMgmt/locMgmtForm.html
Normal file
16
client/AdminMgmt/LocationMgmt/locMgmtForm.html
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
<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>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<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">
|
||||||
|
<a class="waves-effect waves-light btn saveLocMgmt green right">Add</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
39
client/AdminMgmt/LocationMgmt/locMgmtForm.js
Normal file
39
client/AdminMgmt/LocationMgmt/locMgmtForm.js
Normal file
|
|
@ -0,0 +1,39 @@
|
||||||
|
import { Locations } from '../../../imports/api/location.js';
|
||||||
|
|
||||||
|
Template.locMgmtForm.onCreated(function() {
|
||||||
|
this.subscribe("myLocations");
|
||||||
|
});
|
||||||
|
|
||||||
|
Template.locMgmtForm.onRendered(function() {
|
||||||
|
Session.set("locNameMiss", false);
|
||||||
|
});
|
||||||
|
|
||||||
|
Template.locMgmtForm.helpers({
|
||||||
|
locNameErr: function() {
|
||||||
|
return Session.get("locNameMiss");
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
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 .cancelLocMgmt' (event) {
|
||||||
|
event.preventDefault();
|
||||||
|
$("#locNameInp").val("");
|
||||||
|
}
|
||||||
|
});
|
||||||
21
client/AdminMgmt/LocationMgmt/locMgmtTbl.html
Normal file
21
client/AdminMgmt/LocationMgmt/locMgmtTbl.html
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
<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>
|
||||||
|
</template>
|
||||||
19
client/AdminMgmt/LocationMgmt/locMgmtTbl.js
Normal file
19
client/AdminMgmt/LocationMgmt/locMgmtTbl.js
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
import { Locations } from '../../../imports/api/location.js';
|
||||||
|
|
||||||
|
Template.locMgmtTbl.onCreated(function() {
|
||||||
|
this.subscribe("myLocations");
|
||||||
|
});
|
||||||
|
|
||||||
|
Template.locMgmtTbl.onRendered(function() {
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
Template.locMgmtTbl.helpers({
|
||||||
|
locs: function() {
|
||||||
|
return Locations.find({});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Template.locMgmtTbl.events([
|
||||||
|
|
||||||
|
]);
|
||||||
20
client/AdminMgmt/MgmtPage/mgmtPage.html
Normal file
20
client/AdminMgmt/MgmtPage/mgmtPage.html
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
<template name="mgmtPage">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col s12 m6 l6">
|
||||||
|
<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>
|
||||||
|
{{/if}}
|
||||||
|
<li><a href="#!" id="manageList" 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>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
21
client/AdminMgmt/MgmtPage/mgmtPage.js
Normal file
21
client/AdminMgmt/MgmtPage/mgmtPage.js
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
|
||||||
|
Template.mgmtPage.onCreated(function() {
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
Template.mgmtPage.onRendered(function() {
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
Template.mgmtPage.helpers ({
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
Template.mgmtPage.events ({
|
||||||
|
'click .collection-item' (event) {
|
||||||
|
event.preventDefault();
|
||||||
|
var clickedTarget = event.target.id;
|
||||||
|
// console.log("should be going to /" + clickedTarget);
|
||||||
|
FlowRouter.go('/' + clickedTarget);
|
||||||
|
},
|
||||||
|
});
|
||||||
5
client/AdminMgmt/ProductMgmt/prodMgmt.html
Normal file
5
client/AdminMgmt/ProductMgmt/prodMgmt.html
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
<template name="prodMgmt">
|
||||||
|
{{> prodMgmtForm}}
|
||||||
|
<hr>
|
||||||
|
{{> prodMgmtTbl}}
|
||||||
|
</template>
|
||||||
17
client/AdminMgmt/ProductMgmt/prodMgmt.js
Normal file
17
client/AdminMgmt/ProductMgmt/prodMgmt.js
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
import { Products } from '../../../imports/api/products.js';
|
||||||
|
|
||||||
|
Template.prodMgmt.onCreated(function() {
|
||||||
|
this.subscribe("myProducts");
|
||||||
|
});
|
||||||
|
|
||||||
|
Template.prodMgmt.onRendered(function() {
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
Template.prodMgmt.helpers({
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
Template.prodMgmt.events({
|
||||||
|
|
||||||
|
});
|
||||||
59
client/AdminMgmt/ProductMgmt/prodMgmtForm.html
Normal file
59
client/AdminMgmt/ProductMgmt/prodMgmtForm.html
Normal file
|
|
@ -0,0 +1,59 @@
|
||||||
|
<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>
|
||||||
|
</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">
|
||||||
|
<select name="prodStore" id="prodStore" class="prodStore">
|
||||||
|
<option value="" disabled selected></option>
|
||||||
|
{{#each stores}}
|
||||||
|
<option value="{{storeName}}">{{storeName}}</option>
|
||||||
|
{{/each}}
|
||||||
|
<option id="addNewStore" class="modal-trigger" href="modalStore" 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 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>
|
||||||
|
<!-- Modal Structure -->
|
||||||
|
<div id="modalStore" class="modal">
|
||||||
|
<div class="modal-content">
|
||||||
|
<h4>Add New Store</h4>
|
||||||
|
{{> storeMgmtForm}}
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<a href="#!" class="modal-close waves-effect waves-green btn-flat">Done</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
107
client/AdminMgmt/ProductMgmt/prodMgmtForm.js
Normal file
107
client/AdminMgmt/ProductMgmt/prodMgmtForm.js
Normal file
|
|
@ -0,0 +1,107 @@
|
||||||
|
import { Products } from '../../../imports/api/products.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() {
|
||||||
|
this.subscribe("myProducts");
|
||||||
|
this.subscribe("storeInfo");
|
||||||
|
this.subscribe("myCategories");
|
||||||
|
this.subscribe("myLocations");
|
||||||
|
});
|
||||||
|
|
||||||
|
Template.prodMgmtForm.onRendered(function() {
|
||||||
|
Meteor.setTimeout(function() {
|
||||||
|
$('select').formSelect();
|
||||||
|
}, 200);
|
||||||
|
$('select').formSelect();
|
||||||
|
$('.modal').modal();
|
||||||
|
});
|
||||||
|
|
||||||
|
Template.prodMgmtForm.helpers({
|
||||||
|
stores: function() {
|
||||||
|
return Stores.find({});
|
||||||
|
},
|
||||||
|
prodNameErr: function() {
|
||||||
|
return Session.get("prodNameRed");
|
||||||
|
},
|
||||||
|
category: function() {
|
||||||
|
return Categories.find({});
|
||||||
|
},
|
||||||
|
locations: function() {
|
||||||
|
return Locations.find({});
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
Template.prodMgmtForm.events({
|
||||||
|
'click .saveProdMgmt' (event) {
|
||||||
|
event.preventDefault();
|
||||||
|
let name=$("#prodName").val();
|
||||||
|
let cat = $("#prodCategory").val();
|
||||||
|
let store = $("#prodStore").val();
|
||||||
|
let location = $("#prodLocation").val();
|
||||||
|
|
||||||
|
if (cat == null) {
|
||||||
|
cat = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (location == null) {
|
||||||
|
location = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (store == null) {
|
||||||
|
store = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (name == "" || name == null) {
|
||||||
|
Session.set("prodNameRed", true);
|
||||||
|
return;
|
||||||
|
} 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.");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'click .cancelProdMgmt' (event) {
|
||||||
|
event.preventDefault();
|
||||||
|
$("#prodName").val("");
|
||||||
|
$("#prodCategory").val("");
|
||||||
|
$("#prodStore").val("");
|
||||||
|
$("#prodLocation").val("")
|
||||||
|
},
|
||||||
|
'change #prodStore' (event) {
|
||||||
|
event.preventDefault();
|
||||||
|
let val = $("#prodStore").val();
|
||||||
|
|
||||||
|
if (val == "addNewStore") {
|
||||||
|
$("#prodStore").val("");
|
||||||
|
// open a modal to enter store information.
|
||||||
|
$('#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 == "addNewCategory") {
|
||||||
|
$("#prodCategory").val("");
|
||||||
|
// open a modal to enter store information.
|
||||||
|
$('#modalCategory').modal('open');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
31
client/AdminMgmt/ProductMgmt/prodMgmtTbl.html
Normal file
31
client/AdminMgmt/ProductMgmt/prodMgmtTbl.html
Normal file
|
|
@ -0,0 +1,31 @@
|
||||||
|
<template name="prodMgmtTbl">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col s12 m12 l12">
|
||||||
|
<table class="highlight striped responsive-table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Product Name</th>
|
||||||
|
<th>Category</th>
|
||||||
|
<th>Store</th>
|
||||||
|
<th>Location</th>
|
||||||
|
<th>Actions</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{{#each products}}
|
||||||
|
<tr>
|
||||||
|
<td>{{prodName}}</td>
|
||||||
|
<td>{{prodCategory}}</td>
|
||||||
|
<td>{{prodStore}}</td>
|
||||||
|
<td>{{prodLocation}}</td>
|
||||||
|
<td>
|
||||||
|
<i class="material-icons clickable deleteProduct">delete</i>
|
||||||
|
<i class="material-icons clickable editProduct">edit</i>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{{/each}}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
19
client/AdminMgmt/ProductMgmt/prodMgmtTbl.js
Normal file
19
client/AdminMgmt/ProductMgmt/prodMgmtTbl.js
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
import { Products } from '../../../imports/api/products.js';
|
||||||
|
|
||||||
|
Template.prodMgmtTbl.onCreated(function() {
|
||||||
|
this.subscribe("myProducts");
|
||||||
|
});
|
||||||
|
|
||||||
|
Template.prodMgmtTbl.onRendered(function() {
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
Template.prodMgmtTbl.helpers({
|
||||||
|
products: function() {
|
||||||
|
return Products.find({});
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
Template.prodMgmtTbl.events({
|
||||||
|
|
||||||
|
});
|
||||||
11
client/AdminMgmt/StoreMgMt/storeMgmt.html
Normal file
11
client/AdminMgmt/StoreMgMt/storeMgmt.html
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
<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}}
|
||||||
|
|
||||||
|
</template>
|
||||||
17
client/AdminMgmt/StoreMgMt/storeMgmt.js
Normal file
17
client/AdminMgmt/StoreMgMt/storeMgmt.js
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
import { Stores } from '../../../imports/api/stores';
|
||||||
|
|
||||||
|
Template.storeMgmt.onCreated(function() {
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
Template.storeMgmt.onRendered(function() {
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
Template.storeMgmt.helpers({
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
Template.storeMgmt.events({
|
||||||
|
|
||||||
|
});
|
||||||
20
client/AdminMgmt/StoreMgMt/storeMgmtForm.html
Normal file
20
client/AdminMgmt/StoreMgMt/storeMgmtForm.html
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
<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>
|
||||||
|
</div>
|
||||||
|
<div class="col s12 m6 l6 input-field">
|
||||||
|
<input type="text" class="storeType" id="storeType" />
|
||||||
|
<label for="storeType">Type</label>
|
||||||
|
</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>
|
||||||
|
</template>
|
||||||
35
client/AdminMgmt/StoreMgMt/storeMgmtForm.js
Normal file
35
client/AdminMgmt/StoreMgMt/storeMgmtForm.js
Normal file
|
|
@ -0,0 +1,35 @@
|
||||||
|
import { Stores } from '../../../imports/api/stores';
|
||||||
|
|
||||||
|
Template.storeMgmtForm.onCreated(function() {
|
||||||
|
this.subscribe("storeInfo");
|
||||||
|
});
|
||||||
|
|
||||||
|
Template.storeMgmtForm.onRendered(function() {
|
||||||
|
Session.set("borderRed", false);
|
||||||
|
});
|
||||||
|
|
||||||
|
Template.storeMgmtForm.helpers({
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
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) {
|
||||||
|
if (err) {
|
||||||
|
// console.log("ERROR: Store add failed: " + err);
|
||||||
|
} else {
|
||||||
|
// console.log("Success adding store!");
|
||||||
|
$("#storeName").val("");
|
||||||
|
$("#storeType").val("");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
27
client/AdminMgmt/StoreMgMt/storeMgmtTbl.html
Normal file
27
client/AdminMgmt/StoreMgMt/storeMgmtTbl.html
Normal file
|
|
@ -0,0 +1,27 @@
|
||||||
|
<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>
|
||||||
|
{{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>
|
||||||
|
</template>
|
||||||
26
client/AdminMgmt/StoreMgMt/storeMgmtTbl.js
Normal file
26
client/AdminMgmt/StoreMgMt/storeMgmtTbl.js
Normal file
|
|
@ -0,0 +1,26 @@
|
||||||
|
import { Stores } from '../../../imports/api/stores';
|
||||||
|
|
||||||
|
Template.storeMgmtTbl.onCreated(function() {
|
||||||
|
this.subscribe("storeInfo");
|
||||||
|
});
|
||||||
|
|
||||||
|
Template.storeMgmtTbl.onRendered(function() {
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
Template.storeMgmtTbl.helpers({
|
||||||
|
mgmtStoreInfo: function() {
|
||||||
|
return Stores.find({});
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
Template.storeMgmtTbl.events({
|
||||||
|
'click .deleteStore' (event) {
|
||||||
|
event.preventDefault();
|
||||||
|
// console.log("Delete Store Clicked");
|
||||||
|
},
|
||||||
|
'click .editStore' (event) {
|
||||||
|
event.preventDefault();
|
||||||
|
// console.log("Edit Store Clicked");
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
|
|
||||||
Template.dashboard.onCreated(function() {
|
Template.dashboard.onCreated(function() {
|
||||||
|
this.subscribe("userList");
|
||||||
});
|
});
|
||||||
|
|
||||||
Template.dashboard.onRendered(function() {
|
Template.dashboard.onRendered(function() {
|
||||||
|
|
|
||||||
|
|
@ -1,28 +1,16 @@
|
||||||
<template name="headerBar">
|
<template name="headerBar">
|
||||||
<ul id="drop-manage" class="dropdown-content">
|
<ul id="drop-manage" class="dropdown-content">
|
||||||
{{#if isInRole "systemadmin"}}
|
|
||||||
<li><a href="#!" id="userMgmt" class="navBtn">User Management</a></li>
|
|
||||||
{{/if}}
|
|
||||||
<li><a href="#!" id="manageList" class="navBtn">List</a></li>
|
|
||||||
<li><a href="#!" id="manageCategory" class="navBtn">Category</a></li>
|
|
||||||
<li><a href="#!" id="manageProduct" class="navBtn">Product</a></li>
|
|
||||||
<li><a href="#!" id="manageLocation" class="navBtn">Location</a></li>
|
|
||||||
<li><a href="#!" id="manageStore" class="navBtn">Store</a></li>
|
|
||||||
<li><a href="#!" id="manageCabinet" class="navBtn">Cabinet</a></li>
|
|
||||||
<li><a href="#!" id="manageShelf" class="navBtn">Shelf</a></li>
|
|
||||||
<li><a href="#!" id="manageBin" class="navBtn">Bin</a></li>
|
|
||||||
</ul>
|
</ul>
|
||||||
<nav>
|
<nav>
|
||||||
<div class="nav-wrapper blue darken-4">
|
<div class="nav-wrapper blue darken-4">
|
||||||
<a href="#" class="brand-logo" id="brandLogo">Get My</a>
|
<a href="#" class="brand-logo center" id="brandLogo">Get My</a>
|
||||||
<a href="#" data-target="mobile-demo" class="sidenav-trigger"><i class="material-icons">menu</i></a>
|
<a href="#" data-target="mobile-demo" class="sidenav-trigger"><i class="material-icons">menu</i></a>
|
||||||
<ul class="right hide-on-med-and-down">
|
<ul class="right hide-on-med-and-down">
|
||||||
{{#if currentUser}}
|
{{#if currentUser}}
|
||||||
<li><a href="#" id="mylists" class="navBtn">My Lists</a></li>
|
<li><a href="#" id="mylists" class="navBtn">My Lists</a></li>
|
||||||
{{#if isInRole "admin,systemadmin"}}
|
<li><a href="#" id="manage" class="navBtn">Manage</a></li>
|
||||||
<li><a class="dropdown-trigger" href="#!" data-target="drop-manage">Manage<i class="material-icons right">arrow_drop_down</i></a></li>
|
<li class="signOut"><a href="#" class="signOut">Log Out</a></li>
|
||||||
{{/if}}
|
|
||||||
<li class="signOut"><a href="#" class="signOut">Log Out</a></li>
|
|
||||||
{{else}}
|
{{else}}
|
||||||
<li><a href="#!" id="login" class="navBtn">Login</a></li>
|
<li><a href="#!" id="login" class="navBtn">Login</a></li>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
@ -31,34 +19,9 @@
|
||||||
</nav>
|
</nav>
|
||||||
<ul class="sidenav" id="mobile-demo">
|
<ul class="sidenav" id="mobile-demo">
|
||||||
{{#if currentUser}}
|
{{#if currentUser}}
|
||||||
<ul class="collapsible">
|
<li><a href="#!" id="mylists">My Lists</a></li>
|
||||||
<li>
|
<li><a href="#!" id="manage">Manage</a></li>
|
||||||
<div class="collapsible-header" id="mylists">My Lists</div>
|
<li><a href="#!" class="signOut">Sign Out</a></li>
|
||||||
</li>
|
|
||||||
{{#if isInRole "admin,systemadmin"}}
|
|
||||||
<li>
|
|
||||||
<div class="collapsible-header">Manage<i class="material-icons">down-arrow</i></div>
|
|
||||||
<div class="collapsible-body">
|
|
||||||
<ul>
|
|
||||||
{{#if isInRole "systemadmin"}}
|
|
||||||
<li><a href="#" id="userMgmt">User Management</a></li>
|
|
||||||
{{/if}}
|
|
||||||
<li><a href="#" id="manageList">List</a></li>
|
|
||||||
<li><a href="#" id="manageCategory">Category</a></li>
|
|
||||||
<li><a href="#" id="manageProduct">Product</a></li>
|
|
||||||
<li><a href="#" id="manageLocation">Location</a></li>
|
|
||||||
<li><a href="#" id="manageStore">Store</a></li>
|
|
||||||
<li><a href="#" id="manageCabinet">Cabinet</a></li>
|
|
||||||
<li><a href="#" id="manageShelf">Shelf</a></li>
|
|
||||||
<li><a href="#" id="manageBin">Bin</a></li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
{{/if}}
|
|
||||||
<li>
|
|
||||||
<div class="collapsible-header signOut">Sign Out</div>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
{{else}}
|
{{else}}
|
||||||
<li><a href="#!" id="login" class="navBtn">Login</a></li>
|
<li><a href="#!" id="login" class="navBtn">Login</a></li>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,8 @@ Template.headerBar.onRendered(function() {
|
||||||
}, 200)
|
}, 200)
|
||||||
$(".dropdown-trigger").dropdown();
|
$(".dropdown-trigger").dropdown();
|
||||||
$('.collapsible').collapsible();
|
$('.collapsible').collapsible();
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
Template.headerBar.helpers({
|
Template.headerBar.helpers({
|
||||||
|
|
|
||||||
17
client/MainLayout.js
Normal file
17
client/MainLayout.js
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
|
||||||
|
|
||||||
|
Template.MainLayout.onCreated(function() {
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
Template.MainLayout.onRendered(function() {
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
Template.MainLayout.helpers({
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
Template.MainLayout.events({
|
||||||
|
|
||||||
|
});
|
||||||
|
|
@ -8,3 +8,15 @@ body {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.dark-mode {
|
||||||
|
background: #191818;
|
||||||
|
color: #fcfcfc;
|
||||||
|
}
|
||||||
|
|
||||||
|
input.dark-mode {
|
||||||
|
color: #fcfcfc;
|
||||||
|
}
|
||||||
|
|
||||||
|
select.dark-mode {
|
||||||
|
color: #fcfcfc;
|
||||||
|
}
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
<head>
|
<head>
|
||||||
<title>Parent Pickup</title>
|
<title>Get My</title>
|
||||||
|
|
||||||
<link id="favicon" rel="shortcut icon" type="image/png" href="favicon.png" />
|
<link id="favicon" rel="shortcut icon" type="image/png" href="favicon.png" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
|
|
||||||
|
|
@ -12,16 +12,16 @@ Categories.allow({
|
||||||
});
|
});
|
||||||
|
|
||||||
Meteor.methods({
|
Meteor.methods({
|
||||||
'add.category' (name) {
|
'add.category' (categoryName) {
|
||||||
check(name, String);
|
check(categoryName, String);
|
||||||
|
|
||||||
if (!this.userId) {
|
if (!this.userId) {
|
||||||
throw new Meteor.Error('You are not allowed to add categories. Make sure you are logged in with valid user credentials.');
|
throw new Meteor.Error('You are not allowed to add categories. Make sure you are logged in with valid user credentials.');
|
||||||
}
|
}
|
||||||
|
|
||||||
return Categories.insert({
|
return Categories.insert({
|
||||||
categoryName: name,
|
categoryName: categoryName,
|
||||||
categroyOwner: this.userid,
|
categoryOwner: this.userId,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
'edit.category' (categoryId, categoryName,) {
|
'edit.category' (categoryId, categoryName,) {
|
||||||
|
|
|
||||||
|
|
@ -12,9 +12,8 @@ Locations.allow({
|
||||||
});
|
});
|
||||||
|
|
||||||
Meteor.methods({
|
Meteor.methods({
|
||||||
'add.location' (name, type) {
|
'add.location' (name) {
|
||||||
check(name, String);
|
check(name, String);
|
||||||
check(type, String);
|
|
||||||
|
|
||||||
if (!this.userId) {
|
if (!this.userId) {
|
||||||
throw new Meteor.Error('You are not allowed to add locations. Make sure you are logged in with valid user credentials.');
|
throw new Meteor.Error('You are not allowed to add locations. Make sure you are logged in with valid user credentials.');
|
||||||
|
|
@ -22,14 +21,12 @@ Meteor.methods({
|
||||||
|
|
||||||
return Locations.insert({
|
return Locations.insert({
|
||||||
locationName: name,
|
locationName: name,
|
||||||
locationType: type,
|
owner: this.userId,
|
||||||
owner: this.userid,
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
'edit.location' (locationId, locationName, locationType) {
|
'edit.location' (locationId, locationName) {
|
||||||
check(locationId, String);
|
check(locationId, String);
|
||||||
check(locationName, String);
|
check(locationName, String);
|
||||||
check(locationType, String);
|
|
||||||
|
|
||||||
if (!this.userId) {
|
if (!this.userId) {
|
||||||
throw new Meteor.Error('You are not allowed to edit locations. Make sure you are logged in with valid user credentials.');
|
throw new Meteor.Error('You are not allowed to edit locations. Make sure you are logged in with valid user credentials.');
|
||||||
|
|
@ -38,7 +35,6 @@ Meteor.methods({
|
||||||
return Locations.update({ _id: locationId }, {
|
return Locations.update({ _id: locationId }, {
|
||||||
$set: {
|
$set: {
|
||||||
locationName: locationName,
|
locationName: locationName,
|
||||||
locationType: locationType,
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -20,10 +20,12 @@ Meteor.methods({
|
||||||
throw new Meteor.Error('You are not allowed to add stores. Make sure you are logged in with valid user credentials.');
|
throw new Meteor.Error('You are not allowed to add stores. Make sure you are logged in with valid user credentials.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log(" ---- userid: " + Meteor.user()._id);
|
||||||
|
|
||||||
return Stores.insert({
|
return Stores.insert({
|
||||||
storeName: storeName,
|
storeName: storeName,
|
||||||
storeType: storeType,
|
storeType: storeType,
|
||||||
owner: this.userid,
|
owner: Meteor.user()._id,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
'edit.store' (storeId, storeName, storeType) {
|
'edit.store' (storeId, storeName, storeType) {
|
||||||
|
|
|
||||||
32
imports/api/userConfigOptions.js
Normal file
32
imports/api/userConfigOptions.js
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
import { Meteor } from 'meteor/meteor';
|
||||||
|
import { Mongo } from 'meteor/mongo';
|
||||||
|
import { check } from 'meteor/check';
|
||||||
|
|
||||||
|
export const UserConfigOptions = new Mongo.Collection('userConfigOptions');
|
||||||
|
|
||||||
|
UserConfigOptions.allow({
|
||||||
|
insert: function(userId, doc){
|
||||||
|
// if use id exists, allow insert
|
||||||
|
return !!userId;
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
Meteor.methods({
|
||||||
|
'add.darkPref' (darkPref) {
|
||||||
|
check(darkPref, Boolean);
|
||||||
|
|
||||||
|
return UserConfigOptions.insert({
|
||||||
|
darkPref: darkPref,
|
||||||
|
owner: this.userId
|
||||||
|
});
|
||||||
|
},
|
||||||
|
'edit.darkPref' (darkPref) {
|
||||||
|
check(darkPref, Boolean);
|
||||||
|
|
||||||
|
return UserConfigOptions.update({ owner: this.userId }, {
|
||||||
|
$set: {
|
||||||
|
darkPref: darkPref
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
@ -1,10 +1,3 @@
|
||||||
FlowRouter.route('/', {
|
|
||||||
name: 'home',
|
|
||||||
action() {
|
|
||||||
BlazeLayout.render('MainLayout', { notLoggedIn: "home" });
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
FlowRouter.route('/dashboard', {
|
FlowRouter.route('/dashboard', {
|
||||||
name: 'home',
|
name: 'home',
|
||||||
action() {
|
action() {
|
||||||
|
|
@ -12,6 +5,20 @@ FlowRouter.route('/dashboard', {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
FlowRouter.route('/', {
|
||||||
|
name: 'homeNoRoute',
|
||||||
|
action() {
|
||||||
|
BlazeLayout.render('MainLayout', { main: "dashboard" });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
FlowRouter.route('/', {
|
||||||
|
name: 'homeNotLoggedIn',
|
||||||
|
action() {
|
||||||
|
BlazeLayout.render('MainLayout', { notLoggedIn: "login" });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
FlowRouter.route('/login', {
|
FlowRouter.route('/login', {
|
||||||
name: 'login',
|
name: 'login',
|
||||||
action() {
|
action() {
|
||||||
|
|
@ -31,4 +38,39 @@ FlowRouter.route('/userMgmt', {
|
||||||
action() {
|
action() {
|
||||||
BlazeLayout.render('MainLayout', { main: 'userMgmt' });
|
BlazeLayout.render('MainLayout', { main: 'userMgmt' });
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
FlowRouter.route('/manageStore', {
|
||||||
|
name: 'storeMgmt',
|
||||||
|
action() {
|
||||||
|
BlazeLayout.render('MainLayout', { main: 'storeMgmt' });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
FlowRouter.route('/manage', {
|
||||||
|
name: 'mgmtPage',
|
||||||
|
action() {
|
||||||
|
BlazeLayout.render('MainLayout', { main: 'mgmtPage' });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
FlowRouter.route('/manageProduct', {
|
||||||
|
name: 'manageProduct',
|
||||||
|
action() {
|
||||||
|
BlazeLayout.render('MainLayout', { main: 'prodMgmt' });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
FlowRouter.route('/manageCategory', {
|
||||||
|
name: 'manageCategory',
|
||||||
|
action() {
|
||||||
|
BlazeLayout.render('MainLayout', { main: 'catMgmt' });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
FlowRouter.route('/manageLocation', {
|
||||||
|
name: 'manageLocation',
|
||||||
|
action() {
|
||||||
|
BlazeLayout.render('MainLayout', { main: 'locMgmt' });
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -11,10 +11,24 @@ Meteor.methods({
|
||||||
console.log("User id for role: " + Meteor.userId() );
|
console.log("User id for role: " + Meteor.userId() );
|
||||||
let userId = Meteor.userId();
|
let userId = Meteor.userId();
|
||||||
Roles.addUsersToRoles(userId, role);
|
Roles.addUsersToRoles(userId, role);
|
||||||
|
Meteor.call('add.darkPref', false, function(err, result) {
|
||||||
|
if (err) {
|
||||||
|
console.log(" ERROR: can't set user dark mode preference: " + err);
|
||||||
|
} else {
|
||||||
|
console.log(" SUCCESSFULLY set user dark mode preference.");
|
||||||
|
}
|
||||||
|
});
|
||||||
} else if (countOfUsers == 1) {
|
} else if (countOfUsers == 1) {
|
||||||
console.log("Creating first system admin user: " + Meteor.userId() );
|
console.log("Creating first system admin user: " + Meteor.userId() );
|
||||||
let userId = Meteor.userId();
|
let userId = Meteor.userId();
|
||||||
Roles.addUsersToRoles(userId, "systemadmin");
|
Roles.addUsersToRoles(userId, "systemadmin");
|
||||||
|
Meteor.call('add.darkPref', false, function(err, result) {
|
||||||
|
if (err) {
|
||||||
|
console.log(" ERROR: can't set user dark mode preference: " + err);
|
||||||
|
} else {
|
||||||
|
console.log(" SUCCESSFULLY set user dark mode preference.");
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
@ -1,4 +1,9 @@
|
||||||
import { SysConfig } from '../imports/api/systemConfig.js';
|
import { SysConfig } from '../imports/api/systemConfig.js';
|
||||||
|
import { Stores } from '../imports/api/stores.js';
|
||||||
|
import { UserConfigOptions } from '../imports/api/userConfigOptions.js';
|
||||||
|
import { Products } from '../imports/api/products.js';
|
||||||
|
import { Categories } from '../imports/api/category.js';
|
||||||
|
import { Locations } from '../imports/api/location.js';
|
||||||
|
|
||||||
Meteor.publish("SystemConfig", function() {
|
Meteor.publish("SystemConfig", function() {
|
||||||
try {
|
try {
|
||||||
|
|
@ -7,3 +12,39 @@ Meteor.publish("SystemConfig", function() {
|
||||||
console.log(" ERROR pulling system config data: " + error);
|
console.log(" ERROR pulling system config data: " + error);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Meteor.publish('userList', function() {
|
||||||
|
return Meteor.users.find({});
|
||||||
|
});
|
||||||
|
|
||||||
|
Meteor.publish("storeInfo", function() {
|
||||||
|
try {
|
||||||
|
return Stores.find({ owner: this.userId });
|
||||||
|
} catch (error) {
|
||||||
|
console.log(" ERROR pulling store data: " + error);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Meteor.publish("myProducts", function() {
|
||||||
|
try {
|
||||||
|
return Products.find({ prodOwner: this.userId });
|
||||||
|
} catch (error) {
|
||||||
|
console.log(" ERROR pulling product data: " + error);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Meteor.publish("myCategories", function() {
|
||||||
|
try {
|
||||||
|
return Categories.find({ categoryOwner: this.userId });
|
||||||
|
} catch (error) {
|
||||||
|
console.log(" ERROR pulling category data: " + error);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Meteor.publish("myLocations", function() {
|
||||||
|
try {
|
||||||
|
return Locations.find({ owner: this.userId });
|
||||||
|
} catch (error) {
|
||||||
|
console.log(" ERROR pulling location data: " + error);
|
||||||
|
}
|
||||||
|
});
|
||||||
Loading…
Add table
Add a link
Reference in a new issue