<?php
/**
 * Maho
 *
 * @category    design
 * @package     rwd_default
 * @copyright   Copyright (c) 2006-2020 Magento, Inc. (https://magento.com)
 * @copyright   Copyright (c) 2021-2022 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)
 */
?>
<?php $_order = $this->getOrder() ?>
<p class="order-links"><a href="<?= $this->getPrintAllCreditmemosUrl($_order) ?>" onclick="this.target='_blank'" class="link-print"><?= $this->__('Print All Refunds') ?></a></p>
<?php foreach ($_order->getCreditmemosCollection() as $_creditmemo): ?>
<h2 class="sub-title"><?= $this->__('Refund #') ?><?= $_creditmemo->getIncrementId() ?> <span class="separator">|</span> <a href="<?= $this->getPrintCreditmemoUrl($_creditmemo) ?>" onclick="this.target='_blank'" class="link-print"><?= $this->__('Print Refund') ?></a></h2>
<h3 class="table-caption"><?= $this->__('Items Refunded') ?></h3>
<table class="data-table linearize-table" id="my-refund-table-<?= $_creditmemo->getId() ?>">
    <col />
    <col width="1" />
    <col width="1" />
    <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" data-rwd-label="<?= $this->__('Price') ?>"><?= $this->__('Price') ?></th>
            <th class="a-center" data-rwd-label="<?= $this->__('Qty') ?>"><?= $this->__('Qty') ?></th>
            <th class="a-right" data-rwd-label="<?= $this->__('Subtotal') ?>"><?= $this->__('Subtotal') ?></th>
            <th class="a-center wrap" data-rwd-label="<?= $this->__('Discount Amount') ?>"><?= $this->__('Discount Amount') ?></th>
            <th class="a-right wrap" data-rwd-label="<?= $this->__('Row Total') ?>"><?= $this->__('Row Total') ?></th>
        </tr>
    </thead>
    <tfoot>
       <?= $this->getTotalsHtml($_creditmemo) ?>
    </tfoot>
    <?php $_items = $_creditmemo->getAllItems(); ?>
    <?php $_count = count($_items) ?>
    <?php foreach ($_items as $_item): ?>
    <?php if ($_item->getOrderItem()->getParentItem()) continue; ?>
    <tbody>
        <?= $this->getItemHtml($_item) ?>
    </tbody>
    <?php endforeach ?>
</table>
<?= $this->getCommentsHtml($_creditmemo) ?>
<?php endforeach ?>
