<?php
// Copyright 1999-2022. Plesk International GmbH. All rights reserved.
?>
<?php echo $this->partial('partials/tabs.phtml', ['tabs' => $this->tabs, 'renderTo' => 'main', 'renderMode' => 'top']); ?>

<p><?php echo $this->trustedIpsList->lmsg('pageHint'); ?></p>

<script type="text/javascript">
    //<![CDATA[
        new Jsw.Panel({
            cls: 'list-box',
            renderTo: 'main',
            items: [
                new Jsw.List({
                    id: 'trusted-ips-list',
                    data: <?php echo Zend_Json::encode($this->trustedIpsList->fetchData()); ?>,
                    dataUrl: '/server-protection/trusted-list-data',
                    searchFilters: <?php echo Zend_Json::encode($this->trustedIpsList->getSearchFilterConfig()); ?>,
                    operations: [{
                        componentType: 'Jsw.SmallButton',
                        id: 'buttonAddTrustedIp',
                        title: <?php echo $this->trustedIpsList->jsLmsg('buttonAddTrustedIp') ?>,
                        description: <?php echo $this->trustedIpsList->jsLmsg('hintAddTrustedIp') ?>,
                        addCls: 'sb-item-add',
                        href: '/server-protection/add-trusted-ip'
                    }, {
                        componentType: 'Jsw.bar.Separator'
                    }, {
                        componentType: 'Jsw.SmallButton',
                        id: 'buttonRemoveIp',
                        title: <?php echo $this->trustedIpsList->jsLmsg('buttonRemoveIp') ?>,
                        description: <?php echo $this->trustedIpsList->jsLmsg('hintRemoveIp') ?>,
                        addCls: 'sb-remove-selected',
                        handler: function(event) {
                            Jsw.getComponent('trusted-ips-list').execGroupOperation({
                                url: '/server-protection/delete-trusted-ips',
                                subtype: 'delete',
                                skipConfirmation: true
                            });
                        }
                    }],
                    columns: [
                        Jsw.list.COLUMN_SELECTION,
                        {
                            header: <?php echo $this->trustedIpsList->jsLmsg('ip');?>,
                            sortable: true,
                            dataIndex: 'ip'
                        }
                    ]
                })
            ]
        });
    //]]>
</script>
