2023-06-11 12:30:08 -05:00
|
|
|
import { SysConfig } from '../../../imports/api/systemConfig.js';
|
2024-08-21 07:01:36 -05:00
|
|
|
import { M } from '../../lib/assets/materialize.js';
|
2023-06-11 12:30:08 -05:00
|
|
|
|
|
|
|
|
Template.systemAdmin.onCreated(function() {
|
|
|
|
|
this.subscribe("SystemConfig");
|
2024-08-21 07:01:36 -05:00
|
|
|
this.subscribe("rolesAvailable");
|
2023-06-11 12:30:08 -05:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Template.systemAdmin.onRendered(function() {
|
|
|
|
|
this.autorun(() => {
|
|
|
|
|
let curr = SysConfig.findOne({});
|
|
|
|
|
if (typeof curr != 'undefined') {
|
|
|
|
|
$("#allowGenReg").prop('checked', curr.allowReg);
|
|
|
|
|
$("#allAdmReg").prop('checked', curr.SysAdminReg);
|
2024-08-21 07:01:36 -05:00
|
|
|
$("#recvUpdateMsgs").prop('checked', curr.allowUpdates);
|
2023-06-11 12:30:08 -05:00
|
|
|
} else {
|
|
|
|
|
console.log(" ---- unable to find current system configuration.");
|
|
|
|
|
}
|
|
|
|
|
});
|
2024-08-21 07:01:36 -05:00
|
|
|
|
|
|
|
|
var elems = document.querySelectorAll('select');
|
|
|
|
|
|
|
|
|
|
setTimeout(function() {
|
|
|
|
|
var instances = M.FormSelect.init(elems, {});
|
|
|
|
|
}, 300);
|
|
|
|
|
|
2023-06-11 12:30:08 -05:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Template.systemAdmin.helpers({
|
|
|
|
|
currConfigs: function() {
|
|
|
|
|
|
2024-08-21 07:01:36 -05:00
|
|
|
},
|
2023-06-11 12:30:08 -05:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
Meteor.call("add.noSysAdminReg", admReg, genReg, function(err, result) {
|
|
|
|
|
if (err) {
|
2024-08-21 07:01:36 -05:00
|
|
|
// console.log(" ERROR updating permission to allow general registration: " + err);
|
|
|
|
|
// showSnackbar("Registration Permission Change Failed.", "red");
|
2023-06-11 12:30:08 -05:00
|
|
|
} else {
|
2024-08-21 07:01:36 -05:00
|
|
|
// console.log(" Successfully updated permission to allow general registration.");
|
2023-06-11 12:30:08 -05:00
|
|
|
showSnackbar("Registration Permission Successfully Changed.", "green")
|
|
|
|
|
}
|
|
|
|
|
});
|
2024-08-21 07:01:36 -05:00
|
|
|
},
|
|
|
|
|
'change #recvUpdateMsgs' (event) {
|
|
|
|
|
let updSet = $("#recvUpdateMsgs").prop('checked');
|
|
|
|
|
Meteor.call('allow.updateInfo', updSet, function(err, result) {
|
|
|
|
|
if (err) {
|
|
|
|
|
console.log(" ERROR changing update setting: " + err);
|
|
|
|
|
} else {
|
|
|
|
|
showSnackbar("Update Setting Changed Successfully!", "green");
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
});
|