Initial commit

This commit is contained in:
Brian McGonagill 2025-12-06 15:44:43 -06:00
commit 35745a89ec
44 changed files with 3342 additions and 0 deletions

View file

@ -0,0 +1,37 @@
<template name="systemAdmin">
<h2>System Administration</h2>
<div class="grid">
<article>
<h4>Registration Settings</h4>
<div class="grid">
<div class="">
<label for="allowAdmReg">
<input type="checkbox" class="currConfigs" id="allowAdmReg" role="switch">
Allow Admin Registration
</label>
</div>
</div>
<div class="grid">
<div>
<label for="allowGenReg">
<input type="checkbox" class="currConfigs" id="allowGenReg" role="switch">
Allow Registration
</label>
</div>
</div>
</article>
<article>
<h4>Update Notifications</h4>
<p>This option requires the seerver to have an internet connection.</p>
<div class="grid">
<div>
<label for="recvUpdateMsgs">
<input type="checkbox" class="currConfigs" id="recvUpdateMsgs" role="switch">
System Admin will receive information on updates and new featres
</label>
</div>
</div>
</article>
</div>
{{> snackbar}}
</template>

View file

@ -0,0 +1,62 @@
import { SysConfig } from "../../../imports/api/systemConfig";
Template.systemAdmin.onCreated(function() {
this.subscribe("SystemConfig");
this.subscribe("rolesAvailable");
});
Template.systemAdmin.onRendered(function() {
this.autorun (() => {
const curr = SysConfig.findOne({});
if (curr) {
$("#allowGenReg").prop('checked', curr.allowReg);
$("#allowAdmReg").prop('checked', curr.SysAdminReg);
$("#recvUpdateMsgs").prop('checked', curr.allowUpdates);
} else {
console.log(" ---- unable to find current system configuration.");
}
});
});
Template.systemAdmin.helpers({
currConfigs: function() {
},
});
Template.systemAdmin.events({
'change #allowGenReg, change #allowAdmReg' (evnnt) {
let genReg = $("#allowGenReg").prop('checked');
let admReg = $("#allowAdmReg").prop('checked');
console.log("General Reg set to: " + genReg);
const setNoSysAdminReg = async() => {
try {
const result = await Meteor.callAsync("add.noSysAdminReg", admReg, genReg);
if (result) {
console.log("Successfully added reg settings.");
showSnackbar("Updated Registration Settings.", "green");
}
} catch(error) {
console.log(" ERROR setting registration: " + error);
}
}
setNoSysAdminReg();
},
'change #recvUpdateMsgs' (event) {
let updSet = $("#recvUpdateMsgs").prop('checked');
const updateInfo = async() => {
try {
const result = Meteor.callAsync('allow.updateInfo', updSet);
showSnackbar("Update Setting Changed Successfully!", "green");
} catch(error) {
console.log(" ERROR changing update setting: " + err);
}
}
updateInfo();
},
});