<?php
// Copyright 1999-2026. WebPros International GmbH. All rights reserved.
?>
<script type="text/javascript">
//<![CDATA[

Jsw.namespace('Admin.Views.Subscription');
<?php
echo $this->partial('partials/subscription/change-presubmit-handler.phtml', [
    'formId' => 'subscriptionInfo',
    'notConfiguredMailPlans' => $this->notConfiguredMailPlans,
]);
?>

Jsw.onReady(function () {
    var updateControlsState = function () {
        var addonPlanSelector = document.getElementById('subscriptionInfo-addonPlanSelector');
        if ('0' === document.getElementById('subscriptionInfo-servicePlan').value) {
            if (addonPlanSelector) {
                addonPlanSelector.closest('.form-row').style.display = 'none';
            }
            document.getElementById('subscriptionInfo-customize').checked = true;
        } else {
            if (addonPlanSelector) {
                addonPlanSelector.closest('.form-row').style.display = '';
            }
            document.getElementById('subscriptionInfo-customize').checked = false;
        }
    }

    if (document.getElementById('subscriptionInfo-servicePlan')) {
        updateControlsState();
        document.getElementById('subscriptionInfo-servicePlan').addEventListener('change', updateControlsState);
    }
});
//]]>
</script>
