mirror of
https://gitlab.com/bmcgonag/get_my.git
synced 2026-03-27 00:08:49 +00:00
Adding more methods and views, updated dashboards a bit. Still not ready
This commit is contained in:
parent
266dbd0856
commit
42643a37f5
23 changed files with 374 additions and 32 deletions
|
|
@ -1,21 +1,15 @@
|
|||
<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>
|
||||
<div class="row">
|
||||
<div class="col s12">
|
||||
<ul class="collection">
|
||||
{{#each cats}}
|
||||
<li class="collection-item">
|
||||
{{categoryName}}
|
||||
<i class="material-icons clickable deleteCategory right">delete</i>
|
||||
<i class="material-icons clickable editCategory right">edit</i>
|
||||
</li>
|
||||
{{/each}}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
5
client/AdminMgmt/ListMgmt/listMgmt.html
Normal file
5
client/AdminMgmt/ListMgmt/listMgmt.html
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
<template name="listMgmt">
|
||||
{{> listMgmtForm}}
|
||||
<hr>
|
||||
{{> listMgmtTbl}}
|
||||
</template>
|
||||
16
client/AdminMgmt/ListMgmt/listMgmt.js
Normal file
16
client/AdminMgmt/ListMgmt/listMgmt.js
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
|
||||
Template.listMgmt.onCreated(function() {
|
||||
|
||||
});
|
||||
|
||||
Template.listMgmt.onRendered(function() {
|
||||
|
||||
});
|
||||
|
||||
Template.listMgmt.helpers({
|
||||
|
||||
});
|
||||
|
||||
Template.listMgmt.events({
|
||||
|
||||
});
|
||||
18
client/AdminMgmt/ListMgmt/listMgmtForm.html
Normal file
18
client/AdminMgmt/ListMgmt/listMgmtForm.html
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
<template name="listMgmtForm">
|
||||
<h4>Lists</h4>
|
||||
<form action="submit" class="listAdd">
|
||||
<div class="row">
|
||||
<div class="col s8 m8 l10 input-field">
|
||||
<input type="text" class="listNameInp" style="{{#if $eq listNameErr true}}border: 2px solid red{{/if}}" id="listNameInp" />
|
||||
<label for="listNameInp">List Name</label>
|
||||
</div>
|
||||
<div class="col s4 m4 l2">
|
||||
{{#if $eq editMode false}}
|
||||
<a class="waves-effect waves-light btn saveListMgmt green right">Add</a>
|
||||
{{else}}
|
||||
<a class="waves-effect waves-light btn renameListMgmt blue right">Rename</a>
|
||||
{{/if}}
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</template>
|
||||
92
client/AdminMgmt/ListMgmt/listMgmtForm.js
Normal file
92
client/AdminMgmt/ListMgmt/listMgmtForm.js
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
import { Lists } from '../../../imports/api/lists.js';
|
||||
|
||||
Template.listMgmtForm.onCreated(function() {
|
||||
this.subscribe("myLists");
|
||||
});
|
||||
|
||||
Template.listMgmtForm.onRendered(function() {
|
||||
Session.set("listNameMiss", false);
|
||||
Session.set("listNameEditMode", false);
|
||||
});
|
||||
|
||||
Template.listMgmtForm.helpers({
|
||||
listNameErr: function() {
|
||||
return Session.get("listNameMiss");
|
||||
},
|
||||
editMode: function() {
|
||||
return Session.get("listNameEditMode");
|
||||
}
|
||||
});
|
||||
|
||||
Template.listMgmtForm.events({
|
||||
'click .saveListMgmt' (event) {
|
||||
event.preventDefault();
|
||||
let listName = $("#listNameInp").val();
|
||||
|
||||
if (listName == null || listName == "") {
|
||||
Session.set("listNameMiss", true);
|
||||
return;
|
||||
} else {
|
||||
Meteor.call('add.list', listName, function(err, result) {
|
||||
if (err) {
|
||||
console.log(" ERROR adding list name: " + err);
|
||||
} else {
|
||||
console.log(" SUCCESS adding list name.");
|
||||
$("#listNameInp").val("");
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
'click .renameListMgmt' (event) {
|
||||
event.preventDefault();
|
||||
let listName = $("#listNameInp").val();
|
||||
let listId = Session.get("listItemId");
|
||||
|
||||
if (listName == null || listName == "") {
|
||||
Session.set("listNameMiss", true);
|
||||
return;
|
||||
} else {
|
||||
Meteor.call('edit.list', listId, listName, function(err, result) {
|
||||
if (err) {
|
||||
console.log(" ERROR editing list name: " + err);
|
||||
} else {
|
||||
console.log(" SUCCESS editing list name.");
|
||||
$("#listNameInp").val("");
|
||||
Session.set("listNameEditMode", false);
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
'submit .listAdd' (event) {
|
||||
event.preventDefault();
|
||||
let editMode = Session.get("listNameEditMode");
|
||||
let listName = $("#listNameInp").val();
|
||||
let listId = Session.get("listItemId");
|
||||
|
||||
if (listName == null || listName == "") {
|
||||
Session.set("listNameMiss", true);
|
||||
return;
|
||||
} else {
|
||||
if (editMode == false) {
|
||||
Meteor.call('add.list', listName, function(err, result) {
|
||||
if (err) {
|
||||
console.log(" ERROR adding list name: " + err);
|
||||
} else {
|
||||
console.log(" SUCCESS adding list name.");
|
||||
$("#listNameInp").val("");
|
||||
}
|
||||
});
|
||||
} else {
|
||||
Meteor.call('edit.list', listId, listName, function(err, result) {
|
||||
if (err) {
|
||||
console.log(" ERROR editing list name: " + err);
|
||||
} else {
|
||||
console.log(" SUCCESS editing list name.");
|
||||
$("#listNameInp").val("");
|
||||
Session.set("listNameEditMode", false);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
16
client/AdminMgmt/ListMgmt/listMgmtTbl.html
Normal file
16
client/AdminMgmt/ListMgmt/listMgmtTbl.html
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
<template name="listMgmtTbl">
|
||||
<div class="row">
|
||||
<div class="col s12">
|
||||
<ul class="collection">
|
||||
{{#each lists}}
|
||||
<li class="collection-item">
|
||||
{{listName}}
|
||||
<i class="material-icons clickable deleteListName tooltipped right" data-position="top" data-tooltip="Delete This List">delete</i>
|
||||
<i class="material-icons clickable editListName tooltipped right" data-position="top" data-tooltip="Edit This List">edit</i>
|
||||
<i class="material-icons clickable markListComplete tooltipped right" data-position="top" data-tooltip="Mark Complete">check</i>
|
||||
</li>
|
||||
{{/each}}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
47
client/AdminMgmt/ListMgmt/listMgmtTbl.js
Normal file
47
client/AdminMgmt/ListMgmt/listMgmtTbl.js
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
import { Lists } from '../../../imports/api/lists.js';
|
||||
|
||||
Template.listMgmtTbl.onCreated(function() {
|
||||
this.subscribe("myLists");
|
||||
});
|
||||
|
||||
Template.listMgmtTbl.onRendered(function() {
|
||||
$('.tooltipped').tooltip();
|
||||
});
|
||||
|
||||
Template.listMgmtTbl.helpers({
|
||||
lists: function() {
|
||||
return Lists.find({});
|
||||
}
|
||||
});
|
||||
|
||||
Template.listMgmtTbl.events({
|
||||
'click .deleteListName' (event) {
|
||||
event.preventDefault();
|
||||
let listId = this._id;
|
||||
Meteor.call('delete.list', listId, function(err, result) {
|
||||
if (err) {
|
||||
console.log(" ERROR deleting list: " + err);
|
||||
} else {
|
||||
console.log(" SUCCESS deleting list.");
|
||||
}
|
||||
});
|
||||
},
|
||||
'click .editListName' (event) {
|
||||
event.preventDefault();
|
||||
let listName = Lists.findOne({ _id: this._id }).listName;
|
||||
$("#listNameInp").val(listName);
|
||||
Session.set("listNameEditMode", true);
|
||||
Session.set("listItemId", this._id);
|
||||
},
|
||||
'click .markListComplete' (event) {
|
||||
event.preventDefault();
|
||||
let listId = this._id;
|
||||
Meteor.call('mark.complete', listId, function(err, result) {
|
||||
if (err) {
|
||||
console.log(" ERROR marking complete: " + err);
|
||||
} else {
|
||||
console.log(" SUCCESS marking complete.");
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
@ -1,12 +1,12 @@
|
|||
<template name="mgmtPage">
|
||||
<div class="row">
|
||||
<div class="col s12 m6 l6">
|
||||
<div class="col s12">
|
||||
<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="manageLists" class="collection-item">List</a></li>
|
||||
<li><a href="#!" id="manageCategory" class="collection-item">Category</a></li>
|
||||
<li><a href="#!" id="manageProduct" class="collection-item">Product</a></li>
|
||||
<li><a href="#!" id="manageLocation" class="collection-item">Location</a></li>
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
{{#each stores}}
|
||||
<option value="{{storeName}}">{{storeName}}</option>
|
||||
{{/each}}
|
||||
<option id="addNewStore" class="modal-trigger" href="modalStore" value="addNewStore">Add New Store</option>
|
||||
<option id="addNewStore" value="addNewStore">Add New Store</option>
|
||||
</select>
|
||||
<label for="prodStore">Store</label>
|
||||
</div>
|
||||
|
|
@ -46,7 +46,8 @@
|
|||
<a class="waves-effect waves-light btn saveProdMgmt green right">Add</a>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Modal Structure -->
|
||||
|
||||
<!-- Store Modal Structure -->
|
||||
<div id="modalStore" class="modal">
|
||||
<div class="modal-content">
|
||||
<h4>Add New Store</h4>
|
||||
|
|
@ -56,4 +57,26 @@
|
|||
<a href="#!" class="modal-close waves-effect waves-green btn-flat">Done</a>
|
||||
</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>
|
||||
|
|
@ -62,6 +62,10 @@ Template.prodMgmtForm.events({
|
|||
// console.log(" ERROR: can't add product: " + err);
|
||||
} else {
|
||||
// console.log(" SUCCESS adding product.");
|
||||
$("#prodName").val("");
|
||||
$("#prodCategory").val("");
|
||||
$("#prodStore").val("");
|
||||
$("#prodLocation").val("");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -71,7 +75,7 @@ Template.prodMgmtForm.events({
|
|||
$("#prodName").val("");
|
||||
$("#prodCategory").val("");
|
||||
$("#prodStore").val("");
|
||||
$("#prodLocation").val("")
|
||||
$("#prodLocation").val("");
|
||||
},
|
||||
'change #prodStore' (event) {
|
||||
event.preventDefault();
|
||||
|
|
@ -81,7 +85,6 @@ Template.prodMgmtForm.events({
|
|||
$("#prodStore").val("");
|
||||
// open a modal to enter store information.
|
||||
$('#modalStore').modal('open');
|
||||
|
||||
}
|
||||
},
|
||||
'change #prodLocation' (event) {
|
||||
|
|
@ -98,10 +101,13 @@ Template.prodMgmtForm.events({
|
|||
event.preventDefault();
|
||||
let val = $("#prodCategory").val();
|
||||
|
||||
if (val == "addNewCategory") {
|
||||
if (val == "addNewCat") {
|
||||
$("#prodCategory").val("");
|
||||
// open a modal to enter store information.
|
||||
$('#modalCategory').modal('open');
|
||||
}
|
||||
},
|
||||
'click .modal-close' (event) {
|
||||
$('select').formSelect();
|
||||
}
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue