<?php
// Copyright 1999-2022. Plesk International GmbH. All rights reserved.
?>
{
    componentType: 'Jsw.bar.Button',
    title: <?php echo $this->jsLmsg('tabResources'); ?>,
    tabId: 'tab-resources',
    active: true,
    content: new Jsw.Container({
        items: [{
        <?php if(isset($this->overusePolicy)):?>
            componentType: 'Jsw.form.DisplayField',
            fieldLabel: <?php echo $this->jsLmsg('components.limits.overusePolicy'); ?>,
            value: <?php if (Limits_Policy_Overuse_Helper::SCHEME_NONE == $this->overusePolicy) {
                    echo $this->jsLmsg('components.limits.overuseSuspend');
                } elseif (Limits_Policy_Overuse_Helper::SCHEME_SOFT == $this->overusePolicy) {
                    echo $this->jsLmsg('components.limits.overuseBlock');
                } else {
                    echo $this->jsLmsg('components.limits.overuse');
                } ?>
            <?php if ($this->overusePolicyNotify): ?>
            + ' (' + <?php echo $this->jsLmsg('components.limits.overuseNotify'); ?> + ')'
            <?php endif; ?>
        }, {
        <?php endif;?>
        <?php if(isset($this->oversellPolicyHint)):?>
            componentType: 'Jsw.Hint',
            hint: <?php echo $this->jsEscape($this->oversellPolicyHint); ?>
        }, {
        <?php endif;?>
        <?php if(isset($this->oversellPolicy)):?>
            componentType: 'Jsw.form.DisplayField',
            fieldLabel: <?php echo $this->jsLmsg('components.limits.oversellPolicy'); ?>,
            componentType: 'Jsw.form.DisplayField',
            value: <?php echo $this->jsHtml($this->switchState($this->oversellPolicy)); ?>
                <?php if(isset($this->oversellPolicyEditLink)): ?>
                + ' <a href="' + Jsw.prepareUrl('<?php echo $this->oversellPolicyEditLink; ?>')
                + '">' + <?php echo $this->jsLmsg('changeOversellPolicyLink'); ?> + '</a>'
                <?php endif; ?>
        }, {
        <?php endif;?>
            componentType: 'Jsw.Panel',
            cls: 'form-box',
            title: '-'
        }, {
            componentType: '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): ?>
                        <?php echo $this->partial('partials/resource-component.phtml', array('limitName' => $limitName, 'limitDetails' => $limitDetails)); ?>,
                    <?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: <?php echo $this->additionalLimitsExpanded? 'false': 'true';?>,
                items: [
                    <?php foreach ($this->additionalResourceLimits as $limitName => $limitDetails): ?>
                        <?php echo $this->partial('partials/resource-component.phtml', array('limitName' => $limitName, 'limitDetails' => $limitDetails)); ?>,
                    <?php endforeach; ?>
                null]
            }]
        }]
    })
}
