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

/** @var \Magento\Framework\View\Helper\SecureHtmlRenderer $secureRenderer */
?>

<?php $_childHtml = trim($block->getChildHtml('', false)); ?>
<?php if ($_childHtml): ?>
    <?php $_item = $block->getItem() ?>
    <tr>
        <td colspan="10" class="last">
            <a class="action-link" href="#" id="gift_options_link_<?= (int) $_item->getId() ?>">
                <?= $block->escapeHtml(__('Gift Options')) ?>
            </a>
            <?php $itemId = (int) ($_item->getId());
            $scriptString = <<<script
    require([
        "Magento_Sales/order/giftoptions_tooltip"
    ], function(){
        giftOptionsTooltip.addTargetLink(
            'gift_options_link_{$itemId}', {$itemId}
        );
    });
script;
            ?>
            <?= /* @noEscape */ $secureRenderer->renderTag('script', [], $scriptString, false) ?>
            <div id="gift_options_data_<?= (int) $_item->getId() ?>">
                <?= /* @noEscape */ $_childHtml ?>
            </div>
        </td>
    </tr>
<?php endif ?>
