get_my/client/AdminMgmt/SystemAdmin/systemAdmin.js
Brian McGonagill c70f9bd74e Multiple updates and additions
- Added a permission to show or hide update version information on that dashboard as a card that will only show when new update info is available and not yet dismissed.
- Updated Lists so list items added will have their fist letter auto-capitalized
- Updated Lists so list items are searched against the products before being added to the list, so we have store info more commonly in lists
- Updated Products so new products will have their first letter capitalized automatically
- Updated the dashboard to show the Update Available card if this is enbaled in permissions.
    - The dashboard card only shows for System Admin roles.
    - The dashboard card is enabled by default
    - The dashboard card is pulled from the GitLab releases RSS feed.
    - The RSS Feed is only checked every 30 minutes using node-cron
- Updated System Configuration to have a toggle for the update available card
- Added a bell icon to the top and slide out navigation, shown when a new update is available, if update available is enabled in system configuration.
2024-08-21 07:01:36 -05:00

60 lines
2.1 KiB
JavaScript

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