<?php
// Copyright 1999-2025. WebPros International GmbH. All rights reserved.
?>
{
    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 $name => $permission): ?>
                    <?php if ($permission->getId() == 'manage_not_chroot_shell'):?>
                    {
                        componentType: 'Jsw.form.DisplayField',
                        fieldLabel: <?php echo $this->jsLmsg('admin.components.forms.service-plan.permissions.systemAccessLabel'); ?>,
                        value: <?php
                        if ($permission->getValue()) {
                            $currentValue = $this->jsEscape($permission->getName());
                        } else if (isset($this->mainPermissions['manage_sh_access']) && $this->mainPermissions['manage_sh_access']->getValue()) {
                            $currentValue = $this->jsEscape($this->mainPermissions['manage_sh_access']->getName());
                        } else {
                            $currentValue = $this->jsLmsg('admin.components.forms.service-plan.permissions.noShellManagement');
                        }
                        echo $currentValue;
                        ?>
                    },
                    <?php elseif ($name == 'manage_sh_access' && isset($this->mainPermissions['manage_not_chroot_shell'])):?>
                    <?php else:?>
                    {
                        componentType: 'Jsw.form.DisplayField',
                        fieldLabel: <?php echo $this->jsEscape($permission->getName()); ?>,
                        value: <?php echo $this->jsHtml($this->switchState($permission->getValue())); ?>
                    },
                    <?php endif?>
                <?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 $name => $permission): ?>
                {
                    componentType: 'Jsw.form.DisplayField',
                    fieldLabel: <?php echo $this->jsEscape($permission->getName()); ?>,
                    value: <?php echo $this->jsHtml($this->switchState($permission->getValue())); ?>
                },
                <?php endforeach; ?>
            null]
        }]
    })
}