document.addEventListener('turbo:load', loadAppConfigurationData)

function loadAppConfigurationData () {
    if ($('input[name=\'required_floating_action_button\']:checked').val() == 0) {
        $('#floatingLogo, #floatingStyle').addClass('d-none')
    }
    
    if ($('input[name=\'required_walkthrough\']:checked').val() == 0) {
        $('#walkthroughStyle').addClass('d-none')
    }
    
    if ($('#navStyle option:selected').val() == 2 || $('#navStyle option:selected').val() == 5) {
        $('#bottomNavStyle').removeClass('d-none')
    } 
    
    if ($('#navStyle option:selected').val() == 4) {
        $('#tabStyle').removeClass('d-none')
    }
}

listenChange('#navStyle', function () {
    if ($('#navStyle option:selected').val() == 2 || $('#navStyle option:selected').val() == 5) {
        $('#bottomNavStyle').removeClass('d-none')
    }else {
        $('#bottomNavStyle').addClass('d-none')
    }

    if ($('#navStyle option:selected').val() == 4) {
        $('#tabStyle').removeClass('d-none')
    }else {
        $('#tabStyle').addClass('d-none')
    }
})
listenClick('#requiredWalkThroughButtonYes', function () {
    $('#walkthroughStyle').removeClass('d-none')
})
listenClick('#requiredWalkThroughButtonNo', function () {
    $('#walkthroughStyle').addClass('d-none')
})
listenClick('#requiredFloatingButtonYes', function () {
    $('#floatingLogo, #floatingStyle').removeClass('d-none')
})
listenClick('#requiredFloatingButtonNo', function () {
    $('#floatingLogo, #floatingStyle').addClass('d-none')
})
