<?php
/**
 * Maho
 *
 * @category    design
 * @package     base_default
 * @copyright   Copyright (c) 2006-2020 Magento, Inc. (https://magento.com)
 * @copyright   Copyright (c) 2021-2024 The OpenMage Contributors (https://openmage.org)
 * @copyright   Copyright (c) 2024 Maho (https://mahocommerce.com)
 * @license     https://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
 */

/** @var Mage_Sales_Block_Order_Items $this */
?>
<?php  $_order = $this->getOrder() ?>
<table class="data-table" id="my-orders-table" summary="<?= Mage::helper('core')->quoteEscape($this->__('Items Ordered')) ?>">
    <col />
    <col width="1" />
    <col width="1" />
    <col width="1" />
    <col width="1" />
    <thead>
        <tr>
            <th><?= $this->__('Product Name') ?></th>
            <th><?= $this->__('SKU') ?></th>
            <th class="a-right"><?= $this->__('Price') ?></th>
            <th class="a-center"><?= $this->__('Qty') ?></th>
            <th class="a-right"><?= $this->__('Subtotal') ?></th>
        </tr>
    </thead>
    <tfoot>
        <?= $this->getChildHtml('order_totals') ?>
    </tfoot>
        <?php $_items = $_order->getItemsCollection(); ?>
        <?php $_index = 0; ?>
            <?php $_count = $_items->count(); ?>
        <?php foreach ($_items as $_item): ?>
        <?php if ($_item->getParentItem()) continue; ?>
        <tbody>
            <?= $this->getItemHtml($_item) ?>
            <?php if($this->canDisplayGiftmessage($_item)): ?>
            <tr class="border<?= ($_index++ > $_count ?' last':'') ?>" id="order-item-gift-message-<?= $_item->getId() ?>" style="display:none;">
                <?php $_giftMessage=$this->helper('giftmessage/message')->getGiftMessageForEntity($_item); ?>
                <td class="gift-message-row" colspan="7">
                    <a href="#" title="<?= Mage::helper('core')->quoteEscape($this->__('Close')) ?>" onclick="return giftMessageToogle('<?= $_item->getId() ?>');" class="btn-close"><?= $this->__('Close') ?></a>
                    <dl class="gift-message">
                        <dt><strong><?= $this->__('From:') ?></strong> <?= $this->escapeHtml($_giftMessage->getRecipient()) ?></dt>
                        <dt><strong><?= $this->__('To:') ?></strong> <?= $this->escapeHtml($_giftMessage->getSender()) ?></dt>
                        <dd><?= $this->helper('giftmessage/message')->getEscapedGiftMessage($_item) ?></dd>
                    </dl>
                </td>
            </tr>
            <?php endif ?>
        </tbody>
        <?php endforeach ?>
</table>
