<?php
/**
 * OpenMage
 *
 * This source file is subject to the Academic Free License (AFL 3.0)
 * that is bundled with this package in the file LICENSE_AFL.txt.
 * It is also available at https://opensource.org/license/afl-3-0-php
 *
 * @category    design
 * @package     base_default
 * @copyright   Copyright (c) 2006-2020 Magento, Inc. (https://www.magento.com)
 * @copyright   Copyright (c) 2021-2024 The OpenMage Contributors (https://www.openmage.org)
 * @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><?php echo $this->__('Order #%s', $this->getObjectData($order, 'real_order_id')); ?></h1>
<p class="order-date"><?php echo $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"><?php echo $this->__('Shipment #%s', $this->getObjectData($shipment, 'increment_id')); ?></h2>
    <div class="col2-set">
        <div class="col-1">
            <h3><?php echo $this->__('Shipping Address') ?></h3>
            <address><?php echo $this->getShipmentAddressFormattedHtml($shipment); ?></address>
        </div>
        <div class="col-2">
            <h3><?php echo $this->__('Billing Address') ?></h3>
            <address><?php echo $this->getBillingAddressFormattedHtml($order); ?></address>
        </div>
    </div>
    <div class="col2-set">
        <div class="col-1">
            <h3><?php echo $this->__('Shipping Method') ?></h3>
             <?php echo $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><?php echo Mage::helper('sales')->__('Title')?></th>
                            <th><?php echo Mage::helper('sales')->__('Number')?></th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php foreach ($tracks as $track): ?>
                            <tr>
                                <td><?php echo $this->escapeHtml($this->getObjectData($track, 'title')); ?></td>
                                <td><?php echo $this->escapeHtml($this->getObjectData($track, 'number')); ?></td>
                            </tr>
                        <?php endforeach ?>
                    </tbody>
                </table>
                <script type="text/javascript">decorateTable('my-shipment-tracking');</script>
            <?php endif ?>
        </div>
        <div class="col-2">
            <h3><?php echo $this->__('Payment Method') ?></h3>
            <?php echo $this->getPaymentInfoHtml() ?>
        </div>
    </div>
    <h3><?php echo $this->__('Items Shipped') ?></h3>
    <table class="data-table" id="my-shipment-table-<?php echo $this->getObjectData($shipment, 'id') ?>">
        <col />
        <col width="1" />
        <col width="1" />
        <thead>
            <tr>
                <th><?php echo $this->__('Product Name') ?></th>
                <th><?php echo $this->__('SKU') ?></th>
                <th class="a-center"><span class="nobr"><?php echo $this->__('Qty Shipped') ?></span></th>
            </tr>
        </thead>
        <?php foreach ($this->getShipmentItems($shipment) as $item): ?>
        <tbody>
            <?php echo $this->getItemHtml($item) ?>
        </tbody>
        <?php endforeach ?>
    </table>
    <script type="text/javascript">decorateTable('my-shipment-table-<?php echo $this->getObjectData($shipment, 'id')?>', {'tbody' : ['odd', 'even'], 'tbody tr' : ['first', 'last']})</script>
<?php endforeach ?>
<?php endif ?>
<script type="text/javascript">window.print();</script>
