mirror of
https://gitlab.com/bmcgonag/get_my.git
synced 2026-03-27 00:08:49 +00:00
initial commit
This commit is contained in:
parent
b7c7d8b449
commit
750811a81f
52 changed files with 25204 additions and 92 deletions
73
client/CreateServiceentity/createServiceEntity.js
Normal file
73
client/CreateServiceentity/createServiceEntity.js
Normal 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);
|
||||
|
||||
}
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue