<?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)
 */
?>
<?php /** @var Mage_Sales_Block_Order_Print_Shipment $this */?>
<?php $order = $this->getOrder(); ?>
<h1><?= $this->__('Order #%s', $this->getObjectData($order, 'real_order_id')) ?></h1>
<p class="order-date"><?= $this->__('Order Date: %s', $this->formatDate($this->getObjectData($order, 'created_at_store_date'), 'long')) ?></p>
<?php if (!$this->getObjectData($order, 'is_virtual')): ?>
<?php foreach ($this->getShipmentsCollection() as $shipment): ?>
    <h2 class="h2"><?= $this->__('Shipment #%s', $this->getObjectData($shipment, 'increment_id')) ?></h2>
    <div class="col2-set">
        <div class="col-1">
            <h3><?= $this->__('Shipping Address') ?></h3>
            <address><?= $this->getShipmentAddressFormattedHtml($shipment) ?></address>
        </div>
        <div class="col-2">
            <h3><?= $this->__('Billing Address') ?></h3>
            <address><?= $this->getBillingAddressFormattedHtml($order) ?></address>
        </div>
    </div>
    <div class="col2-set">
        <div class="col-1">
            <h3><?= $this->__('Shipping Method') ?></h3>
             <?= $this->escapeHtml($this->getObjectData($order, 'shipping_description')) ?>
             <?php $tracks = $this->getShipmentTracks($shipment);
                if ($tracks): ?>
                <table class="data-table" id="my-shipment-tracking">
                    <col />
                    <col />
                    <thead>
                        <tr>
                            <th><?= Mage::helper('sales')->__('Title') ?></th>
                            <th><?= Mage::helper('sales')->__('Number') ?></th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php foreach ($tracks as $track): ?>
                            <tr>
                                <td><?= $this->escapeHtml($this->getObjectData($track, 'title')) ?></td>
                                <td><?= $this->escapeHtml($this->getObjectData($track, 'number')) ?></td>
                            </tr>
                        <?php endforeach ?>
                    </tbody>
                </table>
            <?php endif ?>
        </div>
        <div class="col-2">
            <h3><?= $this->__('Payment Method') ?></h3>
            <?= $this->getPaymentInfoHtml() ?>
        </div>
    </div>
    <h3><?= $this->__('Items Shipped') ?></h3>
    <table class="data-table" id="my-shipment-table-<?= $this->getObjectData($shipment, 'id') ?>">
        <col />
        <col width="1" />
        <col width="1" />
        <thead>
            <tr>
                <th><?= $this->__('Product Name') ?></th>
                <th><?= $this->__('SKU') ?></th>
                <th class="a-center"><span class="nobr"><?= $this->__('Qty Shipped') ?></span></th>
            </tr>
        </thead>
        <?php foreach ($this->getShipmentItems($shipment) as $item): ?>
        <tbody>
            <?= $this->getItemHtml($item) ?>
        </tbody>
        <?php endforeach ?>
    </table>
<?php endforeach ?>
<?php endif ?>
<script type="text/javascript">window.print();</script>
