<?php
// Copyright 1999-2015. Parallels IP Holdings GmbH. All Rights Reserved.
?>
<ul class="data-list">
    <li class="data-list-item" id="toCustomerApplyButtonItem"></li>
    <li class="data-list-item" id="toSubscriptionWithUsersApplyButtonItem"></li>
    <li class="data-list-item" id="toSubscriptionWithoutUsersApplyButtonItem"></li>
</ul>

<script type="text/javascript">
    //<![CDATA[
    Jsw.onReady(function() {
        function legacyResourcesToolsAction(params) {
            Jsw.messageBox.show({
                'type': Jsw.messageBox.TYPE_YESNO,
                'subtype': 'toggle',
                'text': params.title,
                'description': params.description,
                'onYesClick': function() {
                    Jsw.redirectPost(params.url, {
                        redirect: '/admin/subscription/overview/id/<?php echo $this->id; ?>',
                        ids: [<?php echo $this->id; ?>]
                    });
                },
                'needAttention': true,
                'needAttentionText': params.attention,
                'needAttentionBlockSubmit': true,
                'buttonTitles': {
                    'yes': <?php echo $this->jsLmsg('components.buttons.yes') ?>,
                    'no': <?php echo $this->jsLmsg('components.buttons.no') ?>
                }
            });
        }

        new Jsw.SmallButton({
            renderTo: 'toCustomerApplyButtonItem',
            id: 'toCustomerApplyButton',
            title: <?php echo $this->jsLmsg('toCustomerApplyButton');?>,
            description: <?php echo $this->jsLmsg('toCustomerApplyHint') ?>,
            addCls: 'sb-business-model-upgrade-solution sb-business-model-upgrade-solution-subscription-to-customer',
            handler: function(){
                legacyResourcesToolsAction({
                    url: '/admin/business-model-upgrade/manual-subscription-solution/solution/toCustomer/',
                    title: <?php echo $this->jsLmsg('applyConfirmation'); ?>,
                    attention: <?php echo $this->jsLmsg('admin.components.lists.businessmodelupgrade.subscriptions.toCustomerApplyHint'); ?>
                });
            }
        });

        new Jsw.SmallButton({
            renderTo: 'toSubscriptionWithUsersApplyButtonItem',
            id: 'toSubscriptionWithUsersApplyButton',
            title: <?php echo $this->jsLmsg('toSubscriptionWithUsersApplyButton');?>,
            description: <?php echo $this->jsLmsg('toSubscriptionWithUsersApplyHint') ?>,
            addCls: 'sb-business-model-upgrade-solution sb-business-model-upgrade-solution-subscription-to-subscription-with-users',
            handler: function(){
                legacyResourcesToolsAction({
                    url: '/admin/business-model-upgrade/manual-subscription-solution/solution/toSubscriptionWithUsers/',
                    title: <?php echo $this->jsLmsg('applyConfirmation'); ?>,
                    attention: <?php echo $this->jsLmsg('admin.components.lists.businessmodelupgrade.subscriptions.toSubscriptionWithUsersApplyHint'); ?>
                });
            }
        });

        new Jsw.SmallButton({
            renderTo: 'toSubscriptionWithoutUsersApplyButtonItem',
            id: 'toSubscriptionWithoutUsersApplyButton',
            title: <?php echo $this->jsLmsg('toSubscriptionWithoutUsersApplyButton');?>,
            description: <?php echo $this->jsLmsg('toSubscriptionWithoutUsersApplyHint') ?>,
            addCls: 'sb-business-model-upgrade-solution sb-business-model-upgrade-solution-subscription-to-subscription-without-users',
            handler: function(){
                legacyResourcesToolsAction({
                    url: '/admin/business-model-upgrade/manual-subscription-solution/solution/toSubscriptionWithoutUsers/',
                    title: <?php echo $this->jsLmsg('applyConfirmation'); ?>,
                    attention: <?php echo $this->jsLmsg('admin.components.lists.businessmodelupgrade.subscriptions.toSubscriptionWithoutUsersApplyHint'); ?>
                });
            }
        });
    });
    //]]>
</script>
