<?php
/**
 * @author 1902 Software
 * @copyright Copyright © 2023 1902 Software (https://1902software.com/magento/)
 * @package WriteTextAI_WriteTextAI
 */
?>
<div class="wtai-slug-notice" data-bind="scope: 'wtaiSlugNotice'">
    <div class="messages wtai-no-display" data-bind="css: { 'wtai-no-display': !showNotice() }">
        <div class="message">
            <div class="wtai-slug-notice-content">
                <div>
                    <p data-bind="visible: productNotice() || categoryNotice()">
                        <?= $block->escapeHtml(__('Click the following links to view products'
                            . ' or categories that are ranking for the same keyword:')) ?>
                    </p>
                    <p data-bind="visible: productNotice() || categoryNotice()">
                        <span data-bind="html: productNotice"></span>
                        <br data-bind="visible: productNotice()">
                        <span data-bind="html: categoryNotice"></span>
                    </p>
                    <br data-bind="visible: (productNotice() || categoryNotice()) && urls().length > 0">
                    <p data-bind="visible: (productNotice() || categoryNotice()) && urls().length > 0">
                        <?= /* @noEscape */ __('Meanwhile, the following URLs '
                            . '<strong>have not been identified as product or category pages</strong>.'
                            . ' Please review them manually:') ?>
                    </p>
                </div>
                <p data-bind="visible: !productNotice() && !categoryNotice() && urls().length > 0">
                    <?= $block->escapeHtml(__('The following URLs have not been identified as'
                        . ' product or category pages. Please review them manually:')) ?>
                </p>
                <ul data-bind="foreach: urls">
                    <li>
                        <a data-bind="
                            text: $parent.getUrl($data),
                            attr: {
                                href: $parent.getUrl($data),
                                target: '_blank'
                            }
                        "></a>
                    </li>
                </ul>
            </div>
            <span class="action-close" data-bind="click: dismiss"></span>
        </div>
    </div>
</div>
<script type="text/x-magento-init">
    {
        "*": {
            "Magento_Ui/js/core/app": {
                "components": {
                    "wtaiSlugNotice": {
                        "component": "WriteTextAI_WriteTextAI/js/grid/slug-notice",
                        "categoryLink": "<?= $block->escapeJs($block->getUrl('wtai/categories/index')) ?>",
                        "productLink": "<?= $block->escapeJs($block->getUrl('wtai/grid/index')) ?>",
                        "entityType": "<?= $block->escapeJs($block->getEntityType()) ?>"
                    }
                }
            }
        }
    }
</script>
