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

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

<script type="text/javascript">
    //<![CDATA[
        new Jsw.Panel({
            cls: 'list-box',
            renderTo: 'main',
            items: [
                new Jsw.List({
                    id: 'filters-list',
                    data: <?php echo Zend_Json::encode($this->filtersList->fetchData()); ?>,
                    dataUrl: '/server-protection/filters-list-data',
                    searchFilters: <?php echo Zend_Json::encode($this->filtersList->getSearchFilterConfig()); ?>,
                    operations: [{
                        componentType: 'Jsw.SmallButton',
                        id: 'buttonAddFilter',
                        title: <?php echo $this->filtersList->jsLmsg('buttonAddFilter') ?>,
                        description: <?php echo $this->filtersList->jsLmsg('hintAddFilter') ?>,
                        addCls: 'sb-add-new btn-primary',
                        href: '/server-protection/add-filter'
                    }, {
                        componentType: 'Jsw.bar.Separator'
                    }, {
                        componentType: 'Jsw.SmallButton',
                        id: 'buttonRemoveFilter',
                        title: <?php echo $this->filtersList->jsLmsg('buttonRemoveFilter') ?>,
                        description: <?php echo $this->filtersList->jsLmsg('hintRemoveFilter') ?>,
                        addCls: 'sb-remove-selected',
                        handler: function (event) {
                            Jsw.getComponent('filters-list').execGroupOperation({
                                url: '/server-protection/delete-filters',
                                subtype: 'delete',
                                skipConfirmation: true
                            });
                        }
                    }],
                    columns: [
                        Jsw.list.COLUMN_SELECTION,
                        {
                            header: <?php echo $this->filtersList->jsLmsg('name');?>,
                            sortable: true,
                            dataIndex: 'name',
                            renderer: function (item) {
                                var url = Jsw.prepareUrl('/server-protection/edit-filter/id/' + encodeURIComponent(item.id));
                                return '<a href="' + url + '">' + Jsw.escapeHtml(item.name) + '</a>';
                            }
                        }
                    ]
                })
            ]
        });
    //]]>
</script>
