<?php
/**
 * @author 1902 Software
 * @copyright Copyright © 2023 1902 Software (https://1902software.com/magento/)
 * @package WriteTextAI_WriteTextAI
 */
?>

<?php
/** @var \WriteTextAI\WriteTextAI\ViewModel\Tooltip $tooltip */
/** @var \WriteTextAI\WriteTextAI\ViewModel\Permissions $permissions */

$tooltip = $block->getTooltip();
$permissions = $block->getPermissions();
?>
<div class="wtai-mark-reviewed page-actions-buttons wtai-input-wrapper" data-bind="scope: 'wtaiMarkReviewed'">
    <?php if ($permissions->isReviewAllowed()): ?>
        <input type="checkbox"
            class="admin__control-checkbox"
            name="reviewed"
            id="wtaiReviewed"
            data-bind="checked: reviewed, disable: !canReview(), css: { 'wtai-disabled': !canReview() }"
        />
        <label class="action-default action" for="wtaiReviewed" data-bind="css: { 'wtai-disabled': !canReview() }">
            <span><?= $block->escapeHtml(__('Mark as reviewed')) ?></span>
        </label>
        <div class="wtai-tooltip-wrapper">
            <div class="admin__field-tooltip wtai-small">
                <a class="admin__field-tooltip-action" href="#" data-toggle="dropdown"></a>
                <div class="admin__field-tooltip-content" data-target="dropdown">
                    <div class="wtai-content-wrapper">
                        <?= /* @noEscape */ $tooltip->getReviewedTooltipCategory() ?>
                    </div>
                </div>
            </div>
        </div>
    <?php endif; ?>
</div>
<script type="text/x-magento-init">
    {
        "*": {
            "Magento_Ui/js/core/app": {
                "components": {
                    "wtaiMarkReviewed": {
                        "component": "WriteTextAI_WriteTextAI/js/categories/edit/mark-reviewed",
                        "markReviewUrl":
                            "<?= $block->escapeJs($block->getUrl('wtai/categories/edit_mark_reviewed')) ?>",
                        "isReviewAllowed": <?= $block->escapeJs(
                            $permissions->isReviewAllowed() ? 'true' : 'false'
                        ) ?>
                    }
                }
            }
        }
    }
</script>
