initial commit

This commit is contained in:
Brian McGonagill 2022-08-04 19:50:18 -05:00
parent b7c7d8b449
commit 750811a81f
52 changed files with 25204 additions and 92 deletions

View file

View file

@ -0,0 +1,43 @@
<template name="parentLogin">
{{#if $not currentUser}}
<div id="signInForm">
<div class="container">
<h3>Parent / Guardian Login</h3>
<p>It is very important to the safety of all children that you do not share your login credentials with anyone.</p>
<div class="card">
<div class="card-content">
<form class="login">
<div class="row">
<div class="col s12 input-field">
<input type="email" name="email" id="email" class="email {{#if $eq misEmail true}}red lighten-3{{/if}}" />
<label for="email">Email *</label>
</div>
</div>
<div class="row">
<div class="col s12 input-field">
<input type="password" name="password" id="password" class="password {{#if $eq misPass true}}red lighten-3{{/if}}" />
<label for="password">Password *</label>
</div>
</div>
{{#if $eq areFilled false}}
<div class="row">
<div class="col s12 red lighten-3 white-text">
<span>You must fill all fields to login.</span>
</div>
</div>
{{/if}}
<div class="row">
<div class="col s12">
<a id="logmein" class="waves-effect waves-light btn logmein green darken-1">Log In</a>
</div>
</div>
</form>
</div>
<div class="card-action">
<a href="#" id="parentReg">Register</a>
</div>
</div>
</div>
</div>
{{/if}}
</template>

View file

@ -0,0 +1,33 @@
Template.parentLogin.onCreated(function() {
});
Template.parentLogin.onRendered(function() {
});
Template.parentLogin.helpers({
areFilled: function() {
return Session.get("filledFields");
},
});
Template.parentLogin.events({
'click #logmein' (event) {
event.preventDefault();
console.log("clicked login");
let email = $("#email").val();
let pass = $("#password").val();
if (email == null || email == "" || pass == "" || pass == null) {
Session.set("filledFields", false);
return;
} else {
Meteor.loginWithPassword(email, pass);
}
},
'click #parentReg' (event) {
event.preventDefault();
FlowRouter.go('/parentReg');
},
});

View file

@ -0,0 +1,123 @@
Template.parentsRegistration.onRendered(function() {
Session.set("canreg", false);
Session.set("missingReq", false);
Session.set("missingName", false);
Session.set("missingPhone", false);
Session.set("missingEmail", false);
Session.set("missingPassword", false);
});
Template.parentsRegistration.helpers({
canReg: function() {
return Session.get("canreg");
},
misName: function() {
return Session.get("missingName");
},
misPhone: function() {
return Session.get("missingPhone");
},
misEmail: function() {
return Session.get("missingEmail");
},
misPass: function() {
return Session.get("missingPassword");
},
misReq: function() {
return Session.get("missingReq");
}
});
Template.parentsRegistration.events({
'click #registerMe' (event) {
event.preventDefault();
if (Session.get("canreg") == false) {
console.log("reg disabled.");
} else {
console.log("Clicked");
let missingName = false;
let missingPhone = false;
let missingEmail = false;
let missingPassword = false;
let email = $("#email").val();
let password = $("#password").val();
let name = $("#name").val();
let phone = $("#phone").val();
if (name == "" || name == null) {
missingName = true;
Session.set("missingName", true);
}
if (phone == "" || phone == null) {
missingPhone = true;
Session.set("missingPhone", true);
}
if (email == "" || email == null) {
missingEmail = true;
Session.set("missingEmail", true);
}
if (password == "" || password == null) {
missingPassword = true;
Session.set("missingPassword", true);
}
let userId;
if (missingName == true || missingPhone == true || missingEmail == true || missingPassword == true) {
Session.set("missingReq", true);
} else {
Session.set("missingReq", false);
Accounts.createUser({
email: email,
password: password,
profile: {
fullname: name,
phone: phone,
}
});
let userId = Meteor.userId();
console.log("User ID: " + userId);
Meteor.call("addToRole", "parent", function(err, result) {
if (err) {
console.log(" ERROR: ROLES - Error adding user to role: " + err);
} else {
// console.log("User should be added to role - parent.");
FlowRouter.go('/dashboard');
}
});
}
}
},
'keyup #passwordConfirm' (event) {
let pwd = $("#password").val();
let pwdconf = $("#passwordConfirm").val();
if (pwd == pwdconf) {
// console.log("passwords match");
Session.set("canreg", true);
} else {
// console.log("passwords don't match");
Session.set("canreg", false);
}
},
'change #email' (event) {
let email = $("#email").val();
var regex = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/;
let isEmail = regex.test(email);
if (isEmail == false) {
Session.set("missingEmail", true);
} else {
Session.set("missingEmail", false);
}
},
'click #parguarlogin' (event) {
event.preventDefault();
FlowRouter.go('/parguarlogin');
},
});

View file

@ -0,0 +1,56 @@
<template name="parentsRegistration">
{{#if $not currentUser}}
<div id="registrationForm">
<div class="container">
<h3>Parent / Guardian Registration</h3>
<p>It is very important to the safety of all children that you do not share your login credentials with anyone.</p>
<div class="row">
<div class="col s12">
<div class="card">
<div class="card-content">
<form class="register">
<div class="row">
<div class="col s12 input-field">
<input type="text" name="name" class="name {{#if $eq misName true}}red lighten-3{{/if}}" id="name" />
<label for="name">Your Full Name *</label>
</div>
<div class="col s12 input-field">
<input type="tel" name="phone" class="phone {{#if $eq misPhone true}}red lighten-3{{/if}}" id="phone" />
<label for="phone">Best Phone Number *</label>
</div>
</div>
<div class="row">
<div class="col s12 input-field">
<input type="email" name="email" id="email" class="email {{#if $eq misEmail true}}red lighten-3{{/if}}" />
<label for="email">Email *</label>
</div>
</div>
<div class="row">
<div class="col s12 input-field">
<input type="password" name="password" id="password" class="password {{#if $eq misPass true}}red lighten-3{{/if}}" />
<label for="password">Password *</label>
</div>
</div>
<div class="row">
<div class="col s12 input-field {{#if $eq canReg false}}orange lighten-1{{/if}}">
<input type="password" name="passwordConfirm" id="passwordConfirm" class="passwordConfirm" />
<label for="passwordConfirm">Confirm Password *</label>
</div>
</div>
<div class="row">
<div class="col s12">
<a id="registerMe" class="waves-effect waves-light btn registerMe {{#if $eq canReg false}}grey{{else}}green darken-1{{/if}}">Register</a>
</div>
</div>
</form>
</div>
<div class="card-action">
<a href="#" id="parguarlogin">Sign In</a>
</div>
</div>
</div>
</div>
</div>
</div>
{{/if}}
</template>

View file

@ -0,0 +1,50 @@
<template name="systemAdminLogin">
{{#if $not currentUser}}
<div id="signInForm">
<div class="container">
<h3>System Administrator Login</h3>
<p>It is very important to the safety of all children that you do not share your login credentials with anyone.</p>
<div class="card">
<div class="card-content">
<form class="login">
<div class="row">
<div class="col s12 input-field">
<input type="email" name="email" id="email" class="email {{#if $eq misEmail true}}red lighten-3{{/if}}" />
<label for="email">Email *</label>
</div>
</div>
<div class="row">
<div class="col s12 input-field">
<input type="password" name="password" id="password" class="password {{#if $eq misPass true}}red lighten-3{{/if}}" />
<label for="password">Password *</label>
</div>
</div>
{{#if $eq areFilled false}}
<div class="row">
<div class="col s12 red lighten-3 white-text">
<span>You must fill all fields to login.</span>
</div>
</div>
{{/if}}
{{#if $eq loginError true}}
<div class="row">
<div class="col s12 red lighten-2 white-text">
<span>Username or Password is incorrect. Please check your credentials and try again, or click 'Register' to create a new account.</span>
</div>
</div>
{{/if}}
<div class="row">
<div class="col s12">
<a id="logmein" class="waves-effect waves-light btn logmein green darken-1">Log In</a>
</div>
</div>
</form>
</div>
<div class="card-action">
<a href="#" id="sysAdminReg">Register</a>
</div>
</div>
</div>
</div>
{{/if}}
</template>

View file

@ -0,0 +1,45 @@
Template.systemAdminLogin.onCreated(function() {
});
Template.systemAdminLogin.onRendered(function() {
});
Template.systemAdminLogin.helpers({
areFilled: function() {
return Session.get("filledFields");
},
loginError: function() {
return Session.get("loginError");
},
});
Template.systemAdminLogin.events({
'click #logmein' (event) {
event.preventDefault();
console.log("clicked login");
let email = $("#email").val();
let pass = $("#password").val();
if (email == null || email == "" || pass == "" || pass == null) {
Session.set("filledFields", false);
return;
} else {
return Meteor.loginWithPassword(email, pass, function(err, result) {
if (err) {
console.log("Error logging in: " + err);
Session.set("loginError", true);
} else {
console.log("login result: " + result);
Session.set("loginError", false);
FlowRouter.go('/dashboard');
}
});
}
},
'click #sysAdminReg' (event) {
event.preventDefault();
FlowRouter.go('/systemAdminReg');
},
});

View file

@ -0,0 +1,69 @@
<template name="systemAdminReg">
{{#if Template.subscriptionsReady}}
{{#if $not currentUser}}
<div id="registrationForm">
<div class="container">
{{#if $eq allowedReg true}}
<h3>System Admin Registration</h3>
<p>If you want to disable System Admin registration after creating this account, please check the box.</p>
<div class="row">
<div class="col s12">
<div class="card">
<div class="card-content">
<form class="register">
<div class="row">
<div class="col s12 input-field">
<input type="text" name="name" class="name {{#if $eq misName true}}red lighten-3{{/if}}" id="name" />
<label for="name">Your Full Name *</label>
</div>
</div>
<div class="row">
<div class="col s12 input-field">
<input type="email" name="email" id="email" class="email {{#if $eq misEmail true}}red lighten-3{{/if}}" />
<label for="email">Email *</label>
</div>
</div>
<div class="row">
<div class="col s12 input-field">
<input type="password" name="password" id="password" class="password {{#if $eq misPass true}}red lighten-3{{/if}}" />
<label for="password">Password *</label>
</div>
</div>
<div class="row">
<div class="col s12 input-field {{#if $eq canReg false}}orange lighten-1{{/if}}">
<input type="password" name="passwordConfirm" id="passwordConfirm" class="passwordConfirm" />
<label for="passwordConfirm">Confirm Password *</label>
</div>
</div>
<div class="row">
<div class="col s12">
<p>
<label>
<input type="checkbox" id="disableSysAdminReg" />
<span>Disable Future System Admin Registrations</span>
</label>
</p>
</div>
</div>
<div class="row">
<div class="col s12">
<a id="registerMe" class="waves-effect waves-light btn registerMe {{#if $eq canReg false}}grey{{else}}green darken-1{{/if}}">Register</a>
</div>
</div>
</form>
</div>
<div class="card-action">
<a href="#" id="sysAdminLogin">Sign In</a>
</div>
</div>
</div>
</div>
{{else}}
<h3>System Admin Registration Disabled</h3>
<p>A system administrator has disabled the ability to register as a new system admin. If you believe this was done mistakenly, contact a current system administrator for this system, and have them change this setting.</p>
{{/if}}
</div>
</div>
{{/if}}
{{/if}}
</template>

View file

@ -0,0 +1,118 @@
import { SysConfig } from '../../../imports/api/systemConfig.js';
Template.systemAdminReg.onCreated(function() {
this.subscribe("SystemConfig");
});
Template.systemAdminReg.onRendered(function() {
Session.set("canReg", false);
Session.set("misName", false);
Session.set("misEmail", false);
Session.set("misPass", false);
});
Template.systemAdminReg.helpers({
allowedReg: function() {
let sysconf = SysConfig.findOne();
if (typeof sysconf == 'undefined') {
return true;
} else {
console.dir(sysconf);
return sysconf.canReg;
}
},
canReg: function() {
return Session.get("canReg");
},
misName: function() {
return Session.get("misName");
},
misEmail: function() {
return Session.get("misEmail");
},
misPass: function() {
return Session.get("misPass");
},
});
Template.systemAdminReg.events({
'click #registerMe' (event) {
event.preventDefault();
if (Session.get("canReg") == false) {
// console.log("reg disabled.");
} else {
let name = $("#name").val();
let email = $("#email").val();
let pass = $("#password").val();
let disableSysAdReg = $("#disableSysAdminReg").prop("checked");
if (name == "" || name == null) {
Session.set("misName", true);
}
if (email == "" || email == null) {
Session.set("misEmail", true);
}
if (pass == "" || pass == null) {
Session.set("misPass", true);
}
if (name == "" || name == null || email == "" || email == null || pass == "" || pass == null) {
console.log("required info missing.");
} else {
// call meteor method to create user and add them to sys admin role.
Accounts.createUser({
email: email,
password: pass,
profile: {
fullname: name,
}
});
let userId = Meteor.userId();
console.log("User ID: " + userId);
Meteor.call("addToRole", "systemadmin", function(err, result) {
if (err) {
console.log(" ERROR: ROLES - Error adding user to role: " + err);
} else {
Meteor.call('add.noSysAdminReg', function(err, result) {
if (err) {
console.log(" ERROR: SYS ADMIN REG - Error setting system admin registration as disabled: " + err);
} else {
FlowRouter.go('/dashboard');
}
});
}
});
}
}
},
'keyup #passwordConfirm' (event) {
let pwd = $("#password").val();
let pwdconf = $("#passwordConfirm").val();
if (pwd == pwdconf) {
// console.log("passwords match");
Session.set("canReg", true);
} else {
// console.log("passwords don't match");
Session.set("canReg", false);
}
},
'change #email' (event) {
let email = $("#email").val();
var regex = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/;
let isEmail = regex.test(email);
if (isEmail == false) {
Session.set("misEmail", true);
} else {
Session.set("misEmail", false);
}
},
'click #sysAdminLogin' (event) {
event.preventDefault();
FlowRouter.go('/sysAdminlogin');
},
});

View file

@ -0,0 +1,43 @@
<template name="teacherLogin">
{{#if $not currentUser}}
<div id="signInForm">
<div class="container">
<h3>Teacher Login</h3>
<p>It is very important to the safety of all children that you do not share your login credentials with anyone.</p>
<div class="card">
<div class="card-content">
<form class="login">
<div class="row">
<div class="col s12 input-field">
<input type="email" name="email" id="email" class="email {{#if $eq misEmail true}}red lighten-3{{/if}}" />
<label for="email">Email *</label>
</div>
</div>
<div class="row">
<div class="col s12 input-field">
<input type="password" name="password" id="password" class="password {{#if $eq misPass true}}red lighten-3{{/if}}" />
<label for="password">Password *</label>
</div>
</div>
{{#if $eq areFilled false}}
<div class="row">
<div class="col s12 red lighten-3 white-text">
<span>You must fill all fields to login.</span>
</div>
</div>
{{/if}}
<div class="row">
<div class="col s12">
<a id="logmein" class="waves-effect waves-light btn logmein green darken-1">Log In</a>
</div>
</div>
</form>
</div>
<div class="card-action">
<a href="#" id="teacherReg">Register</a>
</div>
</div>
</div>
</div>
{{/if}}
</template>

View file

@ -0,0 +1,33 @@
Template.teacherLogin.onCreated(function() {
});
Template.teacherLogin.onRendered(function() {
});
Template.teacherLogin.helpers({
areFilled: function() {
return Session.get("filledFields");
},
});
Template.teacherLogin.events({
'click #logmein' (event) {
event.preventDefault();
console.log("clicked login");
let email = $("#email").val();
let pass = $("#password").val();
if (email == null || email == "" || pass == "" || pass == null) {
Session.set("filledFields", false);
return;
} else {
Meteor.loginWithPassword(email, pass);
}
},
'click #teacherReg' (event) {
event.preventDefault();
FlowRouter.go('/teachReg');
},
});

View file

@ -0,0 +1,56 @@
<template name="teacherRegistration">
{{#if $not currentUser}}
<div id="registrationForm">
<div class="container">
<h3>Teacher Registration</h3>
<p>It is very important to the safety of all children that you do not share your login credentials with anyone.</p>
<div class="row">
<div class="col s12">
<div class="card">
<div class="card-content">
<form class="register">
<div class="row">
<div class="col s12 input-field">
<input type="text" name="name" class="name {{#if $eq misName true}}red lighten-3{{/if}}" id="name" />
<label for="name">Your Full Name *</label>
</div>
<div class="col s12 input-field">
<input type="tel" name="phone" class="phone {{#if $eq misPhone true}}red lighten-3{{/if}}" id="phone" />
<label for="phone">Best Phone Number *</label>
</div>
</div>
<div class="row">
<div class="col s12 input-field">
<input type="email" name="email" id="email" class="email {{#if $eq misEmail true}}red lighten-3{{/if}}" />
<label for="email">Email *</label>
</div>
</div>
<div class="row">
<div class="col s12 input-field">
<input type="password" name="password" id="password" class="password {{#if $eq misPass true}}red lighten-3{{/if}}" />
<label for="password">Password *</label>
</div>
</div>
<div class="row">
<div class="col s12 input-field {{#if $eq canReg false}}orange lighten-1{{/if}}">
<input type="password" name="passwordConfirm" id="passwordConfirm" class="passwordConfirm" />
<label for="passwordConfirm">Confirm Password *</label>
</div>
</div>
<div class="row">
<div class="col s12">
<a id="registerMe" class="waves-effect waves-light btn registerMe {{#if $eq canReg false}}grey{{else}}green darken-1{{/if}}">Register</a>
</div>
</div>
</form>
</div>
<div class="card-action">
<a href="#" id="teachLogin">Sign In</a>
</div>
</div>
</div>
</div>
</div>
</div>
{{/if}}
</template>

View file

@ -0,0 +1,127 @@
Template.teacherRegistration.onCreated(function() {
});
Template.teacherRegistration.onRendered(function() {
Session.set("canreg", false);
Session.set("missingReq", false);
Session.set("missingName", false);
Session.set("missingPhone", false);
Session.set("missingEmail", false);
Session.set("missingPassword", false);
});
Template.teacherRegistration.helpers({
canReg: function() {
return Session.get("canreg");
},
misName: function() {
return Session.get("missingName");
},
misPhone: function() {
return Session.get("missingPhone");
},
misEmail: function() {
return Session.get("missingEmail");
},
misPass: function() {
return Session.get("missingPassword");
},
misReq: function() {
return Session.get("missingReq");
}
});
Template.teacherRegistration.events({
'click #registerMe' (event) {
event.preventDefault();
if (Session.get("canreg") == false) {
// console.log("reg disabled.");
} else {
// console.log("Clicked");
let missingName = false;
let missingPhone = false;
let missingEmail = false;
let missingPassword = false;
let email = $("#email").val();
let password = $("#password").val();
let name = $("#name").val();
let phone = $("#phone").val();
if (name == "" || name == null) {
missingName = true;
Session.set("missingName", true);
}
if (phone == "" || phone == null) {
missingPhone = true;
Session.set("missingPhone", true);
}
if (email == "" || email == null) {
missingEmail = true;
Session.set("missingEmail", true);
}
if (password == "" || password == null) {
missingPassword = true;
Session.set("missingPassword", true);
}
let userId;
if (missingName == true || missingPhone == true || missingEmail == true || missingPassword == true) {
Session.set("missingReq", true);
} else {
Session.set("missingReq", false);
Accounts.createUser({
email: email,
password: password,
profile: {
fullname: name,
phone: phone,
}
});
let userId = Meteor.userId();
console.log("User ID: " + userId);
Meteor.call("addToRole", "teacher", function(err, result) {
if (err) {
console.log(" ERROR: ROLES - Error adding user to role: " + err);
} else {
// console.log("User should be added to role - teacher.");
FlowRouter.go('/dashboard');
}
});
}
}
},
'keyup #passwordConfirm' (event) {
let pwd = $("#password").val();
let pwdconf = $("#passwordConfirm").val();
if (pwd == pwdconf) {
// console.log("passwords match");
Session.set("canreg", true);
} else {
// console.log("passwords don't match");
Session.set("canreg", false);
}
},
'change #email' (event) {
let email = $("#email").val();
var regex = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/;
let isEmail = regex.test(email);
if (isEmail == false) {
Session.set("missingEmail", true);
} else {
Session.set("missingEmail", false);
}
},
'click #teachLogin' (event) {
event.preventDefault();
FlowRouter.go('/teachlogin');
},
});

View file

@ -0,0 +1,16 @@
<template name="userMgmt">
{{#if isInRole 'systemadmin'}}
<h3>User Management</h3>
<div class="row">
<div class="col s12 m6 l4 input-field" id="usersListCol">
</div>
<div class="col s12 m6 l4 input-field" id="userAssignedRoleCol">
</div>
<div class="col s12 m6 l4" id="assignRoleBtnCol">
</div>
</div>
{{/if}}
</template>

View file

@ -0,0 +1,17 @@
Template.userMgmt.onCreated(function() {
});
Template.userMgmt.onRendered(function() {
});
Template.userMgmt.helpers({
});
Template.userMgmt.events({
});

View file

@ -0,0 +1,83 @@
<template name="createServiceEntity">
<div class="container">
<h3>Create a Service Entity</h3>
<div class="row">
<div class="col s12">
<div class="card">
<div class="card-content">
<span class="card-title">New Service Entity</span>
<div class="row">
<div class="col s12 input-field">
<input type="text" class="entityName" id="entityName">
<label for="entityName">Entity Name</label>
</div>
</div>
<div class="row">
<div class="col s12 input-field">
<input type="text" class="entityAddress" id="entityAddress">
<label for="entityAddress">Address</label>
</div>
</div>
<div class="row">
<div class="col s12 m6 l6 input-field">
<input type="text" class="entityCity" id="entityCity" />
<label for="entityCity">City</label>
</div>
<div class="col s12 m3 l3 input-field">
<input type="text" class="entityState" id="entityState">
<label for="entityState">State</label>
</div>
<div class="col s12 m3 l3 input-field">
<input type="text" class="entityZip" id="entityZip" />
<label for="entityZip">Postal / Zip Code</label>
</div>
</div>
<div class="row">
<div class="col s12 m6 l6 input-field">
<input type="tel" class="entityPhone" id="entityPhone" />
<label for="entityPhone">Primary Phone</label>
</div>
<div class="col s12 m6 l6 input-field">
<input type="email" class="entityEmail" id="entityEmail" />
<label for="entityEmail">Primary Email</label>
</div>
</div>
<div class="row">
<div class="col s12 m6 l6 input-field">
<select name="entityType" id="entityType" class="entityType">
<option value="" disabled selected>Choose One...</option>
<option value="School">School</option>
<option value="Church">Church</option>
<option value="Daycare">Daycare</option>
<option value="Hospital">Hospital</option>
<option value="Elder Care">Elder Care</option>
<option value="Group Home">Group Home</option>
<option value="After School">After School</option>
<option value="Sports Program">Sports Program</option>
<option value="Private School">Private School</option>
</select>
<label for="entityType">Entity Type</label>
</div>
<div class="col s12 m4 l4 input-field">
<input type="text" class="entityCode" id="entityCode" value="{{#if $eq useCodeGen true}}{{codeGen}}{{/if}}"/>
<label for="entityCode">Entity Code</label>
</div>
<div class="col s12 m2 l2">
<a class="waves-effect waves-light btn tooltipped generateEntityCode" data-position="bottom" data-tooltip="Generate Entity Code" id="generateEntityCode"><i class="material-icons">refresh</i></a>
</div>
</div>
<div class="row">
<div class="col s6 m6 l6">
<a class="waves-effect waves-light btn-large orange cancelNewEntity" id="cancelNewEntity">Cancel</a>
</div>
<div class="col s6 m6 l6">
<a class="waves-effect waves-light btn-large green right saveNewEntity" id="saveNewEntity">Save</a>
</div>
</div>
</div>
</div>
</div>
</div>
{{> snackbar}}
</div>
</template>

View file

@ -0,0 +1,73 @@
import { ServiceEntities } from '../../imports/api/serviceentities.js';
Template.createServiceEntity.onCreated(function() {
this.subscribe("ServiceEntities");
});
Template.createServiceEntity.onRendered(function() {
$('select').formSelect();
$('.tooltipped').tooltip();
});
Template.createServiceEntity.helpers({
codeGen: function() {
return Session.get("codeGen");
},
useCodeGen: function() {
return Session.get("useCodeGen");
},
});
Template.createServiceEntity.events({
'click #saveNewEntity' (event) {
event.preventDefault();
let name = $("#entityName").val();
let code = $("#entityCode").val();
let address = $("#entityAddress").val();
let city = $("#entityCity").val();
let state = $("#entityState").val();
let zip = $("#entityZip").val();
let phone = $("#entityPhone").val();
let email = $("#entityEmail").val();
let type = $("#entityType").val();
if (name == "" || name == null || code == "" || code == null) {
Session.set("misReqEnt", true);
} else {
Session.set("misReqEnt", false);
Meteor.call("add.serviceEntity", name, code, address, city, state, zip, phone, email, type, function(err, result) {
if (err) {
console.log(" ERROR adding service entity: " + err);
showSnackbar("Error Adding Service Entity", "red");
} else {
console.log(" SUCCESS: Added Entity Succesfully!");
showSnackbar("Entity Added Successfully", "green");
}
});
}
},
'click #cancelNewEntity' (event) {
event.preventDefault();
$("#entityName").val("");
$("#entityCode").val("");
$("#entityAddress").val("");
$("#entityCity").val("");
$("#entityState").val("");
$("#entityZip").val("");
$("#entityPhone").val("");
$("#entityEmail").val("");
$("#entityType").val("");
},
'click #generateEntityCode' (event) {
event.preventDefault();
let length = 6;
let chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
let result = '';
for (let i = length; i > 0; --i) result += chars[Math.floor(Math.random() * chars.length)];
Session.set("codeGen", result);
Session.set("useCodeGen", true);
}
});

View file

@ -0,0 +1,29 @@
<template name="dashboard">
<h2>My Dashboard</h2>
<div class="row">
<div class="col s12 m6">
<div class="card blue-grey darken-1">
<div class="card-content white-text">
<span class="card-title"><h4>My Entities</h4></span>
<div class="row">
<div class="col s8"><i class="large material-icons">business</i></div>
<div class="col s4"><h2>{{entityCount}}</h2></div>
</div>
</div>
<div class="card-action">
<a href="#">This is a link</a>
<a href="#">This is a link</a>
</div>
</div>
</div>
</div>
<h4>My Children</h4>
<h4>My Messages</h4>
<h4>My Approved Persons</h4>
<h4>My Denied Persons</h4>
<h4>My Approved Vehicles</h4>
<h4>My Denied Vehicles</h4>
<h4>My Parents</h4>
</template>

View file

@ -0,0 +1,19 @@
import { ServiceEntities } from "../../imports/api/serviceentities";
Template.dashboard.onCreated(function() {
this.subscribe("ServiceEntities");
});
Template.dashboard.onRendered(function() {
});
Template.dashboard.helpers({
entityCount: function() {
return ServiceEntities.find().count();
},
});
Template.dashboard.events({
});

View file

@ -0,0 +1,28 @@
<template name="home">
<div class="container">
<h1>Welcome to Parent Pickup</h1>
<h3>Goals</h3>
<ul class="collapsible">
<li>
<div class="collapsible-header"><h5><i class="material-icons">child_care</i>Child Safety</h5></div>
<div class="collapsible-body"><span>The safety of our children.</span></div>
</li>
<li>
<div class="collapsible-header"><h5><i class="material-icons">people_outline</i>Identify Safe Pickup People</h5></div>
<div class="collapsible-body"><span>Identify safe persons allowed to pick up your child(ren) from school.</span></div>
</li>
<li>
<div class="collapsible-header"><h5><i class="material-icons">person_outline</i>Identify Safe Visitors</h5></div>
<div class="collapsible-body"><span>Idntify safe persons allowed to visit / interact with your child(ren) at school functions / events.</span></div>
</li>
<li>
<div class="collapsible-header"><h5><i class="material-icons">directions_car</i>Identify Safe Vehicles</h5></div>
<div class="collapsible-body"><span>Identify safe vehicles used to pick up your child(ren) from school.</span></div>
</li>
<li>
<div class="collapsible-header"><h5><i class="material-icons">mood_bad</i>Identify Potential Threats</h5></div>
<div class="collapsible-body"><span>No one likes to talk about threats to our children's safety, but identification of a potential threat can help law enforcement, Staff, and Parents / Guardians remove a threat more effectively.</span></div>
</li>
</ul>
</div>
</template>

View file

@ -0,0 +1,15 @@
Template.home.onCreated(function() {
});
Template.home.onRendered(function() {
$('.collapsible').collapsible();
});
Template.home.helpers({
});
Template.home.events({
});

View file

@ -0,0 +1,4 @@
<template name="messageView">
<h2>Messages</h2>
<p>This is where messages will go once it's built out.</p>
</template>

View file

@ -0,0 +1,17 @@
Template.messageView.onCreated(function() {
});
Template.messageView.onRendered(function() {
});
Template.messageView.helpers({
});
Template.messageView.events({
});

View file

@ -0,0 +1,8 @@
.padMe {
margin-left: 5px;
margin-right: 5px;
}
i.icon-red {
color: red;
}

View file

@ -0,0 +1,57 @@
<template name="headerBar">
<ul id="dropLogin" class="dropdown-content">
<li><a href="#!" id="adminmainlogin" class="navBtn">Admin</a></li>
<li><a href="#!" id="teachlogin" class="navBtn">Teacher</a></li>
<li><a href="#!" id="parguarlogin" class="navBtn">Parent / Guardian</a></li>
<li><a href="#!" id="monlogin" class="navBtn">Monitor</a></li>
</ul>
<nav>
<div class="nav-wrapper blue darken-4">
<a href="#" class="brand-logo" id="brandLogo">Parent Pickup</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">
{{#if currentUser}}
<!-- System Admins -->
{{#if isInRole "systemadmin"}}
<li><a href="#" id="createServiceEntity" class="navBtn">Create New Service Entity</a></li>
{{/if}}
<!-- For Parents / Guardians -->
{{#if isInRole "parent"}}
<li><a href="#">Add Trusted People</a></li>
<li><a href="#">Add Trusted Vehicles</a></li>
<li><a href="#">Add Cautions</a></li>
{{/if}}
<li class="signOut"><a href="#" class="signOut">Log Out</a></li>
{{else}}
<li><a class="dropdown-trigger" href="#!" data-target="dropLogin">Login Options<i class="material-icons right">arrow_drop_down</i></a></li>
{{/if}}
</ul>
</div>
</nav>
<ul class="sidenav" id="mobile-demo">
{{#if currentUser}}
<!-- System Admins -->
{{#if isInRole "systemadmin"}}
<li><a href="#" id="createServiceEntity" class="navBtn">Create New Service Entity</a></li>
{{/if}}
<!-- For Parents / Guardians -->
{{#if isInRole "parent"}}
<li><a href="#">Add Trusted People</a></li>
<li><a href="#">Add Trusted Vehicles</a></li>
<li><a href="#">Add Cautions</a></li>
{{/if}}
<li class="signOut"><a href="#" class="signOut">Log Out</a></li>
{{else}}
<li><a href="#!" id="adminmainlogin" class="navBtn">Admin</a></li>
<li><a href="#!" id="teachlogin" class="navBtn">Teacher</a></li>
<li><a href="#!" id="parguarlogin" class="navBtn">Parent / Guardian</a></li>
<li><a href="#!" id="monlogin" class="navBtn">Monitor</a></li>
{{/if}}
</ul>
</template>

View file

@ -0,0 +1,41 @@
Template.headerBar.onCreated(function() {
});
Template.headerBar.onRendered(function() {
$('.sidenav').sidenav();
setTimeout(function() {
$('.sidenav').sidenav();
$(".dropdown-trigger").dropdown();
}, 100)
$(".dropdown-trigger").dropdown();
});
Template.headerBar.helpers({
adminReg: function() {
return Session.get("adminreg");
},
});
Template.headerBar.events({
'click .navBtn' (event) {
event.preventDefault();
var clickedTarget = event.target.id;
console.log("clicked " + clickedTarget);
if (clickedTarget == 'mainMenu') {
FlowRouter.go('/');
} else {
console.log("should be going to /" + clickedTarget);
FlowRouter.go('/' + clickedTarget);
}
},
'click .signOut': () => {
FlowRouter.go('/');
Meteor.logout();
},
'click #brandLogo' (event) {
event.preventDefault();
FlowRouter.go('/dashboard');
},
});

View file

@ -0,0 +1,65 @@
/* The Modal (background) */
.mymodal {
display: none; /* Hidden by default */
position: fixed; /* Stay in place */
z-index: 10; /* Sit on top */
padding-top: 100px; /* Location of the box */
left: 0;
top: 0;
width: 100%; /* Full width */
height: 100vh; /* Full height */
overflow: auto; /* Enable scroll if needed */
background-color: rgb(0,0,0); /* Fallback color */
background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
}
/* Modal Content */
.mymodal-content {
position: relative;
background-color: #fefefe;
margin: auto;
padding: 0;
border: 1px solid #888;
width: 80%;
box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2),0 6px 20px 0 rgba(0,0,0,0.19);
-webkit-animation-name: animatetop;
-webkit-animation-duration: 0.4s;
animation-name: animatetop;
animation-duration: 0.4s
}
/* Add Animation */
@-webkit-keyframes animatetop {
from {top:-300px; opacity:0}
to {top:0; opacity:1}
}
@keyframes animatetop {
from {top:-300px; opacity:0}
to {top:0; opacity:1}
}
/* The Close Button */
.close {
color: white;
float: right;
font-size: 28px;
font-weight: bold;
}
.close:hover,
.close:focus {
color: #000;
text-decoration: none;
cursor: pointer;
}
.mymodal-header, .mymodal-footer {
padding: 2px 16px;
background-color: #4169e1;
color: white;
}
.mymodal-body {
padding: 2px 16px;
}

View file

@ -0,0 +1,16 @@
<template name="myModal">
<div id="genModal" class="modal mymodal">
<div class="mymodal-content">
<div class="mymodal-header">
<h4>{{modalHeader}}</h4>
</div>
<div class="mymodal-body">
<p class="flow-text">{{modalBody}}</p>
</div>
<div class="mymodal-footer">
<a href="#" id="cancel" class="modal-close waves-effect waves-orange btn-flat white-text">Cancel</a>
<a href="#" id="continue" class="waves-effect waves-green btn-flat white-text">Continue</a>
</div>
</div>
</div>
</template>

View file

@ -0,0 +1,41 @@
Template.myModal.onCreated(function() {
});
Template.myModal.onRendered(function() {
$('.modal').modal();
});
Template.myModal.helpers({
modalHeader: function() {
return Session.get("confirmationDialogTitle");
},
modalBody: function() {
return Session.get("confirmationDialogContent");
}
});
Template.myModal.events({
'click #continue' (event) {
event.preventDefault();
let callFunction = Session.get("eventConfirmCallBackFunction");
let functionPassId = Session.get("eventConfirmNecessaryId"); // <-- this can be an actual ID, an object, a function, whatever...
if (functionPassId == "disallowCom") {
$("#genModal").modal('close');
return;
} else {
$("#genModal").modal('close');
window[callFunction](functionPassId); // <-- calls the function and passed the Id on confirm.
}
},
'click #cancel' (event) {
event.preventDefault();
$("#genModal").modal('close');
},
});

View file

@ -0,0 +1,71 @@
#snackbar {
visibility: hidden;
min-width: 250px;
margin-left: -125px;
background-color: #93b7d6;
color: #fff;
text-align: center;
border-radius: 4px;
padding: 16px;
position: fixed;
z-index: 22;
left: 50%;
bottom: 30px;
font-size: 17px;
}
#snackbar.shadow {
min-width: 250px;
padding: 15px;
box-shadow: -5px 7px 8px #2f2f2f;
}
#snackbar.show {
visibility: visible;
-webkit-animation: fadein 0.5s, fadeout 0.5s 4.0s;
animation: fadein 0.5s, fadeout 0.5s 4.0s;
}
@-webkit-keyframes fadein {
from {
bottom: 0;
opacity: 0;
}
to {
bottom: 30px;
opacity: 1;
}
}
@keyframes fadein {
from {
bottom: 0;
opacity: 0;
}
to {
bottom: 30px;
opacity: 1;
}
}
@-webkit-keyframes fadeout {
from {
bottom: 30px;
opacity: 1;
}
to {
bottom: 0;
opacity: 0;
}
}
@keyframes fadeout {
from {
bottom: 30px;
opacity: 1;
}
to {
bottom: 0;
opacity: 0;
}
}

View file

@ -0,0 +1,3 @@
<template name="snackbar">
<div class="snackbar shadow" id="snackbar"></div>
</template>

View file

@ -0,0 +1,11 @@
// This is called to display a temporary message to the user at the bottom of the screen
showSnackbar = function(snackbarText, snackbarColor) {
var snackbarNotification = document.getElementById("snackbar");
snackbarNotification.innerHTML = snackbarText;
snackbarNotification.style.backgroundColor = snackbarColor;
snackbarNotification.className = "show";
setTimeout(function() {
snackbarNotification.className = snackbarNotification.className.replace("show", "");
}, 4000)
}

8
client/MainLayout.html Normal file
View file

@ -0,0 +1,8 @@
<template name="MainLayout">
{{> headerBar}}
{{#if currentUser}}
{{> Template.dynamic template=main}}
{{else}}
{{> Template.dynamic template=notLoggedIn}}
{{/if}}
</template>

9175
client/lib/assets/materialize.css vendored Normal file

File diff suppressed because it is too large Load diff

12791
client/lib/assets/materialize.js vendored Normal file

File diff suppressed because it is too large Load diff

5
client/main.css Normal file
View file

@ -0,0 +1,5 @@
body {
padding: 10px;
font-family: sans-serif;
background-color: #F9FBFC;
}

15
client/main.html Normal file
View file

@ -0,0 +1,15 @@
<head>
<title>Parent Pickup</title>
<link id="favicon" rel="shortcut icon" type="image/png" href="favicon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link href="./lib/assets/materialize.css" rel="stylesheet">
<script type="text/javascript" src="./lib/assets/materialize.js"></script>
</head>
<body>
</body>

4
client/main.js Normal file
View file

@ -0,0 +1,4 @@
import { Template } from 'meteor/templating';
import { ReactiveVar } from 'meteor/reactive-var';
import './main.html';