<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
?>
<?php /* @var \Magento\Framework\View\Element\Template $block */ ?>
<?php $_shipment = $block->getShipment() ?>
<?php
/* @var \Magento\Sales\Model\Order $_order */
$_order = $block->getOrder() ?>
<?php if ($_shipment && $_order) : ?>
    <?php $trackCollection = $_order->getTracksCollection($_shipment->getId()) ?>
    <?php if ($trackCollection) : ?>
        <br />
        <table class="shipment-track">
            <thead>
            <tr>
                <th><?= $block->escapeHtml(__('Shipped By')) ?></th>
                <th><?= $block->escapeHtml(__('Tracking Number')) ?></th>
            </tr>
            </thead>
            <tbody>
            <?php foreach ($trackCollection as $_item) : ?>
                <tr>
                    <td><?= $block->escapeHtml($_item->getTitle()) ?>:</td>
                    <td>
                        <a href="<?= $block->escapeUrl($block->getTrackingUrl()->getUrl($_item)) ?>" target="_blank">
                            <?= $block->escapeHtml($_item->getNumber()) ?>
                        </a>
                    </td>
                </tr>
            <?php endforeach ?>
            </tbody>
        </table>
    <?php endif; ?>
<?php endif; ?>
