Get config panel working for nutups

This commit is contained in:
2025-01-20 18:06:41 +00:00
parent 51a59b9696
commit e717237726
3 changed files with 39 additions and 16 deletions

View File

@@ -1,7 +1,4 @@
//
//Generated by: SM2Gen version:0.9(20Jan2025) Chameleon version:4.5.4 On Python:3.12.3 at 2025-01-20 16:09:58
//
$(document).ready(function() {
$(document).ready(function() {
function toggleUPSClasses() {
var selectedOption = $('#Nutmode_select').val();
$('.masterups').toggle(selectedOption === 'netclient'); // Show/Hide masterups based on Net Client
@@ -12,9 +9,20 @@ $(document).ready(function() {
$('.slaveups input').prop('disabled', selectedOption !== 'netserver');
}
// Event listener for the select change
$('#Nutmode_select').change(toggleUPSClasses);
function toggleGenerics() {
var upsModelValue = $('#UPS_Model_select').val().toLowerCase(); // Get the current value from UPS_Model
var isGenericUps = upsModelValue === 'genericups'; // Check if it's 'genericups'
// Set the initial state
// Show/Hide generics section and enable/disable inputs
$('.generics').toggle(isGenericUps);
$('.generics input').prop('disabled', !isGenericUps); // Enable/Disable inputs based on the value
}
// Event listener for the selections
$('#Nutmode_select').change(toggleUPSClasses);
$('#UPS_Model_select').change(toggleGenerics); // Listen for changes in the UPS_Model dropdown
// Set the initial state based on current selections
toggleGenerics();
toggleUPSClasses();
});
});