<?php
// Copyright 1999-2022. Plesk International GmbH. All rights reserved.
?>
<script type="text/javascript">
//<![CDATA[
Jsw.onReady(function() {

    new Jsw.Hint({
        renderTo: 'main',
        hint: <?php echo $this->jsLmsg('subscriptionHint'); ?>
    });

    new Jsw.bar.Tabs({
        renderTo: 'main',
        type: 'dynamic',
        cls: 'tabs',
        items: [{
            componentType: 'Jsw.bar.Button',
            title: <?php echo $this->jsLmsg('tabResources'); ?>,
            tabId: 'tab-resources',
            active: true,
            content: new Jsw.layout.TwoColumns({
                items: [{
                    componentType: 'Jsw.Panel',
                    cls: 'form-box form-box-50x50',
                    items: [{
                        componentType: 'Jsw.Hint',
                        hint: <?php echo $this->jsLmsg('resourcesSummaryHint'); ?>
                    },
                        <?php foreach ($this->mainResourceLimits as $limitName => $limitDetails): ?>
                            {
                                componentType: 'Jsw.form.DisplayField',
                                fieldLabel: <?php echo $this->jsEscape($limitDetails['title']); ?>,
                                value: <?php echo $this->jsEscape($limitDetails['limitString']); ?>
                            },
                        <?php endforeach; ?>
                    null]
                }, {
                    componentType: 'Jsw.Panel',
                    id: 'panelMoreResources',
                    cls: 'form-box form-box-50x50 b-collapsible',
                    title: <?php echo $this->jsLmsg('showMoreResources'); ?>,
                    hideContentTitle: <?php echo $this->jsLmsg('hideMoreResources'); ?>,
                    collapsed: true,
                    items: [
                        <?php foreach ($this->additionalResourceLimits as $limitName => $limitDetails): ?>
                        {
                            componentType: 'Jsw.form.DisplayField',
                            fieldLabel: <?php echo $this->jsEscape($limitDetails['title']); ?>,
                            value: <?php echo $this->jsEscape($limitDetails['limitString']); ?>
                        },
                        <?php endforeach; ?>
                    null]
                }]
            })
        }, {
            componentType: 'Jsw.bar.Button',
            title: <?php echo $this->jsLmsg('tabPermissions'); ?>,
            tabId: 'tab-permissions',
            content: new Jsw.layout.TwoColumns({
                items: [{
                    componentType: 'Jsw.Panel',
                    cls: 'form-box form-box-50x50',
                    items: [{
                        componentType: 'Jsw.Hint',
                        hint: <?php echo $this->jsLmsg('permissionsSummaryHint'); ?>
                    },
                        <?php foreach ($this->mainPermissions as $permission): ?>
                            {
                                componentType: 'Jsw.form.DisplayField',
                                fieldLabel: <?php echo $this->jsEscape($permission->getName()); ?>,
                                value: <?php echo $this->jsHtml($this->switchState($permission->getValue())); ?>
                            },
                        <?php endforeach; ?>
                    null]
                }, {
                    componentType: 'Jsw.Panel',
                    id: 'panelMorePermissions',
                    cls: 'form-box form-box-50x50 b-collapsible',
                    title: <?php echo $this->jsLmsg('showMorePermissions'); ?>,
                    hideContentTitle: <?php echo $this->jsLmsg('hideMorePermissions'); ?>,
                    collapsed: true,
                    items: [
                        <?php foreach ($this->additionalPermissions as $permission): ?>
                        {
                            componentType: 'Jsw.form.DisplayField',
                            fieldLabel: <?php echo $this->jsEscape($permission->getName()); ?>,
                            value: <?php echo $this->jsHtml($this->switchState($permission->getValue())); ?>
                        },
                        <?php endforeach; ?>
                    null]
                }]
            })
        }]
    });

});
//]]>
</script>
