@@ -1365,6 +1365,76 @@ const SettingsForms = {
13651365 } ) ;
13661366 }
13671367
1368+ // Set up Apprise notifications toggle functionality
1369+ const enableNotificationsCheckbox = container . querySelector ( '#enable_notifications' ) ;
1370+ if ( enableNotificationsCheckbox ) {
1371+ // Function to toggle notification settings visibility
1372+ const toggleNotificationSettings = function ( enabled ) {
1373+ const settingsToToggle = [
1374+ 'notification_level' ,
1375+ 'apprise_urls' ,
1376+ 'testNotificationBtn' ,
1377+ 'notify_on_missing' ,
1378+ 'notify_on_upgrade' ,
1379+ 'notification_include_instance' ,
1380+ 'notification_include_app'
1381+ ] ;
1382+
1383+ // Find parent setting-item containers for each setting
1384+ settingsToToggle . forEach ( settingId => {
1385+ const element = container . querySelector ( `#${ settingId } ` ) ;
1386+ if ( element ) {
1387+ // Find the parent setting-item div
1388+ const settingItem = element . closest ( '.setting-item' ) ;
1389+ if ( settingItem ) {
1390+ if ( enabled ) {
1391+ settingItem . style . opacity = '1' ;
1392+ settingItem . style . pointerEvents = '' ;
1393+ // Re-enable form elements
1394+ const inputs = settingItem . querySelectorAll ( 'input, select, textarea, button' ) ;
1395+ inputs . forEach ( input => {
1396+ input . disabled = false ;
1397+ input . style . cursor = '' ;
1398+ } ) ;
1399+ } else {
1400+ settingItem . style . opacity = '0.4' ;
1401+ settingItem . style . pointerEvents = 'none' ;
1402+ // Disable form elements
1403+ const inputs = settingItem . querySelectorAll ( 'input, select, textarea, button' ) ;
1404+ inputs . forEach ( input => {
1405+ input . disabled = true ;
1406+ input . style . cursor = 'not-allowed' ;
1407+ } ) ;
1408+ }
1409+ }
1410+ }
1411+ } ) ;
1412+
1413+ // Special handling for test notification button and its container
1414+ const testBtn = container . querySelector ( '#testNotificationBtn' ) ;
1415+ if ( testBtn ) {
1416+ testBtn . disabled = ! enabled ;
1417+ testBtn . style . opacity = enabled ? '1' : '0.4' ;
1418+ testBtn . style . cursor = enabled ? 'pointer' : 'not-allowed' ;
1419+
1420+ // Also handle the button container div
1421+ const buttonContainer = testBtn . closest ( 'div' ) ;
1422+ if ( buttonContainer ) {
1423+ buttonContainer . style . opacity = enabled ? '1' : '0.4' ;
1424+ buttonContainer . style . pointerEvents = enabled ? '' : 'none' ;
1425+ }
1426+ }
1427+ } ;
1428+
1429+ // Set initial state
1430+ toggleNotificationSettings ( enableNotificationsCheckbox . checked ) ;
1431+
1432+ // Add change event listener
1433+ enableNotificationsCheckbox . addEventListener ( 'change' , function ( ) {
1434+ toggleNotificationSettings ( this . checked ) ;
1435+ } ) ;
1436+ }
1437+
13681438 // Update duration display - e.g., convert seconds to hours
13691439 SettingsForms . updateDurationDisplay ( ) ;
13701440
0 commit comments