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

@ -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);
}
});