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

<?php
/** @var \Magento\Backend\Block\Template $block */
?>

<div class="wtai-wtai-additional-prompt" data-bind="scope: 'wtaiAdditionalPrompt'">
    <div class="wtai-header">
        <p>Additional prompt</p>
        <div class="admin__field-tooltip wtai-small">
            <a class="admin__field-tooltip-action" href="#" data-toggle="dropdown"></a>
            <div class="admin__field-tooltip-content wtai-upper-right" data-target="dropdown">
                <div class="wtai-content-wrapper">
                    <?= /* @noEscape */ __('Additional prompt') ?>
                </div>
            </div>
        </div>
    </div>
    <p class="wtai-header-details">
        <?= /* @noEscape */ __('Use a comma to separate details.') ?>
    </p>
    <textarea name="additional_prompt" id="additional_prompt" class="wtai-textarea"
        data-bind="
            textInput: promptValue,
            event: { blur: handleInputAdditionalPrompt },
            attr: { maxlength: promptMaxLength }
        "
    ></textarea>
    <div class="wtai-footer-details">
        <p class="wtai-text-length" data-bind="text: getAdditionalPromptLength()"></p>
    </div>
</div>

<script type="text/x-magento-init">
    {
        "*": {
            "Magento_Ui/js/core/app": {
                "components": {
                    "wtaiAdditionalPrompt": {
                        "component": "WriteTextAI_WriteTextAI/js/edit/additional-prompt",
                        "saveAdditionalPromptUrl": "<?= $block->escapeJs(
                            $block->getUrl('wtai/settings/saveAdditionalPrompt')
                        ) ?>",
                        "entityType": "Product"
                    }
                }
            }
        }
    }
</script>