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

// phpcs:disable Magento2.Templates.ThisInTemplate

/** @var $block \Magento\Sales\Block\Order\Email\Items */
?>
<?php $_order = $block->getOrder() ?>
<?php if ($_order) : ?>
    <?php $_items = $_order->getAllItems(); ?>
    <table cellspacing="0" cellpadding="0" border="0" width="650" style="border:1px solid #EAEAEA;">
        <thead>
            <tr>
                <th align="left" bgcolor="#EAEAEA" style="font-size:13px; padding:3px 9px">Artikel</th>
                <th align="left" bgcolor="#EAEAEA" style="font-size:13px; padding:3px 9px">Inhalt</th>
                <th align="left" bgcolor="#EAEAEA" style="font-size:13px; padding:3px 9px">Artikelnummer</th>
                <th align="center" bgcolor="#EAEAEA" style="font-size:13px; padding:3px 9px">Menge</th>
                <th align="left" bgcolor="#EAEAEA" style="font-size:13px; padding:3px 9px">Preis</th>
                <th align="right" bgcolor="#EAEAEA" style="font-size:13px; padding:3px 9px">Zwischensumme</th>
            </tr>
        </thead>
        <?php foreach ($_items as $_item) : ?>
            <?php if (!$_item->getParentItem()) : ?>
                <tbody bgcolor="#F6F6F6">
                    <?= $block->getItemHtml($_item) ?>
                </tbody>
            <?php endif; ?>
        <?php endforeach; ?>
        <tbody>
            <?= $block->getChildHtml('order_totals') ?>
        </tbody>
    </table>
    <?php if ($this->helper(\Magento\GiftMessage\Helper\Message::class)
            ->isMessagesAllowed('order', $_order, $_order->getStore())
        && $_order->getGiftMessageId()
    ) : ?>
        <?php $_giftMessage = $this->helper(\Magento\GiftMessage\Helper\Message::class)
            ->getGiftMessage($_order->getGiftMessageId()); ?>
        <?php if ($_giftMessage) : ?>
            <br />
            <table class="message-gift">
                <tr>
                    <td>
                        <h3><?= $block->escapeHtml(__('Gift Message for this Order')) ?></h3>
                        <strong><?= $block->escapeHtml(__('From:')) ?></strong> <?= $block->escapeHtml($_giftMessage->getSender()) ?>
                        <br /><strong><?= $block->escapeHtml(__('To:')) ?></strong> <?= $block->escapeHtml($_giftMessage->getRecipient()) ?>
                        <br /><strong><?= $block->escapeHtml(__('Message:')) ?></strong>
                        <br /><?= $block->escapeHtml($_giftMessage->getMessage()) ?>
                    </td>
                </tr>
            </table>
        <?php endif; ?>
    <?php endif; ?>
<?php endif; ?>
