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