<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */

/**
 * @var \Magento\Sales\Block\Adminhtml\Order\Create\Giftmessage $block
 * @var \Magento\Framework\View\Helper\SecureHtmlRenderer $secureRenderer
 */
?>
<?php /** @var \Magento\GiftMessage\Helper\Message $giftMessageHelper */
$giftMessageHelper = $block->getData('giftMessageHelper');
?>
<?php if ($giftMessageHelper->isMessagesAllowed('main', $block->getQuote(), $block->getStoreId())): ?>
    <?php $_items = $block->getItems(); ?>
    <div id="order-giftmessage" class="giftmessage-order-create">
        <fieldset class="admin__fieldset">
            <legend class="admin__legend">
                <span><?= $block->escapeHtml(__('Gift Message for the Entire Order')) ?></span>
            </legend>
            <br>
            <?php if ($giftMessageHelper->isMessagesAllowed('main', $block->getQuote(), $block->getStoreId())): ?>
                <p>
                    <?= $block->escapeHtml(
                        __('Leave this box blank if you don\'t want to leave a gift message for the entire order.')
                    ) ?>
                </p>
                <?= $block->getFormHtml($block->getQuote(), 'main') ?>
            <?php endif; ?>
        </fieldset>
        <?php $scriptString = <<<script
        require(['Magento_Sales/order/create/form'], function(){
            order.giftmessageFieldsBind('order-giftmessage');
        });
script;
        ?>
        <?= /* @noEscape */ $secureRenderer->renderTag('script', [], $scriptString, false) ?>
    </div>
<?php endif; ?>
