<?php
// Copyright 1999-2026. WebPros International GmbH. All rights reserved.
?>
<script type="text/javascript">
//<![CDATA[
    new Jsw.Hint({
        renderTo: 'main',
        hint: <?php echo $this->jsLmsg('hint'); ?>
    });

    new Jsw.Panel({
        cls: 'list-box',
        renderTo: 'main',
        items: [
            new Jsw.List({
                id: 'admin-alias-list',
                searchFilters: <?php echo Zend_Json::encode($this->adminAliasesList->getSearchFilterConfig()); ?>,
                searchOveral: 'contact',
                data: <?php echo Zend_Json::encode($this->adminAliasesList->fetchData()); ?>,
                dataUrl: Jsw.prepareUrl('/admin-alias/list-data'),
                disabledSelectHint: <?php echo $this->adminAliasesList->jsLmsg('disabledSelectHint');?>,
                operations: [
                    {
                        componentType: 'Jsw.SmallButton',
                        id: 'buttonAddNewAdminAlias',
                        title: <?php echo $this->adminAliasesList->jsLmsg('buttonAddNewAdminAlias');?>,
                        description: <?php echo $this->adminAliasesList->jsLmsg('hintAddNewAdminAlias') ?>,
                        addCls: 'sb-add-new-customer btn-primary',
                        href: Jsw.prepareUrl('/admin-alias/create'),
                    }, {
                        componentType: 'Jsw.bar.Separator'
                    }, {
                        componentType: 'Jsw.SmallButton',
                        id: 'buttonRemoveAdminAlias',
                        title: <?php echo $this->adminAliasesList->jsLmsg('buttonRemoveAdminAlias') ?>,
                        description: <?php echo $this->adminAliasesList->jsLmsg('hintRemoveAdminAlias') ?>,
                        addCls: 'sb-remove-selected',
                        handler: function(event) {
                            Jsw.getComponent('admin-alias-list').execGroupOperation({
                                url: Jsw.prepareUrl('/admin-alias/delete/?redirect=/admin/admin-alias/list/'),
                                subtype: 'delete',
                                mouseEvent: event,
                                locale: {
                                    confirmOnGroupOperation: <?php echo $this->adminAliasesList->jsLmsg('confirmOnDelete'); ?>
                                },
                            });
                        },
                    }, {
                        componentType: 'Jsw.bar.Separator'
                    }, {
                        componentType: 'Jsw.list.AdditionalActions',
                        title: <?php echo $this->adminAliasesList->jsLmsg('buttonMoreActions'); ?>,
                        operations: [
                            {
                                componentType: 'Jsw.SmallButton',
                                id: 'buttonActivateAdminAlias',
                                title: <?php echo $this->adminAliasesList->jsLmsg('buttonActivateAdminAlias');?>,
                                description: <?php echo $this->adminAliasesList->jsLmsg('hintActivateAdminAlias'); ?>,
                                addCls: 'sb-activate',
                                cls: 'sb-btn',
                                handler: function () {
                                    Jsw.getComponent('admin-alias-list').execGroupOperation({
                                        url: Jsw.prepareUrl('/admin-alias/activate/?redirect=/admin/admin-alias/list/'),
                                        skipConfirmation: true,
                                    });
                                },
                            },
                            {
                                componentType: 'Jsw.SmallButton',
                                id: 'buttonInactiveAdminAlias',
                                title: <?php echo $this->adminAliasesList->jsLmsg('buttonDeactivateAdminAlias');?>,
                                description: <?php echo $this->adminAliasesList->jsLmsg('hintDeactivateAdminAlias'); ?>,
                                addCls: 'sb-suspend',
                                cls: 'sb-btn',
                                handler: function() {
                                    Jsw.getComponent('admin-alias-list').execGroupOperation({
                                        url: Jsw.prepareUrl('/admin-alias/deactivate/?redirect=/admin/admin-alias/list/'),
                                        skipConfirmation: true,
                                    });
                                },
                            },
                        ],
                    },
                ],
                columns: [
                    Jsw.list.COLUMN_SELECTION,
                    {
                        header: <?php echo $this->adminAliasesList->jsLmsg('contact');?>,
                        sortable: true,
                        dataIndex: 'contact',
                        renderer: function(item, isDisabled) {
                            var status = 'on';
                            var statusIcon = '<?php echo $this->skinUrl('/icons/16/plesk/on.png') ?>';
                            var statusDescription = <?php echo $this->adminAliasesList->jsLmsg('statusActive') ?>;
                            if (1 === item.status) {
                                status = 'off';
                                statusIcon = '<?php echo $this->skinUrl('/icons/16/plesk/off.png') ?>';
                                statusDescription = <?php echo $this->adminAliasesList->jsLmsg('statusInactive') ?>;
                            }

                            return (
                                '<div class="b-indent">' +
                                    '<span class="b-indent-icon">' +
                                        '<span class="tooltipData">' + Jsw.escapeHtml(statusDescription) + '</span>' +
                                        '<img src="' + statusIcon + '" alt="' + status + '" title="">' +
                                    '</span> ' +
                                    '<a href="' + Jsw.prepareUrl('/admin-alias/edit/id/' + item.id) + '">' +
                                        Jsw.escapeHtml(item.contact) +
                                    '</a>' +
                                '</div>'
                            );
                        }
                    }, {
                        header: <?php echo $this->adminAliasesList->jsLmsg('login');?>,
                        sortable: true,
                        dataIndex: 'login'
                    }, {
                        header: <?php echo $this->adminAliasesList->jsLmsg('email');?>,
                        sortable: true,
                        dataIndex: 'email'
                    }, {
                        header: <?php echo $this->adminAliasesList->jsLmsg('comments');?>,
                        sortable: true,
                        dataIndex: 'comments'
                    }
                ]
            })
        ]
    });
//]]>
</script>
