Skip to content

Commit

Permalink
Merge pull request #1684 from RaspAP/fix/fallback-static-enabled
Browse files Browse the repository at this point in the history
Add event listener to chkfallback, enable/disable static IP fields
  • Loading branch information
billz authored Oct 28, 2024
2 parents bf22668 + 54a9035 commit 9e52cda
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions app/js/custom.js
Original file line number Diff line number Diff line change
Expand Up @@ -242,16 +242,13 @@ function loadInterfaceDHCPSelect() {
$('#txtmetric').val(jsonData.Metric);

if (jsonData.StaticIP !== null && jsonData.StaticIP !== '' && !jsonData.FallbackEnabled) {
$('#chkstatic').closest('.btn').button('toggle');
$('#chkstatic').closest('.btn').button('toggle').blur();
$('#chkstatic').blur();
$('#chkstatic').prop('checked', true).closest('.btn').addClass('active');
$('#chkdhcp').prop('checked', false).closest('.btn').removeClass('active');
$('#chkfallback').prop('disabled', true);
$('#dhcp-iface').removeAttr('disabled');
} else {
$('#chkdhcp').closest('.btn').button('toggle');
$('#chkdhcp').closest('.btn').button('toggle').blur();
$('#chkdhcp').blur();
$('#chkfallback').prop('disabled', false);
$('#chkdhcp').closest('.btn').addClass('active');
$('#chkdhcp').closest('.btn').button.blur();
}
if (jsonData.FallbackEnabled || $('#chkdhcp').is(':checked')) {
$('#dhcp-iface').prop('disabled', true);
Expand All @@ -272,6 +269,14 @@ function setDHCPToggles(state) {
$('#dhcp-iface').prop('disabled', !state);
}

$('#chkfallback').change(function() {
if ($('#chkfallback').is(':checked')) {
setStaticFieldsEnabled();
} else {
setStaticFieldsDisabled();
}
});

$('#debugModal').on('shown.bs.modal', function (e) {
var csrfToken = $('meta[name=csrf_token]').attr('content');
$.post('ajax/system/sys_debug.php',{'csrf_token': csrfToken},function(data){
Expand Down

0 comments on commit 9e52cda

Please sign in to comment.