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

/**
 * @var \Magento\Sales\Block\Order\PrintOrder\Shipment $block
 * @var \Magento\Framework\Escaper $escaper
 */
?>
<?php $order = $block->getOrder(); ?>
<?php if (!$block->getObjectData($order, 'is_virtual')): ?>
    <?php foreach ($block->getShipmentsCollection() as $shipment): ?>
        <div class="order-details-items shipments">
            <div class="order-title">
                <strong>
                    <?= $escaper->escapeHtml(
                        __(
                            'Shipment #%1',
                            $block->getObjectData($shipment, 'increment_id')
                        )
                    ) ?>
                </strong>
            </div>
            <div class="table-wrapper order-items-shipment">
                <table class="data table table-order-items shipment"
                        id="my-shipment-table-<?= (int)$block->getObjectData($shipment, 'id') ?>">
                    <caption class="table-caption"><?= $escaper->escapeHtml(__('Items Invoiced')) ?></caption>
                    <thead>
                        <tr>
                            <th class="col name"><?= $escaper->escapeHtml(__('Product Name')) ?></th>
                            <th class="col sku"><?= $escaper->escapeHtml(__('SKU')) ?></th>
                            <th class="col price"><?= $escaper->escapeHtml(__('Qty Shipped')) ?></th>
                        </tr>
                    </thead>
                    <?php foreach ($block->getShipmentItems($shipment) as $item): ?>
                        <tbody>
                            <?= $block->getItemHtml($item) ?>
                        </tbody>
                    <?php endforeach; ?>
                </table>
            </div>
            <div class="block block-order-details-view">
                <div class="block-title">
                    <strong><?= $escaper->escapeHtml(__('Order Information')) ?></strong>
                </div>
                <div class="block-content">
                    <div class="box box-order-shipping-address">
                        <div class="box-title">
                            <strong><?= $escaper->escapeHtml(__('Shipping Address')) ?></strong>
                        </div>
                        <div class="box-content">
                            <address><?= $block->getShipmentAddressFormattedHtml($shipment) ?></address>
                        </div>
                    </div>

                    <div class="box box-order-shipping-method">
                        <div class="box-title">
                            <strong><?= $escaper->escapeHtml(__('Shipping Method')) ?></strong>
                        </div>
                        <div class="box-content">
                        <?= $escaper->escapeHtml($block->getObjectData($order, 'shipping_description')) ?>
                        <?php $tracks = $block->getShipmentTracks($shipment);
                        if ($tracks): ?>
                            <dl class="order-tracking">
                            <?php foreach ($tracks as $track): ?>
                                <dt class="tracking-title">
                                    <?= $escaper->escapeHtml($block->getObjectData($track, 'title')) ?>
                                </dt>
                                <dd class="tracking-content">
                                    <?= $escaper->escapeHtml($block->getObjectData($track, 'number')) ?>
                                </dd>
                            <?php endforeach; ?>
                            </dl>
                        <?php endif; ?>
                        </div>
                    </div>

                    <div class="box box-order-billing-address">
                        <div class="box-title">
                            <strong><?= $escaper->escapeHtml(__('Billing Address')) ?></strong>
                        </div>
                        <div class="box-content">
                            <address><?= $block->getBillingAddressFormattedHtml($order) ?></address>
                        </div>
                    </div>

                    <div class="box box-order-billing-method">
                        <div class="box-title">
                            <strong><?= $escaper->escapeHtml(__('Payment Method')) ?></strong>
                        </div>
                        <div class="box-content">
                            <?= $block->getPaymentInfoHtml() ?>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    <?php endforeach; ?>
<?php endif; ?>
